sys(sysdba用戶組成員)用戶有兩種認證方式:
1、操作系統認證方式
在本地服務器(數據庫所在服務器)登錄數據庫
oracle將用戶認證由操作系統在數據庫外執行,默認情況下只需要以oracle賬戶登錄操作系統便可以直接連接數據庫,不需要口令。
如果需要口令認證,需要在$ORACLE_HOME/dbs/sqlnet.ora,加入如下行:
SQLNET.AUTHENTICATION_SERVICES=NONE
此時連接數據庫就需要輸入用戶和密碼了
2、數據庫認證方式
通過在數據庫配置文件裡(spfile)裡配置REMOTE_LOGIN_PASSWORDFILE指定遠程登錄訪問數據庫的方式
a、none
Oracle ignores any password file. Therefore, privileged users must be authenticated by the operating system
不允許sysdba用戶組成員遠程登錄訪問數據庫
b、exclusive
The password file can be used by only one database. The password file can contain SYS as well as non-SYS users.
只允許口令文件用於本數據庫,允許sysdba用戶組成員遠程登錄訪問數據庫
c、shared
One or more databases can use the password file. The password file can contain SYS as well as non-SYS users.
允許其他數據庫使用該口令文件,允許sysdba用戶組成員遠程登錄訪問數據庫
sqlplus 連接遠程數據庫失敗:
C:\Users\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 11月 2 16:32:13 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
檢查遠程登錄設置,發現配置remote_login_passwordfile=NONE禁止sysdba用戶(及擁有其角色的普通用戶)遠程登錄。
SQL> show parameter pass
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string NONE
修改配置remote_login_passwordfile=exclusive(這是個靜態參數要修改spfile文件),sysdba用戶(及擁有其角色的普通用戶)可以遠程登錄。
SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;
System altered.
重啟數據庫
SQL> startup force;
ORACLE instance started.
Total System Global Area 3758096384 bytes
Fixed Size 2088408 bytes
Variable Size 1593836072 bytes
Database Buffers 2147483648 bytes
Redo Buffers 14688256 bytes
Database mounted.
Database opened.
檢查配置參數修改成功
SQL> show parameter pass
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string EXCLUSIVE
重置sys用戶密碼
SQL> alter user sys identified by oracle;
sqlplus連接測試成功,EM也能夠成功登錄: