Oracle 11R2 snapshot Data Guard
Oracle在11r1就開始支援snapshot data guard了,本次測試版本為11.2.0.3
1、取消DG端恢復模式
SYS@jzh>select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY
SYS@jzh>recover managed standby database cancel;
Media recovery complete.
2、開啟flashback
SYS@jzh>alter database flashback on;
Database altered.
SYS@jzh>alter system set db_recovery_file_dest='/u01/oracle/fast_recovery_area' scope=spfile;-------閃回目錄
System altered.
SYS@jzh>alter system set db_recovery_file_dest_size=3g; -----閃回區大小
System altered.
SYS@jzh>show parameter flash
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flash_cache_file string
db_flash_cache_size big integer 0
db_flashback_retention_target integer 1440 --------指定資料庫可以回退的時間,單位為分鐘,預設1440分鐘,也就是一天
3、關閉資料庫並啟動到mount狀態
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
SYS@jzh>select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
4、轉換snapshot data guard
SYS@jzh>alter database convert to snapshot standby;
Database altered.
5、關閉資料庫並啟動至read、write模式
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
Database opened.
SYS@jzh>select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
JZH READ WRITE SNAPSHOT STANDBY
6、建立測試表並插入資料
SYS@jzh>create table snapshot (id int,name varchar2(20));
Table created.
SYS@jzh>insert into snapshot values(001,'shanghai');
1 row created.
SYS@jzh>insert into snapshot values(002,'beijing');
1 row created.
SYS@jzh>commit;
Commit complete.
SYS@jzh>select * from snapshot;
ID NAME
---------- --------------------
1 shanghai
2 beijing
7、轉換成physical standby
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
SYS@jzh>alter database convert to physical standby;
Database altered.
8、將備庫啟動至read only模式
SYS@jzh>shu immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SYS@jzh>startup
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
Database opened.
SYS@jzh>select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
JZH READ ONLY PHYSICAL STANDBY
9、驗證測試表是否存在
SYS@jzh>select * from snapshot;
select * from snapshot
*
ERROR at line 1:
ORA-00942: table or view does not exist
可以看到snapshot表不存在了,恢復到轉換之前的狀態了!
1、取消DG端恢復模式
SYS@jzh>select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY
SYS@jzh>recover managed standby database cancel;
Media recovery complete.
2、開啟flashback
SYS@jzh>alter database flashback on;
Database altered.
SYS@jzh>alter system set db_recovery_file_dest='/u01/oracle/fast_recovery_area' scope=spfile;-------閃回目錄
System altered.
SYS@jzh>alter system set db_recovery_file_dest_size=3g; -----閃回區大小
System altered.
SYS@jzh>show parameter flash
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flash_cache_file string
db_flash_cache_size big integer 0
db_flashback_retention_target integer 1440 --------指定資料庫可以回退的時間,單位為分鐘,預設1440分鐘,也就是一天
3、關閉資料庫並啟動到mount狀態
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
SYS@jzh>select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
4、轉換snapshot data guard
SYS@jzh>alter database convert to snapshot standby;
Database altered.
5、關閉資料庫並啟動至read、write模式
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
Database opened.
SYS@jzh>select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
JZH READ WRITE SNAPSHOT STANDBY
6、建立測試表並插入資料
SYS@jzh>create table snapshot (id int,name varchar2(20));
Table created.
SYS@jzh>insert into snapshot values(001,'shanghai');
1 row created.
SYS@jzh>insert into snapshot values(002,'beijing');
1 row created.
SYS@jzh>commit;
Commit complete.
SYS@jzh>select * from snapshot;
ID NAME
---------- --------------------
1 shanghai
2 beijing
7、轉換成physical standby
SYS@jzh>shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@jzh>startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
SYS@jzh>alter database convert to physical standby;
Database altered.
8、將備庫啟動至read only模式
SYS@jzh>shu immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SYS@jzh>startup
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 184550744 bytes
Database Buffers 436207616 bytes
Redo Buffers 3338240 bytes
Database mounted.
Database opened.
SYS@jzh>select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
JZH READ ONLY PHYSICAL STANDBY
9、驗證測試表是否存在
SYS@jzh>select * from snapshot;
select * from snapshot
*
ERROR at line 1:
ORA-00942: table or view does not exist
可以看到snapshot表不存在了,恢復到轉換之前的狀態了!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10271187/viewspace-2049282/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Data Guard - Snapshot Standby Database配置Database
- oracle data guard!!Oracle
- Data Guard之Snapshot Standby資料庫功能[轉]資料庫
- 【DataGuard】Oracle 11g物理Data Guard之Snapshot Standby資料庫功能Oracle資料庫
- 介紹ORACLE DATA GUARD——DATA GUARD概念和管理Oracle
- Oracle Data Guard配置Oracle
- 【轉】【DataGuard】Oracle 11g物理Data Guard之Snapshot Standby資料庫功能Oracle資料庫
- Oracle Data Guard Broker元件Oracle元件
- Oracle Data Guard簡介Oracle
- Oracle Data Guard 介紹Oracle
- ORACLE Data Guard--IOracle
- Oracle 11g Data Guard Enabling Active Data GuardOracle
- [Data Guard]Oracle10g Data Guard學習筆記(一)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(二)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(三)Oracle筆記
- 1 關於 Oracle Data GuardOracle
- 2 Oracle Data Guard 安裝Oracle
- 1 Oracle Data Guard Broker 概念Oracle
- Oracle Data Guard和Broker概述Oracle
- Oracle 11g Data GuardOracle
- Oracle11g Data GuardOracle
- Oracle Data Guard Failover(activate)OracleAI
- 11gR2 Active Data Guard 閃回 - flashback database / snapshot standby - 3Database
- 11gR2 Active Data Guard 閃回 - flashback database / snapshot standby - 2Database
- 4.1.6 Oracle Restart 與 Oracle Data Guard 整合OracleREST
- 8 Oracle Data Guard Broker 屬性Oracle
- 9 Oracle Data Guard 故障診斷Oracle
- 【DG】Oracle Data Guard官方直譯Oracle
- ORACLE DATA GUARD -一般概念Oracle
- Oracle11g Data Guard[zt]Oracle
- Oracle RAC + Data Guard 環境搭建Oracle
- Oracle Data Guard 理論知識Oracle
- 技術白皮書:Oracle Data Guard 11gOracle Data Guard 理論知識OracleGo
- DATA GUARD部署模式——DATA GUARD概念和管理模式
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- 2 開始實用 Oracle Data GuardOracle
- 19 Oracle Data Guard 相關檢視Oracle
- 【DATAGUARD】Oracle19c Data Guard BrokerOracle