restricted 模式及其 使用


什么是數據庫的RESTRICTED 模式

注:以下內容來至:百度知道

  1 --數據庫受限模式,在這個模式下只有RESTRICTED SESSION 權限的人才可以登陸,一般用與數據庫維護的時候使用。
  2 RESTRICTED SESSION Clause
  3 The RESTRICTED SESSION clause lets you restrict logon to Oracle.
  4 You can use this clause regardless of whether your instance has the database
  5 dismounted or mounted, open or closed.
  6 Restricting Session Logons: Example You may want to restrict logons if you are
  7 performing application maintenance and you want only application developers
  8 with RESTRICTED SESSION system privilege to log on. To restrict logons, issue the
  9 following statement:
 10 ALTER SYSTEM
 11 ENABLE RESTRICTED SESSION;
 12 You can then terminate any existing sessions using the KILL SESSION clause of the
 13 ALTER SYSTEM statement.
 14 After performing maintenance on your application, issue the following statement to
 15 allow any user with CREATE SESSION system privilege to log on:
 16 ALTER SYSTEM
 17 DISABLE RESTRICTED SESSION;
  1 --oracle  DBA在做一些操作的時候不希望有人登入數據庫可以使用restrict模式:
  2 
  3 
  4 --開啟限制會話模式:
  5 
  6 alter system enable restricted session;
  7 --取消限制會話模式:
  8 alter system disable restricted session;
  9 
 10 --RESTRICTED模式以后  除了管理員都不能登錄,如果需要非管理員登錄,必須
 11 GRANT restricted session to test;
 12 
 13 
 14 --那么以限制會話模式登入有兩種方法:
 15 
 16 --一:正常登入數據庫后執行
 17   alter system enable restricted session;
 18 
 19 
 20 --二:
 21       sqlplus  /nolog
 22 
 23        conn /as sysdba
 24 
 25       shutdown  immediate;
 26 
 27        startup  restrict
 28 
 29 
 30 --個人喜歡用第二種方法,第一種有的時候居然 alter system disable restricted session; 后無效。
 31 
 32 



alter system enable restricted session 及 startup restrict 限制用戶登入

本文來源於:tolywang 的  《 alter system enable restricted session 及 startup restrict 限制用戶登入

  1 1. SQL> alter system enable restricted session;
  2 System altered.
  3 --或者
  4 SQL> startup restrict
  5 
  6 --2. 沒有RESTRICTED SESSION的用戶無法登錄:
  7 SQL> connect scott/scott
  8 ERROR:
  9 ORA-01035: ORACLE only available to users with RESTRICTED SESSION privilege
 10 
 11 --3. 賦權限 
 12 grant create session, restricted session to scott;
 13 
 14 --4. 取消restricted 
 15 alter system disable restricted session;
 16 
 17 
 18 --啟用restricted mode方式啟動和運行數據庫后,只有那些具有create session和restricted session權限的用戶,才能登錄入系統數據庫。默認情況下,只有SYSDBA和SYSOPER用戶擁有restricted session權限。意味着只有數據庫管理權限的用戶才能進行restricted mode下的數據管理工作。
 19 
 20 --在restricted mode下,用戶即使擁有restricted session權限,只能本地登錄並且不經過監聽程序才可以。Remote方式登錄是被拒絕的。


啟用enable restricted對數據庫進行維護

以下內容來源於:hxl 的 《啟用enable restricted對數據庫進行維護

  1 --公司一台機器上安裝了多個數據庫,這幾個數據庫共用一個監聽器,而且是動態監聽,在維護其中一台機器的時候,不想用戶登錄,停止監聽看來是不可能了的,因為用戶在訪問其他數據庫,如下的方法可以使沒有RESTRICTED SESSION的權限登錄.
  2 --1.啟用restricted session
  3 SQL> alter system enable restricted session;
  4 System altered.
  5 
  6 --2. 沒有RESTRICTED SESSION的用戶無法登錄
  7 SQL> connect scott/scott
  8 ERROR:
  9 ORA-01035: ORACLE only available to users with RESTRICTED SESSION privilege
 10 
 11 --3.數據庫維護好后,禁用RESTRICTED SESSION
 12 SQL> alter system disable restricted session;
 13 System altered.
 14 
 15 
 16 --4.用戶可以恢復登錄
 17 SQL> connect scott/scott
 18 Connected.
 19 
 20 --說明:
 21 --要是維護單個數據庫,也可以startup restrict方式啟動數據.







---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM