Preface
Continuing the previous description, this article explains the last type of oracle DG standby database: snapshot—snapshot database. Unlike other standby databases, snapshot standby databases are fully updateable standby databases, switched from physical standby databases.
When the physical standby database is switched to the snapshot standby database, the snapshot continues to receive the redo log from the main database, but does not apply the redo log. At the same time, the snapshot is opened in read-write mode, allowing data to be read and written. The data written to the snapshot library will not be synchronized to the main library. When the subsequent switch back to the physical standby library, all the written data will be lost.
The above snapshot feature can be used to temporarily open the read and write function in the test environment.
Related operations
Switch from physical backup to snapshot backup
- View the status of the physical standby database
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE OPEN_MODE ---------------- -------------------- PHYSICAL STANDBY READ ONLY WITH APPLY SYS > select process,status from v$managed_standby;
PROCESS STATUS --------- ------------ ARCH CLOSING ARCH CLOSING ARCH CONNECTED ARCH CLOSING RFS IDLE RFS IDLE RFS IDLE RFS IDLE MRP0 APPLYING_LOG
9 rows selected. |
- Turn off real-time synchronization
SQL> recover managed standby database cancel;
- Switch to snapshot backup database
SQL> alter database convert to snapshot standby;
- Open the standby database
SQL> alter database open;
- View database role and open mode
SQL> select database_role,open_mode from v$database;
The entire process diagram is as follows:
Snapshot switch back to physical backup
- snapshot备库shutdown
SQL> shutdown immediate;
- Boot to mount state
SQL> startup mount;
- Switch to physical standby database
SQL> alter database convert to physical standby;
- Shutdown again
SQL> shutdown immediate;
- Boot to mount state
SQL> startup mount;
- The standby database starts the log application
SQL> recover managed standby database using current logfile disconnect
- View the status of the physical standby database
SQL> select database_role,open_mode from v$database;
SQL> select process,status from v$managed_standby;
The whole process is shown in the figure below: