開啓快照功能,通常用於測試庫,能夠按期與生產庫同步更新數據庫,更新後開啓快照讀寫模式。
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 9.1930E+10 bytes
Fixed Size 2305024 bytes
Variable Size 1.3220E+10 bytes
Database Buffers 7.8652E+10 bytes
Redo Buffers 55205888 bytes
Database mounted.
SQL> alter database convert to snapshot standby;
alter database convert to snapshot standby
*
ERROR at line 1:
ORA-38784: Cannot create restore point 'SNAPSHOT_STANDBY_REQUIRED_10/30/2019 10:08:20'.
ORA-38786: Recovery area is not enabled.
SQL> show parameter recover
NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
db_unrecoverable_scn_tracking boolean TRUE
recovery_parallelism integer 0
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +HMOLD/sthuibuy/arch
Oldest online log sequence 11354
Next log sequence to archive 0
Current log sequence 11359
SQL> alter system set db_recovery_file_dest_size=300G;
System altered.
SQL> alter system set db_recovery_file_dest='+HMOLD';
System altered.
SQL>
SQL> alter database convert to snapshot standby;
Database altered.
SQL> alter database open;
Database altered.
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE SNAPSHOT STANDBY
SQL> select name,storage_size from v$restore_point;
NAME STORAGE_SIZE
-------------------------------------------------------------------------------------------------------------------------------- ------------
SNAPSHOT_STANDBY_REQUIRED_10/30/2019 10:11:57 1757028352
NAME VALUE
-------------------------------- ----------------------------------------------------------------
apply lag +01 23:23:07
apply finish time +00 00:19:11.320
hmptcx1[/home/oracle]$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 1 09:30:52 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
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
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE SNAPSHOT STANDBY
SQL>
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
startup mount;
ORACLE instance shut down.
SQL>
ORACLE instance started.
Total System Global Area 9.1930E+10 bytes
Fixed Size 2305024 bytes
Variable Size 1.3220E+10 bytes
Database Buffers 7.8652E+10 bytes
Redo Buffers 55205888 bytes
Database mounted.
SQL> SQL> alter database convert to physical standby;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 9.1930E+10 bytes
Fixed Size 2305024 bytes
Variable Size 1.3220E+10 bytes
Database Buffers 7.8652E+10 bytes
Redo Buffers 55205888 bytes
Database mounted.
Database opened.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.