【口令檔案】remote_login_passwordfile

TaihangMeng發表於2017-05-22


    口令檔案用於具有sysdba身份的使用者執行遠端登入資料庫,Oracle允許使用者通過口令檔案驗證,在資料庫未啟動之前登入,從而啟動例項,載入開啟資料庫;Oracle通過一個初始化引數remote_login_passwordfile限制口令檔案的使用,通過配置該引數可以控制是否在多個資料之間共享密碼檔案,也可以通過這個引數禁用口令檔案驗證。該引數是靜態引數,修改後需要重啟資料庫生效。

    Oracle尋找口令檔案的順序:orapw —> orapw —> failure


remote_login_passwordfile的值:

1、 NONE:禁用口令檔案驗證

設定成NONE時,使用者將不能以SYSDBA或SYSOPER身份遠端登入。

SYS@MTH> show parameter remote_login

NAME                                   TYPE                             VALUE
------------------------------------   -------------------------------- ------------------------------
remote_login_passwordfile              string                            NONE


oracle@C01TEST03:/home/oracle>sqlplus sys/××××××@mth as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 22 15:09:30 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name:


本地server是可以登入的:

oracle@C01TEST03:/home/oracle>sqlplus sys/somersby as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 22 15:14:05 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


2、EXCLUSIVE:獨佔模式(預設)

    (1)普通使用者被賦予SYSDBA角色時,就會被寫到orapw檔案中;

    (2)具有SYSDBA角色的使用者,密碼更改後也會記錄到口令檔案。

oracle@C01TEST03:/oracle/product/11.2.0/dbs>strings $ORACLE_HOME/dbs/orapwMTH
]\[Z
ORACLE Remote Password file
INTERNAL
CFBC245AC38E5695
D554438BDCDF8D2F
SYSTEM
DE262D2D0106CFCE
7(      }


修改引數值為EXCLUSIVE:

SYS@MTH> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@MTH> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 1887350784 bytes
Fixed Size                  2254344 bytes
Variable Size             520096248 bytes
Database Buffers         1358954496 bytes
Redo Buffers                6045696 bytes
Database mounted.
Database opened.
SYS@MTH>
SYS@MTH> set lines 200;
SYS@MTH> show parameter remote_login_passwordfile;

NAME                                 TYPE                             VALUE
------------------------------------ -------------------------------- ------------------------------
remote_login_passwordfile            string                           EXCLUSIVE


檢視具有SYSDBA角色的使用者:

SYS@MTH> select * from v$pwfile_users;

USERNAME                       SYSDB     SYSOP   SYSAS
------------------------------ --------- ------- --------
SYS                            TRUE      TRUE    FALSE
SYSTEM                         TRUE      FALSE   FALSE


3、SHARED:共享模式
(1)配置shared模式,口令檔案可以被一臺伺服器上的多個資料庫或者RAC叢集資料庫共享;

(2)shared模式下,修改具有SYSDBA角色的使用者的密碼,授予普通使用者SYSDBA許可權,都是不允許的。


SYS@MTH> alter user sys identified by mth;
alter user sys identified by mth
*
ERROR at line 1:
ORA-28046: Password change for SYS disallowed


SYS@MTH> grant sysdba to mth;
grant sysdba to mth
*
ERROR at line 1:
ORA-01999: password file cannot be updated in SHARED mode


將引數從EXCLUSIVE修改為SHARED:

(1)修改口令檔名

oracle@C01TEST03:/oracle/product/11.2.0/dbs>mv orapwMTH orapw

(2)修改引數的值

SYS@MTH> alter system set remote_login_passwordfile=shared scope=spfile;

System altered.

(3)重啟資料庫生效


參考部落格:http://www.cnblogs.com/ericli/articles/5477742.html

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

相關文章