承接着step1留下的问题

搭建dg的时候是先修改initparameter然后在用rman备份去恢复备库?还是先用rman恢复了数据库在去修改主备库的initparmaeter?

其实答案是都可以的.

step1:配置oracle dg我是先配置了主备库的initparameter然后在去用的rman做了恢复.

这篇我是先去做rman的恢复在去修改parameter

1.listener.ora&tnsnames.ora不需要修改,按照step1的

2.修改initparameter

primary database:

[oracle@dg1 dbs]$ more initprimary.ora0731
db_name=DG
control_files=/u01/app/oradata/cntl.ctl
db_block_size=8192
undo_tablespace=UNDOTBS1

standby database:

[oracle@dg2 dbs]$ more initstandby.ora.0731
db_name=DG
control_files=/u01/app/oradata/con.ctl

3.startup(primary),startup nomount(standby)

4.rman 恢复数据库到备库

[oracle@dg1 dbs]$ rman target /

Recovery Manager: Release 11.2.0.2.0 – Production on Tue Jul 30 02:04:25 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: DG (DBID=1735397445)

RMAN> connect auxiliary sys/oracle@dg2;

connected to auxiliary database: DG (not mounted)

RMAN> duplicate target database for standby from active database nofilenamecheck;

Starting Duplicate Db at 30-JUL-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
backup as copy reuse
targetfile ‘/u01/app/oracle/11.2.0/dbs/orapwprimary’ auxiliary format
‘/u01/app/oracle/11.2.0/dbs/orapwstandby’ ;
}
executing Memory Script

Starting backup at 30-JUL-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
Finished backup at 30-JUL-13

contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format ‘/u01/app/oradata/con.ctl’;
}
executing Memory Script

Starting backup at 30-JUL-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/11.2.0/dbs/snapcf_primary.f tag=TAG20130730T020514 RECID=16 STAMP=822103516
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 30-JUL-13

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/oradata/temp01.dbf”;
switch clone tempfile all;
set newname for datafile 1 to
“/u01/app/oradata/system.dbf”;
set newname for datafile 2 to
“/u01/app/oradata/sysaux.dbf”;
set newname for datafile 3 to
“/u01/app/oradata/undotbs1.dbf”;
backup as copy reuse
datafile 1 auxiliary format
“/u01/app/oradata/system.dbf” datafile
2 auxiliary format
“/u01/app/oradata/sysaux.dbf” datafile
3 auxiliary format
“/u01/app/oradata/undotbs1.dbf” ;
sql ‘alter system archive log current’;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oradata/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 30-JUL-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oradata/system.dbf
output file name=/u01/app/oradata/system.dbf tag=TAG20130730T020528
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:26
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oradata/undotbs1.dbf
output file name=/u01/app/oradata/undotbs1.dbf tag=TAG20130730T020528
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oradata/sysaux.dbf
output file name=/u01/app/oradata/sysaux.dbf tag=TAG20130730T020528
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 30-JUL-13

sql statement: alter system archive log current

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=16 STAMP=822114255 file name=/u01/app/oradata/system.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=17 STAMP=822114255 file name=/u01/app/oradata/sysaux.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=18 STAMP=822114255 file name=/u01/app/oradata/undotbs1.dbf
ORACLE error from auxiliary database: ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 1 thread 1: ‘/u01/app/oradata/redo1.log’

RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 2 thread 1: ‘/u01/app/oradata/redo2.log’

RMAN-05535: WARNING: All redo log files were not defined properly.
ORACLE error from auxiliary database: ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 3 thread 1: ‘/u01/app/oradata/redo3.log’

RMAN-05535: WARNING: All redo log files were not defined properly.
Finished Duplicate Db at 30-JUL-13

RMAN>

5.将原本修改好的initparameter替换回来并开启数据库

6.check dataguard ok.