ITPub博客

首页 > 数据库 > Oracle > Data Guard 之RMAN备份在线搭建物理standby

Data Guard 之RMAN备份在线搭建物理standby

原创 Oracle 作者:wolfreturn 时间:2015-05-27 17:19:19 0 删除 编辑

此种方式搭建 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博客 ” ,链接:https://blog.itpub.net/24742969/viewspace-1674111/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
数据库维修工。 http://idber.github.io

注册时间:2014-07-11

  • 博文量
    58
  • 访问量
    681975