SQL*Plus: Release 9.2.0.3.0 - Production on Thu Apr 15 09:58:45 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:Oracle9i Enterprise Edition Release 9.2.0.3.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.3.0 - Production
SQL> alter user sys identified by oracle;
User altered.
SQL> show parameter pass
NAME TYPE VALUE--------------------- ----------- ------------------------------remote_login_passwordfile string NONE
remote:
E:\Oracle\ora92\bin>sqlplus /nologSQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:39:22 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.SQL> connect sys/oracle@hsjf as sysdbaERROR:ORA-01017: invalid username/password; logon denied
此處實際上是無法通過口令檔案驗證
2.remote_login_passwordfile = exclusive
SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;
System altered.
SQL> startup force;ORACLE instance started.
Total System Global Area 131142648 bytesFixed Size 451576 bytesVariable Size 104857600 bytesDatabase Buffers 25165824 bytesRedo Buffers 667648 bytesDatabase mounted.Database opened.SQL> show parameter pass
NAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string EXCLUSIVESQL> alter user sys identified by oracle;
User altered.
remote:
E:\Oracle\ora92\bin>sqlplus /nologSQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:47:11 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.SQL> connect sys/oracle@hsjf as sysdba已串連。SQL> show userUSER 為"SYS"SQL>
這實際上就是通過口令檔案驗證登入的
3.進一步測試
如果此時我們刪除passwdfile,sysdba/sysoper將無法認證,也就無法登陸資料庫
Server:
SQL> ![oracle@jumper oracle]$ cd $ORACLE_HOME/dbs[oracle@jumper dbs]$ ls orapwhsjforapwhsjf[oracle@jumper dbs]$ mv orapwhsjf orapwhsjf.bak[oracle@jumper dbs]$
Remote:
E:\Oracle\ora92\bin>sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on 星期四 4月 15 09:50:14 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys/oracle@hsjf as sysdbaERROR:ORA-01031: insufficient privileges
SQL>
這實際上就是無法通過口令檔案驗證身份
4.如果丟失了passwdfile
如果使用passwdfile卻意外丟失,此時將不能啟動資料庫
SQL> startup force;ORACLE instance started.
Total System Global Area 131142648 bytesFixed Size 451576 bytesVariable Size 104857600 bytesDatabase Buffers 25165824 bytesRedo Buffers 667648 bytesORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3
SQL*Plus: Release 9.2.0.3.0 - Production on Tue Jul 6 09:40:34 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:Oracle9i Enterprise Edition Release 9.2.0.3.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.3.0 - Production
Total System Global Area 235999908 bytesFixed Size 451236 bytesVariable Size 201326592 bytesDatabase Buffers 33554432 bytesRedo Buffers 667648 bytesORA-01990: error opening password file '/opt/oracle/product/9.2.0/dbs/orapw'--這是最後尋找的檔案ORA-27037: unable to obtain file statusLinux Error: 2: No such file or directoryAdditional information: 3
NAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string SHAREDSQL>
那麼你可能會有這樣的疑問,多個Exclusive的資料庫是否可以共用一個口令檔案(orapw)呢?
我們繼續這個實驗:
SQL> show parameter passwordNAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_login_passwordfile string SHARED
[oracle@jumper oracle]$ orapwdUsage: orapwd file=<fname> password=<password> entries=<users> wherefile - name of password file (mand),password - password for SYS (mand),entries - maximum number of distinct DBA and OPERs (opt), There are no spaces around the equal-to (=) character.