Restricting Access to a Database at Startup

yyp2009發表於2013-04-15
archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     7
Current log sequence           9
SQL> startup mount force
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1218508 bytes
Variable Size              92276788 bytes
Database Buffers          104857600 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode


SQL> shutdown immediate;
startup mount;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1218508 bytes
Variable Size              92276788 bytes
Database Buffers          104857600 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode

SQL>  recover database ;
Media recovery complete.
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode


SQL> shutdown immediate 
startup ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup restrict;
SP2-0714: invalid combination of STARTUP options
SQL> startup restrict;

ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1218508 bytes
Variable Size              92276788 bytes
Database Buffers          104857600 bytes
Redo Buffers                7168000 bytes

Database mounted.
Database opened.
SQL> SQL> SQL> startup mount force;
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1218508 bytes
Variable Size              92276788 bytes
Database Buffers          104857600 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> alter database archivelog;l
  2  
SQL> 
SQL> 
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode


SQL> >startup restrict;
SP2-0734: unknown command beginning ">startup r..." - rest of line ignored.
SQL> shutdown immediate;
startup ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup restrict;
SP2-0714: invalid combination of STARTUP options
SQL> startup restrict;

ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1218508 bytes
Variable Size              92276788 bytes
Database Buffers          104857600 bytes
Redo Buffers                7168000 bytes
Database mounted.
Database opened.
SQL> SQL> shutdown;
startup mount;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                  1218508 bytes
Variable Size              92276788 bytes
Database Buffers          104857600 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter system set log_archive_dest_1='LOCATION=/arch/prod/arch1';

System altered.

SQL> alter system set log_archive_dest_2='LOCATION=/arch/prod/arch2';

System altered.

SQL> alter system database open;
alter system database open
             *
ERROR at line 1:
ORA-02065: illegal option for ALTER SYSTEM


SQL> alter database open;

Database altered.

SQL> 

Restricting Access to a Database at Startup

You can start an instance and mount and open a database in restricted mode so that the database is available only to administrative personnel (not general database users). Use this mode of database startup when you need to accomplish one of the following tasks:

  • Perform. an export or import of database data
  • Perform. a data load (with SQL*Loader)
  • Temporarily prevent typical users from using data
  • During certain migration and upgrade operations

Typically, all users with the CREATE SESSION system privilege can connect to an open database. Opening a database in restricted mode allows database access only to users with both the CREATE SESSION and RESTRICTED SESSION system privilege. Only database administrators should have the RESTRICTED SESSION system privilege.

Start an instance (and, optionally, mount and open the database) in restricted mode by using the STARTUP command with the RESTRICT option:

STARTUP RESTRICT

Later, use the ALTER SYSTEM statement to disable the RESTRICTED SESSION feature:

ALTER SYSTEM DISABLE RESTRICTED SESSION;

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

相關文章