【密码】oracle修改密码,11g的加密密码不见了
oracle命令行修改密码有两种方法,以oracle10g为例,如下:
一:解锁用户同时密码指定为tiger
[oracle@ocmu admin]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Mon Sep 17 13:04:29 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options
SYS@ORA10G>
SYS@ORA10G>alter user scott account unlock identified by tiger;
User altered.
SYS@ORA10G>conn scott/tiger
Connected.
SCOTT@ORA10G>
SCOTT@ORA10G>conn / as sysdba
Connected.
SYS@ORA10G>
二:查看一下scott加密后的密码
SYS@ORA10G>SELECT username,password FROM dba_users where username=’SCOTT’;
USERNAME PASSWORD
—————————— ——————————
SCOTT F894844C34402B67
SYS@ORA10G>
SYS@ORA10G>
三:修改密码方法1:直接指定明文密码
SYS@ORA10G>alter user scott identified by scott123;
User altered.
SYS@ORA10G>conn scott/scott123
Connected.
SCOTT@ORA10G>conn / as sysdba
Connected.
SYS@ORA10G>
四:修改密码方法2:指定加密密码
SYS@ORA10G>alter user scott identified by values ‘F894844C34402B67′;
User altered.
SYS@ORA10G>
SYS@ORA10G>conn scott/tiger
Connected.
SCOTT@ORA10G>
SCOTT@ORA10G>conn / as sysdba
Connected.
SYS@ORA10G>
在oracle11g中,这两种的修改方式还是都适用的,不过,有一点有了变化,那就是在dba_users中的password,加密的密码字段已经被遗弃了(This column is deprecated,源自官方文档),如下:
五:解锁scott用户并指定密码为oracle
[oracle@ocmu ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 17 13:21:18 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@ORA11GR2>alter user scott account unlock identified by oracle;
User altered.
SYS@ORA11GR2>
SYS@ORA11GR2>conn scott/oracle
Connected.
SCOTT@ORA11GR2>conn / as sysdba
Connected.
SYS@ORA11GR2>
六:查看scott用户的密码,发现password里面是空的。
SYS@ORA11GR2>SELECT username,password FROM dba_users where username=’SCOTT’;
USERNAME PASSWORD
—————————— ——————————
SCOTT
SYS@ORA11GR2>
SCOTT@ORA11GR2>set null unknown
SYS@ORA11GR2>SELECT username,password FROM dba_users where username=’SCOTT’;
USERNAME PASSWORD
—————————— ——————————
SCOTT unknown
SYS@ORA11GR2>
七:在命令行将scott的密码以明文方式改为oracle123
SYS@ORA11GR2>alter user scott identified by oracle123;
User altered.
SYS@ORA11GR2>
八:在命令行将scott的密码以加密的方式修改(使用刚才oracle10g中显示的加密密码,即tiger)
SYS@ORA11GR2>alter user scott identified by values ‘F894844C34402B67′;
User altered.
SYS@ORA11GR2>
SYS@ORA11GR2>conn scott/tiger
Connected.
SCOTT@ORA11GR2>
SCOTT@ORA11GR2>
小结:
1:oracle11g的加密密码已经不见了,提高了安全性。否则,我们可以利用这个加密密码,来修改其密码;
2:oracle10g中的加密后的密码,在oracle11g中是通用的。如果,我们生产库中的密码要经常性的修改,那么,我们可以考虑以加密的方式进行修改密码。