Data Guard 之RMAN備份線上搭建物理standby
此種方式搭建 DG ,不需要停止主庫,極大提高了生產庫的可用性。
一、大致步驟
透過 RMAN 備份建立 standby 資料庫大致分為這幾個步驟:
( 1 )設定主資料庫為 force loggin 模式
( 2 )設定主資料庫為 archived log 模式
( 3 )配置好主備庫的引數檔案
( 4 )兩邊的密碼檔案保持一致
( 5 )配置監聽
( 6 )用引數檔案啟動 standby 到 nomount 狀態
( 7 )透過 rman 對主庫做完全備份
( 8 )透過 rman 為 standby 建立控制檔案
( 9 )透過 rman dumplicate 命令建立備庫
( 10 )建立完成後,自動將 standby 資料庫啟動到 mount 狀態,並且不會自動啟動 redo apply
二、實施建立操作
環境: primary 資料庫名 PROD1 , standby 資料庫名 PROD2
db_unique_name=PROD1
Data Guard 環境中 Standby Database 主要有 2 種角色, physical standby 和 logic standby ,這裡講述 physical standby 的搭建過程。
Data Guard 提供了 3 種級別的保護模式,無論搭建 physical standby 還是 logic standby ,都需要考慮使用什麼樣的保護模式來保護資料,定義何種保護模式主要就是設定 redo 的傳輸方式。
( 1 )最大保護 LGWR SYNC
( 2 )最高可用性 LGWR SYNC
( 3 )最高效能 LGWR ASYNC 或 ARCH
軟體環境:
虛擬機器: VMware-Workstation-Full-10
系統: rhel-server-5.4-i386
: linux_11gR2_database
ip 地址:
primary : 192.168.31.2
standby : 192.168.31.3
host 檔案
192.168.31.2 oracle1.example.com
192.168.31.3 oracle2.example.com
例項名
primary : PROD1
standby : PROD2
一, Data Guard搭建步驟
1. 在 vmware上安裝 2臺 linux虛擬機器,按照上面要求設定好 IP,然後在 2臺 linux上分別安裝 oracle軟體( linux_11gR2_database),在 192.168.31.2建立好資料庫例項名為 PROD1,先保證例項 PROD1能夠正常執行,並且兩臺 linux系統可以互相 ping通。
2. 在主資料庫上啟用 FORCE LOGGING模式,想必大家知道有一些 DDL 語句可以透過指定 NOLOGGING 子句的方式避免寫 redo log(目的是提高速度,某些時候確實有效 ),指定資料庫為 FORCE LOGGING 模式後,資料庫將會記錄除臨時表空間或臨時回滾段外所有的操作而忽略類似 NOLOGGING之類的指定引數。如果在執行 force logging時有 nologging 之類的語句在執行,則 force logging 會等待直到這類語句全部執行。 FORCE LOGGING 是做為固定引數儲存在控制檔案中,因此其不受重啟之類操作的影響 (只執行一次即可 ),如果想取消,可以透過 alter database no force logging 語句關閉強制記錄。
SQL> alter database force logging;
Database altered.
3. 配置主資料庫為歸檔模式(如果已經歸檔模式這一步不需要)
SQL> archive log list;
Database log mode No Archive Mode // 非歸檔
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2
Current log sequence 4
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 318046208 bytes
Fixed Size 1299652 bytes
Variable Size 239078204 bytes
Database Buffers 71303168 bytes
Redo Buffers 6365184 bytes
Database mounted.
SQL> alter database archivelog; // 啟用歸檔
Database altered.
SQL> alter database open;
Database altered.
5. 在主資料庫生成一個 pfile檔案,用於配置 DG的相關屬性(也可以直接透過 alter system 語句修改)
SQL> create pfile from spfile;
File created.
主庫
alter system set LOG_ARCHIVE_DEST_1=’LOCATION=/home/oracle/files/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PROD1′;
alter system set LOG_ARCHIVE_DEST_2=’SERVICE=PROD2 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PROD2′;
alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE;
#alter system set LOG_ARCHIVE_START=true scope =spfile;
alter system set LOG_ARCHIVE_FORMAT=’log%t_%s_%r.arc’ scope=spfile;
alter system set FAL_SERVER=PROD2;
alter system set FAL_CLIENT=PROD1;
alter system set DB_UNIQUE_NAME=PROD1 scope=spfile;
alter system set DB_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/PROD2/’,'/u01/app/oracle/oradata/PROD1/’ scope=spfile;
alter system set LOG_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/PROD2/’,'/u01/app/oracle/oradata/PROD1/’ scope=spfile;
備庫
alter system set LOG_ARCHIVE_DEST_1=’LOCATION=/home/oracle/files VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PROD2′;
alter system set LOG_ARCHIVE_DEST_2=’SERVICE=PROD1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PROD1′;
alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE;
#alter system set LOG_ARCHIVE_START=true scope =spfile;
alter system set LOG_ARCHIVE_FORMAT=’log%t_%s_%r.arc’ scope=spfile;
alter system set FAL_SERVER=PROD1;
alter system set FAL_CLIENT=PROD2;
alter system set DB_UNIQUE_NAME=PROD2 scope=spfile;
alter system set DB_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/PROD1/’,'/u01/app/oracle/oradata/PROD2/’ scope=spfile;
alter system set LOG_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/PROD1/’,'/u01/app/oracle/oradata/PROD2/’ scope=spfile;
alter system set service_names=PROD1;
( 1)在備庫上使用 spfile啟動到 nomount狀態。
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 318046208 bytes
Fixed Size 1299652 bytes
Variable Size 297798460 bytes
Database Buffers 12582912 bytes
Redo Buffers 6365184 bytes
SQL>
( 2)將主庫用 rman連線 備份主庫
RMAN> backup database include current controlfile for standby plus archivelog;
// 注意 備份資料庫的同時建立了 standby 控制檔案,並且包含了歸檔日誌。 也可以分開來做例如
backup database ;
copy current controlfile for standby to ‘/tmp/st.ctl’
RMAN> backup database include current controlfile for standby plus archivelog;
Starting backup at 27-MAY-15
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=24 RECID=2 STAMP=880037637
input archived log thread=1 sequence=25 RECID=3 STAMP=880037748
input archived log thread=1 sequence=26 RECID=4 STAMP=880795744
input archived log thread=1 sequence=27 RECID=5 STAMP=880798248
input archived log thread=1 sequence=28 RECID=6 STAMP=880816639
channel ORA_DISK_1: starting piece 1 at 27-MAY-15
channel ORA_DISK_1: finished piece 1 at 27-MAY-15
piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_annnn_TAG20150527T151720_bpbvw0yg_.bkp tag=TAG20150527T151720 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 27-MAY-15
Starting backup at 27-MAY-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/PROD1/system01.dbf
input datafile file number=00010 name=/u02/oradata/prod1/test_tbs.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/PROD1/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/PROD1/example01.dbf
channel ORA_DISK_1: starting piece 1 at 27-MAY-15
channel ORA_DISK_1: finished piece 1 at 27-MAY-15
piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvw50n_.bkp tag=TAG20150527T151724 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/PROD1/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 27-MAY-15
channel ORA_DISK_1: finished piece 1 at 27-MAY-15
piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvx99p_.bkp tag=TAG20150527T151724 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/u01/app/oracle/oradata/PROD1/EXAMPLE.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/PROD1/indx.dbf
input datafile file number=00008 name=/u01/app/oracle/oradata/PROD1/TEST.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/PROD1/TOOLS.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/PROD1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 27-MAY-15
channel ORA_DISK_1: finished piece 1 at 27-MAY-15
piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvxd4b_.bkp tag=TAG20150527T151724 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 27-MAY-15
channel ORA_DISK_1: finished piece 1 at 27-MAY-15
piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_ncnnf_TAG20150527T151724_bpbvxgh2_.bkp tag=TAG20150527T151724 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 27-MAY-15
Starting backup at 27-MAY-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=29 RECID=7 STAMP=880816687
channel ORA_DISK_1: starting piece 1 at 27-MAY-15
channel ORA_DISK_1: finished piece 1 at 27-MAY-15
piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_annnn_TAG20150527T151807_bpbvxj54_.bkp tag=TAG20150527T151807 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 27-MAY-15
Starting Control File and SPFILE Autobackup at 27-MAY-15
piece handle=/home/oracle/flash/PROD1/autobackup/2015_05_27/o1_mf_s_880816689_bpbvxkk9_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 27-MAY-15
( 3) 複製備份集到備庫
首先在備庫上使用 oracle賬號建立 /u01/app/oracle/flash /PROD1/backupset/目錄,如果使用 root需要修改目錄許可權。
[oracle@guo flash] mkdir -p /u01/app/oracle/flash
在主庫執行 scp命令 copy所有的備份片到備庫,可以從第 2步中得知生成了哪些備份片,也可以透過相關命令檢視
[oracle@guo] cd /u01/app/oracle/flash/PROD1/backupset/2015_05_27
[oracle@guo 2015_05_27]$ scp * 192.168.31.3:/u01/app/oracle/fast_recovery_area/PROD1/backupset/2015_05_27
oracle@192.168.31.3’s password:
監聽和 tns兩邊都要配好,本例中走靜態監聽
tnsname.ora
PROD2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle2.example.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD1)
)
)
PROD1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle1.example.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD1)
)
)
監聽檔案
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD1)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=PROD1))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(PROGRAM=extproc)))
密碼檔案 ,兩邊密碼要相同
orapwd file=$ORACLE_HOME/dbs/orapw $ORACLE_SID password=oracle entries=5
如果 remote_login_passwordfile 該引數已經設定為 EXCLUSIVE ;你最好是複製主庫的密碼檔案 修改為 standby庫上的 orapwSID
orapwd file=orapwPROD1 password=oracle entries=30
( 4)使用 rman連線到主庫和備庫
[oracle@guo admin]$ rman target / auxiliary sys/oracle@PROD2// 同時連線到主備庫 (用到密碼檔案 )
Recovery Manager: Release 11.2.0.3.0 – Production on Sun Sep 22 19:41:53 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: PROD1 (DBID=773380365, not open) // 顯示出主庫狀態是 not open,即 mount
connected to auxiliary database: PROD1 (not mounted)// 顯示出備庫狀態是為 not mounted,即 nomout
[oracle@edbjr2p1 scripts]$ rman target / auxiliary sys/oracle@PROD2
Recovery Manager: Release 11.2.0.3.0 – Production on Wed May 27 15:23:48 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD1 (DBID=2082231315)
connected to auxiliary database: PROD1 (not mounted)
如果監聽配置有問題會返回下列錯誤。
connected to target database: PROD1 (DBID=773380365, not open)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
RMAN> duplicate target database for standby;// 使用 duplicate命令還原
如果在 RMAN恢復時不指定 nofilenamecheck 引數,則在資料檔案相同檔名恢復時會出現 RMAN-05501錯誤,當主庫,備庫的資料庫檔案目錄是一樣的時候,必須使用 nofilenamecheck引數告訴 rman主庫和被建立的備份庫擁有一樣的檔案目錄和檔名。
RMAN> duplicate target database for standby nofilenamecheck;
RMAN> duplicate target database for standby nofilenamecheck;
Starting Duplicate Db at 27-MAY-15
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=10 device type=DISK
contents of Memory Script:
{
restore clone standby controlfile;
}
executing Memory Script
Starting restore at 27-MAY-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/flash/PROD1/autobackup/2015_05_27/o1_mf_s_880816689_bpbvxkk9_.bkp
channel ORA_AUX_DISK_1: piece handle=/home/oracle/flash/PROD1/autobackup/2015_05_27/o1_mf_s_880816689_bpbvxkk9_.bkp tag=TAG20150527T151809
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/PROD2/control01.ctl
output file name=/u01/app/oracle/oradata/PROD2/control02.ctl
output file name=/u01/app/oracle/oradata/PROD2/control03.ctl
Finished restore at 27-MAY-15
contents of Memory Script:
{
sql clone ‘alter database mount standby database’;
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
“/u01/app/oracle/oradata/PROD2/temp01.dbf”;
set newname for tempfile 2 to
“/u01/app/oracle/oradata/PROD2/TEMP1.dbf”;
set newname for tempfile 3 to
“/u01/app/oracle/oradata/PROD2/TEMP2.dbf”;
switch clone tempfile all;
set newname for datafile 1 to
“/u01/app/oracle/oradata/PROD2/system01.dbf”;
set newname for datafile 2 to
“/u01/app/oracle/oradata/PROD2/sysaux01.dbf”;
set newname for datafile 3 to
“/u01/app/oracle/oradata/PROD2/undotbs01.dbf”;
set newname for datafile 4 to
“/u01/app/oracle/oradata/PROD2/users01.dbf”;
set newname for datafile 5 to
“/u01/app/oracle/oradata/PROD2/example01.dbf”;
set newname for datafile 6 to
“/u01/app/oracle/oradata/PROD2/indx.dbf”;
set newname for datafile 7 to
“/u01/app/oracle/oradata/PROD2/TOOLS.dbf”;
set newname for datafile 8 to
“/u01/app/oracle/oradata/PROD2/TEST.dbf”;
set newname for datafile 9 to
“/u01/app/oracle/oradata/PROD2/EXAMPLE.dbf”;
set newname for datafile 10 to
“/u02/oradata/prod1/test_tbs.dbf”;
restore
clone database
;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/PROD2/temp01.dbf in control file
renamed tempfile 2 to /u01/app/oracle/oradata/PROD2/TEMP1.dbf in control file
renamed tempfile 3 to /u01/app/oracle/oradata/PROD2/TEMP2.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 27-MAY-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD2/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD2/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/PROD2/example01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /u02/oradata/prod1/test_tbs.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvw50n_.bkp
channel ORA_AUX_DISK_1: piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvw50n_.bkp tag=TAG20150527T151724
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD2/undotbs01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvx99p_.bkp
channel ORA_AUX_DISK_1: piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvx99p_.bkp tag=TAG20150527T151724
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD2/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/PROD2/indx.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/PROD2/TOOLS.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/PROD2/TEST.dbf
channel ORA_AUX_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/PROD2/EXAMPLE.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvxd4b_.bkp
channel ORA_AUX_DISK_1: piece handle=/home/oracle/flash/PROD1/backupset/2015_05_27/o1_mf_nnndf_TAG20150527T151724_bpbvxd4b_.bkp tag=TAG20150527T151724
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 27-MAY-15
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=3 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=6 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=7 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/indx.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=8 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/TOOLS.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=9 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/TEST.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=10 STAMP=880817113 file name=/u01/app/oracle/oradata/PROD2/EXAMPLE.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=11 STAMP=880817113 file name=/u02/oradata/prod1/test_tbs.dbf
Finished Duplicate Db at 27-MAY-15
RMAN>
( 5 )搭建完成驗證
主庫建立測試表:
SYS@PROD1 > create table guo as select * from dba_objects;
Table created.
SYS@PROD1 > alter system switch logfile;
System altered.
SYS@PROD1 > /
/
System altered.
SYS@PROD1 > /
System altered.
SYS@PROD1 >
System altered.
SYS@PROD1 > /
備庫驗證:
SYS@PROD1 >alter database open;
Database altered.
SYS@PROD1 > alter database recover managed standby database disconnect from session; // 執行 redo apply (此方法需要切日誌才能實時同步)
實時同步使用如下命令
alter database recover managed standby database using current logfile disconnect from session;
Database altered.
SYS@PROD1 > select count(*) from guo;
COUNT(*)
———-
75196
如果發現無法同步,請檢查密碼檔案是否一致。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24742969/viewspace-1674111/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 物理data guard備standby庫的時候報錯。
- Data Guard學習之物理standby建立步驟
- Data guard 配置之搭建物理備庫
- DATA GUARD物理STANDBY的 SWITCHOVER切換
- 搭建Oracle Data Guard 11g(物理備用)Oracle
- 【DG】Data Guard搭建(physical standby)
- RedHat搭建物理Data GuardRedhat
- data guard物理備份方式中的switchover轉換
- DATA GUARD物理STANDBY的FAILOVER切換AI
- DATA GUARD物理STANDBY的 SWITCHOVER切換[zt]
- 基於data guard 增量scn的rman備份重新同步rolling forward物理備庫Forward
- Oracle 11g RAC Data Guard 物理standby 建立Oracle
- 管理物理STANDBY資料庫——DATA GUARD概念和管理資料庫
- 建立物理STANDBY資料庫——DATA GUARD概念和管理資料庫
- 盛哥學習 Data Guard 第二篇《物理standby準備和建立》
- DATA GUARD物理備庫的SWITCHOVER切換
- 【DataGuard】Oracle 11g物理Data Guard之Snapshot Standby資料庫功能Oracle資料庫
- 【轉】【DataGuard】Oracle 11g物理Data Guard之Snapshot Standby資料庫功能Oracle資料庫
- data gurad物理備份方式下以READ ONLY/WRITE模式開啟物理STANDBY模式
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- 通過RMAN Duplicate建立Oracle物理standby備庫Oracle
- 【DataGuard】物理Data Guard之Failover轉換AI
- oracle10g data guard建立物理standby資料庫的例子Oracle資料庫
- 盛哥學習 Data Guard 第三篇《物理standby之switchover 無損切換》
- Data guard搭建
- Oracle裡邏輯備份、物理備份、Rman備份的區別Oracle
- Oracle Data Guard Linux 平臺 Physical Standby 搭建例項OracleLinux
- 盛哥學習 Data Guard 第四篇《物理standby之failover 丟棄切換》AI
- Oracle 19C Data Guard基礎運維-01安裝物理standbyOracle運維
- using rman to creat oracle10g data guard standby db_with recoveryOracle
- Windows下ORACLE 11G DATA GUARD搭建(用於實時備份)WindowsOracle
- Data Guard之Snapshot Standby資料庫功能[轉]資料庫
- Data Guard - Snapshot Standby Database配置Database
- 【DG】怎麼使用Data Pump備份物理備庫
- 建立RMAN catalog實現物理備份
- Oracle Data Guard Linux 平臺 Physical Standby 搭建例項-3OracleLinux
- Oracle Data Guard Linux 平臺 Physical Standby 搭建例項 -2OracleLinux
- Oracle Data Guard Linux 平臺 Physical Standby 搭建例項 -1OracleLinux