啟動資料庫例項的限制模式(restrict mode)的方法

cnhtm發表於2010-03-03

(b14231 第123頁)

可以啟動資料庫例項到限制模式(restrict mode),這時只有管理員和具有restricted session許可權的使用者可以登入資料庫。下面演示開啟和關閉限制模式的方法:

啟動資料庫到限制模式

ora_test@oracle[/home/oracle]> sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 7 15:26:01 2010

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

Connected to an idle instance.

idle> startup restrict
ORACLE instance started.

Total System Global Area 209715200 bytes
Fixed Size 1218532 bytes
Variable Size 113248284 bytes
Database Buffers 88080384 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
[@more@]

資料庫已經啟動到限制模式,我用scott使用者登入資料庫
首先檢查scott使用者,確認其沒有restricted session許可權

sys@CNHTM> select grantee,granted_role from dba_role_privs where grantee='SCOTT'
2 union
3 select grantee,privilege from dba_sys_privs where grantee='SCOTT'
4 ;

GRANTEE GRANTED_ROLE
------------------------------ ----------------------------------------
SCOTT CONNECT
SCOTT RESOURCE
SCOTT UNLIMITED TABLESPACE

登入資料庫失敗,因為其沒有restricted session許可權

idle> conn scott/tiger
ERROR:
ORA-01035: ORACLE only available to users with RESTRICTED SESSION privilege


Warning: You are no longer connected to ORACLE.

為使用者scott授予restricted session許可權,再次登入資料庫,可以登入

idle> grant restricted session to scott;
SP2-0640: Not connected
idle> conn / as sysdba
Connected.
sys@CNHTM> grant restricted session to scott;

Grant succeeded.

sys@CNHTM> conn scott/tiger
Connected.

將資料庫修改為正常模式(即退出限制模式)

scott@CNHTM> conn / as sysdba
Connected.
sys@CNHTM> alter system disable restricted session;

System altered.

由正常模式切換到限制模式的方法

sys@CNHTM> alter system enable restricted session;

System altered.

sys@CNHTM>

--end--

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

相關文章