snapshot standby快照備庫角色

skyin_1603發表於2016-10-22
snapshot standby 與physical standby的切換,兩個角色都是針對備庫來說的 :

----切換到snapshot standby快照備庫:
--開啟備庫,檢視備庫狀態:
SQL> alter database open;
Database altered.
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE    OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY
目前為物理備庫角色。

--切換成快照備庫前開啟閃回功能:
SQL> alter database flashback on;
Database altered.

--切換到快照備庫:
SQL> alter database convert to snapshot standby;
Database altered.

--檢視備庫角色:
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE    OPEN_MODE
---------------- --------------------
SNAPSHOT STANDBY MOUNTED

SQL> alter database open;
Database altered.

--檢視備庫的狀態:
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE    OPEN_MODE
---------------- --------------------
SNAPSHOT STANDBY READ WRITE

--模擬業務建表插資料:
SQL> create table suxing.test(id number);
Table created.
SQL> insert into suxing.test values(2);
1 row created.
SQL> commit;
Commit complete.

--切回到物理備庫:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size                  2257840 bytes
Variable Size             692063312 bytes
Database Buffers          138412032 bytes
Redo Buffers                2371584 bytes
Database mounted.
SQL> 
SQL> startup mount
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> alter database convert to physical standby;
Database altered.
SQL> SP2-0734: unknown command beginning "Database a..." - rest of line ignored.

--嘗試直接開啟資料庫
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size                  2257840 bytes
Variable Size             692063312 bytes
Database Buffers          138412032 bytes
Redo Buffers                2371584 bytes
Database mounted.
Database opened.
SQL>

--從新應用日誌:
SQL> recover managed standby database disconnect from session;
Media recovery complete.

SQL> select database_role,open_mode from v$database;
DATABASE_ROLE    OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY WITH APPLY

--檢視剛剛建立的表結構:
SQL> desc suxing.test
ERROR:
ORA-04043: object suxing.test does not exist

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

相關文章