oracle 利用flashback將備庫啟用為read wirte(10g 及上)
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
環境:
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-1708777/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 利用flashback將Dataguard備庫啟用可讀寫
- 在Oracle DG Standby庫上啟用flashback database功能OracleDatabase
- 將Oracle資料庫改為歸檔模式並啟用Rman備份Oracle資料庫模式
- Oracle 10g flashbackOracle 10g
- Oracle回收站及flashback drop(上)Oracle
- 【Flashback】啟用Flashback Database閃回資料庫功能Database資料庫
- oracle 10g flashback databaseOracle 10gDatabase
- Oracle 10g FlashBack簡單應用一則Oracle 10g
- flashback version query in oracle 10gOracle 10g
- Oracle 10g 六種FlashbackOracle 10g
- Oracle 10g/11g下如何將物理Standby庫臨時啟用用於災備測試Oracle 10g
- oracle 10g flashback version query 和 flashback transaction query實驗Oracle 10g
- 啟動dataguard備庫到read-only狀態
- 將Oracle 10g RAC庫用rman 的方式備份並恢復到異機單機Oracle 10g
- oracle 10g RMAN備份及恢復Oracle 10g
- Oracle Flashback (9i & 10g) [zt]Oracle
- 啟用flashback database 功能Database
- 將Oracle 10g RAC庫用rman 的方式備份並恢復到異機單機-3Oracle 10g
- 將Oracle 10g RAC庫用rman 的方式備份並恢復到異機單機 -2Oracle 10g
- Oracle 備份恢復之 FlashbackOracle
- 利用RMAN建立備用資料庫資料庫
- Oracle 10g Flashback 技術小結(zt)Oracle 10g
- Flashback New Features and Enhancements in Oracle Database 10gOracleDatabase
- Oracle 10g FLASHBACK DATABASE 實驗記錄Oracle 10gDatabase
- 【DataGuard】使用Grid Control調整Oracle物理Data Guard備庫為Read OnlyOracle
- 應用oracle flashback--Flashback Database介紹OracleDatabase
- 應用oracle flashback--Flashback Table之RECYCLEBINOracle
- ORACLE flashback 為什麼要啟動行遷移功能(轉)Oracle
- 在 RHEL3 上將單一例項資料庫轉換為 Oracle RAC 10g (轉載)資料庫Oracle
- Oracle Flashback Archive——Oracle閃迴歸檔(上)OracleHive
- 【徵文】應用oracle flashback(3.2)--Flashback Database操作示例OracleDatabase
- 【徵文】應用oracle flashback(2.1)--Flashback Table之RECYCLEBINOracle
- 【RMAN】利用備份片還原資料庫(上)資料庫
- oracle 10g rac 啟用歸檔模式Oracle 10g模式
- oracle實驗記錄 (oracle 10G dataguard(10)flashback 與dg)Oracle
- Oracle中flashback table功能為什麼需要開啟row movement功能Oracle
- 準備看看這本書 - ORACLE資料庫技術實用詳解:教你如何成為10g OCPOracle資料庫
- Oracle9i,.10g 閃回查詢(flashback)Oracle