oracle只读打开数据库

客户经常有这样的需求,数据库已迁移,但还是希望原库可以打开,就只能只读模式打开了

方法一

SYS@orcl> STARTUP OPEN READ ONLY;
ORACLE instance started.

Total System Global Area 4.0086E+10 bytes
Fixed Size                  2254976 bytes
Variable Size            1.5301E+10 bytes
Database Buffers         2.4696E+10 bytes
Redo Buffers               86413312 bytes
Database mounted.
Database opened.
SYS@orcl> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
ORCL     READ ONLY

SYS@orcl>

oracle只读打开数据库_第1张图片

方法二、

SYS@orcl> startup mount;
ORACLE instance started.

Total System Global Area 4.0086E+10 bytes
Fixed Size                  2254976 bytes
Variable Size            6442452864 bytes
Database Buffers         3.3554E+10 bytes
Redo Buffers               86413312 bytes
Database mounted.
SYS@orcl> alter database open read only;

Database altered.

SYS@orcl> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
ORCL     READ ONLY

oracle只读打开数据库_第2张图片
1、只读模式下不可以锁定用户
2、集群环境下,只要有个实例处在只读模式,另外一个实例无法锁定用户
3、集群环境下,某个实例处在restrict模式下,另外一个实例无法进入到只读模式
4、只读模式下,无法执行expdp导出操作

SYS@orcl2> STARTUP OPEN READ ONLY;
ORACLE instance started.

Total System Global Area 4.0086E+10 bytes
Fixed Size                  2254976 bytes
Variable Size            6845106048 bytes
Database Buffers         3.3152E+10 bytes
Redo Buffers               86413312 bytes
Database mounted.
ORA-16002: database already open for read/write access by another instance

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
ORA-31626: job does not exist
ORA-31633: unable to create master table "SYS.SYS_EXPORT_SCHEMA_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 1038
ORA-16000: database open for read-only access

你可能感兴趣的:(OracleDB,数据库,oracle)