|
一个奇怪的问题
通过SHELL远端登录Linux Server, 然后用SYS用户登录oracle
sqlplus '/ as sysdba'
启动数据库到open状态, 然后disconn,
再通过用户名,密码登录sys用户: conn sys/rico as sysdba 能够正常登陆
但是通过Windows机器上的SQLPLUS进行远程登录时, 用同样的用户名,密码却登陆不了:
SQL> conn sys/rico@ricoyu9i as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied
尝试弄清原由:
1, 通过SHELL登录Oracle Server, 首先删除password文件:
[oracle@oracle9i dbs]$ mv orapwricoyu9i orapwricoyu9i.bak2
2, 重建password 文件:
[oracle@oracle9i dbs]$ orapwd file=orapwricoyu9i password=rico entries=5;
3, 用sys用户连接sqlplus
[oracle@oracle9i dbs]$ sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.4.0 - Production on Sun Mar 20 15:44:57 2011
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
4, 此时, 通过SQLPLUS客户端用sys用户进行远程登录
SQL> conn sys/rico@ricoyu9i as sysdba
已连接到空闲例程。
此时正常登录,
5, 在通过SHELL登录的那个SQLPLUS中启动数据库, 修改sys密码
SQL> startup
ORACLE instance started.
Total System Global Area 286332064 bytes
Fixed Size 451744 bytes
Variable Size 251658240 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> alter user sys identified by vivi;
User altered.
6, 退出sys, 分别用rico和vivi做密码重新登录, 两个密码都可以登录
SQL> disconn
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> conn sys/rico as sysdba
Connected.
SQL> disconn
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> conn sys/vivi as sysdba
Connected.
7, 退出通过SQLPLUS客户端登录的那个SYS用户, 然后再分别用rico和vivi登录
SQL> disconn
已断开连接
SQL> conn sys/rico@ricoyu9i as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> conn sys/vivi@ricoyu9i as sysdba
已连接。
8, 分析
通过1,2步删除, 重建password文件的过程, 确定了sys的password文件认证方式的密码为rico.
第3步, 通过命令sqlplus '/ as sysdba'登录oracle, 这种方式的认证方式应该是操作系统认证, 它并不要求我提供一个密码
第4步, 通过SQLPLUS客户端远程登录, conn sys/rico@ricoyu9i as sysdba, 此时可以成功登录, 所以该方式应该是通过password文件认证
第6步, 此时是通过SHELL登录的那个SYS用户.在启动数据库以后, 修改SYS用户的密码为vivi, 此处修改的密码是保存在dba_users表中? 接着退出SYS用户的登录, 再通过rico,vivi两个密码分别登录, 都登录成功. 所以在数据库启动过后, 在Oracle server上登录sys用户, 密码为password
文件中定义的或者是保存在dba_users表中的密码都是可以的
第7步, 退出通过SQLPLUS客户端登录的那个SYS用户, 然后再分别用rico和vivi登录, 此时只有vivi这个密码可以登录成功
SQL> conn sys/qianyu14@ricoyu9i as sysdba
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> conn sys/vivi@ricoyu9i as sysdba
已连接。
9,结论
在Oracle Server上, 不管数据库是否启动, 都可以用password认证方式登录数据库, 而通过SQLPLUS客户端在远端登录, 启动数据库之后只能通过dba_users表中记录的密码来登录, 不能再通过password文件认证方式来登录了
以上为小弟的观点, 望高手指点! |
|