利用flashback將Dataguard備庫啟用可讀寫
oracle 利用flashback將備庫啟用為read wirte(10g 及上)
環境:
OS: CENTOS 6.5 X64
DB: ORACLE 10.2.0.5
主庫操作:
SQL> alter system switch logfile;
System altered.
SQL>
備庫操作
取消歸檔應用
SQL> alter database recover managed standby database cancel;
Database altered.
SQL>
建立還原點
SQL> create restore point restore_point_dg guarantee flashback database;
Restore point created.
SQL>
主庫操作
將備庫的歸檔目的設定為defer(這樣後臺不會報錯,防止主庫傳輸資料到備庫)
官方解釋
defer
Specifies that valid destination information and attributes are preserved, but the destination is excluded from archiving operations until re-enable
SQL> alter system set log_archive_dest_state_2=defer;
將備庫啟用為read/wirte
SQL> alter database activate standby database;
Database altered.
SQL> alter database open;
Database altered.
SQL>
備庫狀態為read/write
SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
SQL>
這樣我們可以在備庫Export操作了
[oracle@oracle10g-dg2-213-101 backup]$ expdp directory=backup dumpfile=test1`date +%F`.dmp logfile=test1`date +%F`.log schemas=test1
Export: Release 10.2.0.5.0 - 64bit Production on Monday, 15 September, 2014 22:37:17
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Username: / as sysdba
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": /******** AS SYSDBA directory=backup dumpfile=test12014-09-15.dmp logfile=test12014-09-15.log schemas=test1
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "TEST1"."TEST" 4.960 KB 5 rows
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
/u01/app/oracle/dump/test12014-09-15.dmp
Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at 22:37:31
[oracle@oracle10g-dg2-213-101 backup]$
主庫操作
主庫上新增記錄
SQL> insert into test values(10);
1 row created.
SQL> insert into test values(10);
1 row created.
SQL> insert into test values(10);
1 row created.
SQL> insert into test values(11);
1 row created.
SQL> insert into test values(11);
1 row created.
SQL> commit;
Commit complete.
System altered.
SQL>
SQL> conn / as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL>
備庫操作
備庫上刪除表
[oracle@oracle10g-dg2-213-101 backup]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Sep 15 22:40:53 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> conn test1/test1
Connected.
SQL> drop table test purge;
Table dropped.
SQL>
準備重新恢復到dg備庫環境
SQL> startup mount force;
ORACLE instance started.
Total System Global Area 704643072 bytes
Fixed Size 2098912 bytes
Variable Size 192940320 bytes
Database Buffers 503316480 bytes
Redo Buffers 6287360 bytes
Database mounted.
SQL>
閃回資料庫
SQL> flashback database to restore point restore_point_dg;
Flashback complete.
SQL>
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 704643072 bytes
Fixed Size 2098912 bytes
Variable Size 192940320 bytes
Database Buffers 503316480 bytes
Redo Buffers 6287360 bytes
SQL> alter database mount standby database; #或者alter database convert to physical standby;
Database altered.
主庫操作
SQL> alter system set log_archive_dest_state_2=enable scope=both;
System altered.
SQL>
備庫操作,檢查程式是否正常
SQL> select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
MRP0 WAIT_FOR_LOG
RFS IDLE
RFS IDLE
6 rows selected.
SQL>
主庫操作
切換日誌
SQL> alter system switch logfile;
System altered.
SQL>
備庫已正常
FS[1]: Successfully opened standby log 8: '/u01/app/oracle/oradata/netdata/st_redo08a.log'
Mon Sep 15 22:50:22 CST 2014
Media Recovery Log /u01/app/oracle/archive/netdata/1_79_857898543.arc
Media Recovery Waiting for thread 1 sequence 80
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24486203/viewspace-1698663/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 利用flashback將備庫啟用為read wirte(10g 及上)Oracle
- 【Flashback】啟用Flashback Database閃回資料庫功能Database資料庫
- ORACLE DATAGUARD 資料庫---建立物理備用資料庫Oracle資料庫
- 啟動dataguard備庫到read-only狀態
- 啟用flashback database 功能Database
- 【DataGuard】手工冷備搭建 Oracle 11g DataGuard 物理備庫Oracle
- 在Oracle DG Standby庫上啟用flashback database功能OracleDatabase
- 利用RMAN建立備用資料庫資料庫
- 【DATAGUARD】 將11g物理備庫轉換為Snapshot Standby
- DataGuard備庫刪除已經應用的日誌
- dataguard系列之六------備用資料庫的維護資料庫
- RMAN DUPLICATE建立DataGuard物理備庫
- dataguard 主備庫出現gap
- 用rman建立dataguard備用資料庫繼續(無法找到備份檔案)資料庫
- 【DATAGUARD】DG系列之RACtoONE快照備用資料庫的搭建資料庫
- oracle利用scn增量備份來實現同步dataguardOracle
- dataguard備庫出現GAP修復
- dataguard-建立物理備庫全程解析
- DataGuard主備庫切換步驟
- 【DataGuard】使用GC建立的物理DataGuard主備庫pfile比較GC
- 將Oracle資料庫改為歸檔模式並啟用Rman備份Oracle資料庫模式
- 【DATAGUARD】Oracle Dataguard物理備庫切換最佳實踐(sqlplus)OracleSQL
- 【DataGuard】Oracle 11g DataGuard 角色轉換(一)物理備庫SwitchoverOracle
- 利用rman生成備用資料庫操作文件資料庫
- dataguard standby備庫磁碟空間滿(ZT)
- 一個備份集同時恢出dataguard的主庫&備庫
- NodeJS Stream(可讀流、可寫流) API解讀NodeJSAPI
- DataGuard切換(主庫為Rac+備庫為Rac)
- 主庫RAC,備庫單節點ASM的dataguard搭建ASM
- 【DATAGUARD 學習】管理影響備庫的主庫事件事件
- [Flashback]開啟資料庫閃回資料庫功能資料庫
- Oracle10G Dataguard 多個備庫 - 主庫和物理備庫的切換Oracle
- Oracle 8i DataGuard 的啟用Oracle
- 【DATAGUARD】手工恢復備庫日誌中斷
- 【DATAGUARD】DG系列之RACtoONE物理備庫的搭建
- dataguard之邏輯備庫表空間不足
- 利用WinSW將Nginx 作為可正常啟動/停止的windows服務NginxWindows
- RMAN備用資料庫(邏輯dataguard) --關於dorecover 的解釋 (2)資料庫