首页 > 解决方案 > 在 SQL 加载程序命令中获取无效的用户名和密码

问题描述

sqlldr system/(giving my password) control='E:\sqlloader\load_test.ctl'

但它会引发错误

SQL*Loader-128: unable to begin a session

ORA-01017: invalid username/password; logon denied

标签: oraclesql-loader

解决方案


那是因为您提供了无效的密码

这就是我真正所做的;xxx当然不是system的密码:

c:\Temp>sqlldr system/xxx control=a.ctl

SQL*Loader: Release 11.2.0.2.0 - Production on Pet Lis 29 20:17:58 2021

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

SQL*Loader-128: unable to begin a session
ORA-01017: invalid username/password; logon denied

但是,如果我提供一个有效的密码(不过我不会透露),它会起作用

c:\Temp>sqlldr system/valid_password control=a.ctl

SQL*Loader: Release 11.2.0.2.0 - Production on Pet Lis 29 20:18:11 2021
<snip>

另外,正如巴巴罗斯告诉你的那样,不要使用system(nor sys) 来娱乐。创建任何其他用户并将其架构用于您的游乐场。下面是方法(在我的 11gXE 数据库上): 连接为sys

c:\Temp>sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Pet Lis 29 20:21:05 2021

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

检查你有哪些表空间:

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS

创建用户:

SQL> create user vicky
  2  identified by barba              --> this is the password
  3  default tablespace users
  4  temporary tablespace temp
  5  quota unlimited on users;

User created.

授予一些特权;稍后,根据需要授予他人:

SQL> grant create session, create table to vicky;

Grant succeeded.

让我们尝试一下:

SQL> connect vicky/barba
Connected.
SQL> create table test as select 1 id, sysdate datum from dual;

Table created.

SQL> select * From test;

        ID DATUM
---------- --------
         1 29.10.21

SQL>

推荐阅读