Restricting Access to a Database at Startup

本文介绍了在Oracle数据库中设置归档模式的过程,包括启动实例、挂载数据库、执行数据库恢复及最终启用归档模式等关键步骤。此外还讨论了如何在受限模式下启动数据库以进行特定任务。
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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/13750068/viewspace-758484/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值