拥有sysdba权限用户,在数据库中和密码文件中的密码关系

拥有sysdba权限用户,在数据库中和密码文件中的密码关系

测试系统:oracle11g 11.2.0.3

环境配置:
在sqlnet.ora中,将
SQLNET.AUTHENTICATION_SERVICES= (NTS)修改为NONE
修改后为
SQLNET.AUTHENTICATION_SERVICES= (NONE),目的是取消系统登录验证

结论:
无论是修改orapwd文件还是通过alter user 来修改sys用户的密码,密码是一起来变化的。

连接测试
C:\Users\thinkpad>sqlplus sys/oracle@db as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 25 16:00:31 2013
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

1 修改orapwd的密码
[oracle@r11g dbs]$ rm -f orapwdb
[oracle@r11g dbs]$ orapwd file=orapwdb password=sysoracle 

远程连接:
C:\Users\thinkpad>sqlplus sys/oracle@db as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 25 16:04:13 2013
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:

本地连接:
[oracle@r11g dbs]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 25 16:16:18 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: ^C
[oracle@r11g dbs]$ 
[oracle@r11g dbs]$ sqlplus sys/sysoracle as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 25 16:16:35 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> 

2 使用alter user sys identified by xxx 来修改sys用户密码
SQL> alter user sys identified by mssoracle;
User altered.

连接测试
C:\Users\thinkpad>sqlplus sys/oracle@db as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 25 16:11:02 2013
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
C:\Users\thinkpad>
C:\Users\thinkpad>sqlplus sys/mssoracle@db as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 25 16:11:12 2013
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

本地
[oracle@r11g dbs]$ sqlplus sys/sysoracle as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 25 16:18:45 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: ^C
[oracle@r11g dbs]$ 
[oracle@r11g dbs]$ sqlplus sys/mssoracle as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 25 16:18:56 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> 

3 查看密码文件
[oracle@r11g dbs]$ strings orapwdb
]\[Z
ORACLE Remote Password file
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A

SQL> alter user sys identified by moracle;
User altered.

[oracle@r11g dbs]$ strings orapwdb
]\[Z
ORACLE Remote Password file
INTERNAL
E568563E8635750E
5D7748DDCA524F13

通过这个可以看到使用alter user 来修改sys的密码,密码文件中的内容也修改了。

4 删除密码文件
[oracle@r11g dbs]$ rm -f orapwdb
[oracle@r11g dbs]$ 
[oracle@r11g dbs]$ ls
hc_db.dat  initdb.ora  init.ora  lkDB  spfiledb.ora

远程将无法登录
C:\Users\thinkpad>sqlplus sys/oracle@db as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 25 16:45:52 2013
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
ERROR:
ORA-01031: insufficient privileges
Enter user-name:

参考文档:
asktom:sys password change and orapwd file
hat is a bit dated but still true. 
If you create the password file with a password different than the sys password, that'll be the password you use to connect as sysdba over a network (the password in the password file is used for sysdba connections). The sys password to just connect as sys (something you wouldn't really ever have a need to do EVER) can be different. 
But when you alter the SYS password, they sync that up with the password file, as demonstrated. 
Since the password file is separate and distinct from the database - it does not attempt to update the database when you update the password file. 

asktom:Problem to connect as SYSDBA

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11590946/viewspace-1064362/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/11590946/viewspace-1064362/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值