使用者密碼研究

shiyihai發表於2007-01-26

同事請求我為她自己用的測試使用者改登陸密碼,這種小case都help我,顯然她對資料庫的知識比較欠缺.

於是有了下面的操作案例:

SQL> conn / as sysdba
Connected.
SQL> alter user shiyihai identified by abc;

User altered.

SQL> conn shiyihai/abc
Connected.
SQL> conn / as sysdba
Connected.
SQL> alter user shiyihai identified by shiyihai;

User altered.

SQL> conn shiyihai/shiyihai
Connected.
SQL> conn / as sysdba
Connected.
SQL> select username,password from dba_users where username='SHIYIHAI';

USERNAME PASSWORD
------------------------------ ------------------------------
SHIYIHAI 010CD1914E5AB20C

SQL> alter user shiyihai identified by abc;

User altered.

SQL> conn shiyihai/abc
Connected.
SQL> conn / as sysdba
Connected.
SQL> alter user shiyihai identified by values '010CD1914E5AB20C';

User altered.

SQL> conn shiyihai/shiyihai
Connected.
SQL>


SQL> conn shiyihai/shiyihai
Connected.
SQL> conn / as sysdba
Connected.
SQL> alter user shiyihai identified by abc;

User altered.

SQL> conn shiyihai/abc
Connected.
SQL> conn / as sysdba
Connected.
SQL> alter user shiyihai identified by shiyihai;

User altered.

SQL> conn shiyihai/shiyihai
Connected.
SQL> conn / as sysdba
Connected.
SQL> select username,password from dba_users where username='SHIYIHAI';

USERNAME PASSWORD
------------------------------ ------------------------------
SHIYIHAI 010CD1914E5AB20C

SQL> alter user shiyihai identified by abc;

User altered.

SQL> conn shiyihai/abc
Connected.
SQL> conn / as sysdba
Connected.
SQL> alter user shiyihai identified by values '010CD1914E5AB20C';

User altered.

SQL> conn shiyihai/shiyihai
Connected.
SQL>
SQL> conn shiyihai/shiyihai
Connected.
SQL> alter user shiyihai identified by abc;

User altered.

SQL> conn shiyihai/abc
Connected.
SQL> conn / as sysdba
Connected.
SQL> alter user shiyihai identified by values '010CD1914E5AB20C';

User altered.

SQL> conn shiyihai/shiyihai
Connected.
SQL>

結論:

1.每個使用者均可改自己的密碼(alter user xxx identified by yyy),具有dba身份的使用者可改其它使用者的密碼;

2.dba_users字典表中的password是使用者儲存在資料庫中加過密的密碼值(這個加密演算法我一直都沒弄明白採用的是什麼演算法),結合alter user xxx identified by values 'password'可還原使用者的舊密碼值.這個功能完全可以用在按使用者遷移資料的實際操作中.

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/38542/viewspace-893766/,如需轉載,請註明出處,否則將追究法律責任。

相關文章