共計 4947 個字符,預計需要花費 13 分鐘才能閱讀完成。
本篇文章給大家分享的是有關如何進行對 REMOTE_LOGIN_PASSWORDFILE 參數的探討,丸趣 TV 小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著丸趣 TV 小編一起來看看吧。
密碼文件,是僅用來限制具有 sysdba 或者 sysoper 權限的用戶以遠程的方式連接數據庫的密碼校驗文件。如果不存在密碼文件或者密碼文件丟失,那么以 sysdba 或者 sysoper 權限的用戶將無法登陸并返回錯誤:
[oracle@home2 dbs]$ mv orapwthinkbase orapwthinkbase.bak
[oracle@home1 ~]$ sqlplus sys/oracle@thinkbase as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 20 16:39:39 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
重新創建或者恢復密碼文件,用戶才能重新連接:
[oracle@home2 dbs]$ mv orapwthinkbase.bak orapwthinkbase
[oracle@home1 ~]$ sqlplus sys/oracle@thinkbase as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 20 17:06:28 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@thinkbase
而 REMOTE_LOGIN_PASSWORDFILE 參數是對密碼文件使用的限定,下面就對 REMOTE_LOGIN_PASSWORDFILE 參數的各項參數進行探討
REMOTE_LOGIN_PASSWORDFILE = NONE
當 REMOTE_LOGIN_PASSWORDFILE 參數為 NONE 時,密碼文件被禁用,用戶無法以管理員級別用戶遠程登錄到數據庫,如下:
SYS@thinkbase show parameter pass
NAME TYPE VALUE
———————————— ———– ——————————
remote_login_passwordfile string EXCLUSIVE
SYS@thinkbase alter system set remote_login_passwordfile=NONE scope=spfile;
System altered.
SYS@thinkbase startup force;
ORACLE instance started.
Total System Global Area 941600768 bytes
Fixed Size 1348860 bytes
Variable Size 549456644 bytes
Database Buffers 385875968 bytes
Redo Buffers 4919296 bytes
Database mounted.
Database opened.
SYS@thinkbase show parameter pass
NAME TYPE VALUE
———————————— ———– ——————————
remote_login_passwordfile string NONE
[oracle@home1 ~]$ sqlplus sys/oracle@thinkbase as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 20 17:10:01 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
需要留意到設置 REMOTE_LOGIN_PASSWORDFILE 參數為 NONE,與密碼文件缺失時用戶登錄的返回錯誤差異,實際上“ORA-01017: invalid username/password; logon denied”此時表達的是密碼文件被禁用了。
REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE(系統默認值)
此參數下數據庫可以添加系統管理員級別的用戶,可以允許使用 alter user 命令修改 sys 用戶的密碼,并將此類修改記錄到密碼文件當中。
SYS@thinkbase show parameter pass
NAME TYPE VALUE
———————————— ———– ——————————
remote_login_passwordfile string NONE
SYS@thinkbase grant sysdba to hr;
grant sysdba to hr
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled
SYS@thinkbase alter system set remote_login_passwordfile=exclusive scope=spfile;
System altered.
SYS@thinkbase startup force;
ORACLE instance started.
Total System Global Area 941600768 bytes
Fixed Size 1348860 bytes
Variable Size 549456644 bytes
Database Buffers 385875968 bytes
Redo Buffers 4919296 bytes
Database mounted.
Database opened.
SYS@thinkbase show parameter pass
NAME TYPE VALUE
———————————— ———– ——————————
remote_login_passwordfile string EXCLUSIVE
SYS@thinkbase grant sysdba to hr;
Grant succeeded.
SYS@thinkbase alter user sys identified by oracle123;
User altered.
REMOTE_LOGIN_PASSWORDFILE = SHARED
SHARED 參數可以允許多個數據庫共享一個口令文件, 但是只可以識別一個用戶:SYS。但是 SHARED 參數下的密碼文件不能被修改。也就是沒法添加用戶為系統管理員級別,也無法寫入到密碼文件中。
SYS@thinkbase show parameter pass
NAME TYPE VALUE
———————————— ———– ——————————
remote_login_passwordfile string EXCLUSIVE
SYS@thinkbase alter system set remote_login_passwordfile=shared scope=spfile;
System altered.
SYS@thinkbase startup force;
ORACLE instance started.
Total System Global Area 941600768 bytes
Fixed Size 1348860 bytes
Variable Size 549456644 bytes
Database Buffers 385875968 bytes
Redo Buffers 4919296 bytes
Database mounted.
Database opened.
SYS@thinkbase show parameter pass
NAME TYPE VALUE
———————————— ———– ——————————
remote_login_passwordfile string SHARED
SYS@thinkbase grant sysdba to sh;
grant sysdba to sh
*
ERROR at line 1:
ORA-01999: password file cannot be updated in SHARED mode
SYS@thinkbase alter user sys identified by oracle;
alter user sys identified by oracle
*
ERROR at line 1:
ORA-28046: Password change for SYS disallowed
同時 oracle 建議如果既要給用戶添加系統管理員級別權限又要使用 shared 模式,最好是先在 exclusive 模式下設置好管理員權限的用戶,再將 REMOTE_LOGIN_PASSWORDFILE 參數修改為 shared 共享口令文件。
實驗小結:
1. 密碼文件類似于參數文件,只有在登錄或者有信息要寫入或者進行修改時才會用到,其他時候即使丟失也不會影響到數據庫的運行。
2. 由于上面的特點,備份時候通常不會對密碼文件進行備份,如果丟失也可以使用如下的語句重新創建密碼文件:
[oracle@home2 dbs]$ orapwd
Usage: orapwd file= entries= force= ignorecase= nosysdba=
where
file – name of password file (required),
password – password for SYS will be prompted if not specified at command line,
entries – maximum number of distinct DBA (optional),
force – whether to overwrite existing file (optional),
ignorecase – passwords are case-insensitive (optional),
nosysdba – whether to shut out the SYSDBA logon (optional Database Vault only).
There must be no spaces around the equal-to (=) character.
以上就是如何進行對 REMOTE_LOGIN_PASSWORDFILE 參數的探討,丸趣 TV 小編相信有部分知識點可能是我們日常工作會見到或用到的。希望你能通過這篇文章學到更多知識。更多詳情敬請關注丸趣 TV 行業資訊頻道。