set up a standby quickly by duplicate.
1.Create an Oracle Password File for the Auxiliary Instance
Password of user sys must be the same as primary side,so i copy the password file from primary,otherwise,you will get an error like:
ORA-16191: Primarylog shipping client not logged on standby
2.Ensure Oracle Net Connectivity to the Auxiliary Instance
dramaticly configure linster on standby(Auxiliary) side like:.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = O02DMS3)
(ORACLE_HOME = /dms01/app/oracle)
(GLOBAL_NAME = O02DMS3)
)
)
1.Create an Oracle Password File for the Auxiliary Instance
Password of user sys must be the same as primary side,so i copy the password file from primary,otherwise,you will get an error like:
ORA-16191: Primarylog shipping client not logged on standby
2.Ensure Oracle Net Connectivity to the Auxiliary Instance
dramaticly configure linster on standby(Auxiliary) side like:.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = O02DMS3)
(ORACLE_HOME = /dms01/app/oracle)
(GLOBAL_NAME = O02DMS3)
)
)
verify the connection from primary to standby.
example:sqlplus sys/123@O02DMS3DR as sysdba
3.Create an Initialization Parameter File for the Auxiliary Instance
*.compatible='10.2.0.2.0'
*.control_files='/dms01/app/dump/controldr.ctl'
*.db_name='O02DMS3'
LOG_FILE_NAME_CONVERT=('+DG01/dms','/dms01/app/data/O02DMS3')
4.Start the Auxiliary Instance with the server parameter file
create spfile from pfile;startup force nomount
5.backup database and controlfile on primary sid by rman ,and then copy all those to standby on the same directory.
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/dms01/app/dump/rman/controldr.ctl';
6.Creating a Duplicate Database
rman TARGET/ AUXILIARY SYS/123@O02DMS3DR
RUN
{ SET NEWNAME FOR DATAFILE 1 TO '/dms01/app/data/O02DMS3/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/dms01/app/data/O02DMS3/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/dms01/app/data/O02DMS3/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/dms01/app/data/O02DMS3/users01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/dms01/app/data/O02DMS3/undotbs02.dbf';
DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK;
}
log:
executing command: SET NEWNAME
using target database control file instead of recovery catalog
example:sqlplus sys/123@O02DMS3DR as sysdba
3.Create an Initialization Parameter File for the Auxiliary Instance
*.compatible='10.2.0.2.0'
*.control_files='/dms01/app/dump/controldr.ctl'
*.db_name='O02DMS3'
LOG_FILE_NAME_CONVERT=('+DG01/dms','/dms01/app/data/O02DMS3')
4.Start the Auxiliary Instance with the server parameter file
create spfile from pfile;startup force nomount
5.backup database and controlfile on primary sid by rman ,and then copy all those to standby on the same directory.
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/dms01/app/dump/rman/controldr.ctl';
6.Creating a Duplicate Database
rman TARGET/ AUXILIARY SYS/123@O02DMS3DR
RUN
{ SET NEWNAME FOR DATAFILE 1 TO '/dms01/app/data/O02DMS3/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/dms01/app/data/O02DMS3/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/dms01/app/data/O02DMS3/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/dms01/app/data/O02DMS3/users01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/dms01/app/data/O02DMS3/undotbs02.dbf';
DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK;
}
log:
executing command: SET NEWNAME
using target database control file instead of recovery catalog
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting Duplicate Db at 30-APR-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=157 devtype=DISK
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=157 devtype=DISK
contents of Memory Script.:
{
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
{
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting restore at 30-APR-12
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: copied control file copy
input filename=/dms01/app/dump/rman/controldr.ctl
output filename=/dms01/app/dump/controldr.ctl
Finished restore at 30-APR-12
channel ORA_AUX_DISK_1: copied control file copy
input filename=/dms01/app/dump/rman/controldr.ctl
output filename=/dms01/app/dump/controldr.ctl
Finished restore at 30-APR-12
sql statement: alter database mount standby database
released channel: ORA_AUX_DISK_1
released channel: ORA_AUX_DISK_1
contents of Memory Script.:
{
set newname for tempfile 1 to
"+DG01/dms/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/dms01/app/data/O02DMS3/system01.dbf";
set newname for datafile 2 to
"/dms01/app/data/O02DMS3/undotbs01.dbf";
set newname for datafile 3 to
"/dms01/app/data/O02DMS3/sysaux01.dbf";
set newname for datafile 4 to
"/dms01/app/data/O02DMS3/users01.dbf";
set newname for datafile 5 to
"/dms01/app/data/O02DMS3/undotbs02.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
{
set newname for tempfile 1 to
"+DG01/dms/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/dms01/app/data/O02DMS3/system01.dbf";
set newname for datafile 2 to
"/dms01/app/data/O02DMS3/undotbs01.dbf";
set newname for datafile 3 to
"/dms01/app/data/O02DMS3/sysaux01.dbf";
set newname for datafile 4 to
"/dms01/app/data/O02DMS3/users01.dbf";
set newname for datafile 5 to
"/dms01/app/data/O02DMS3/undotbs02.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to +DG01/dms/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 30-APR-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /dms01/app/data/O02DMS3/system01.dbf
restoring datafile 00002 to /dms01/app/data/O02DMS3/undotbs01.dbf
restoring datafile 00003 to /dms01/app/data/O02DMS3/sysaux01.dbf
restoring datafile 00004 to /dms01/app/data/O02DMS3/users01.dbf
restoring datafile 00005 to /dms01/app/data/O02DMS3/undotbs02.dbf
channel ORA_AUX_DISK_1: reading from backup piece /dms01/app/dump/rman/bp_05n9o9 ur_1_1_O02DMS3
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/dms01/app/dump/rman/bp_05n9o9ur_1_1_O02DMS3 tag=TAG20120430T181554
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:17
Finished restore at 30-APR-12
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /dms01/app/data/O02DMS3/system01.dbf
restoring datafile 00002 to /dms01/app/data/O02DMS3/undotbs01.dbf
restoring datafile 00003 to /dms01/app/data/O02DMS3/sysaux01.dbf
restoring datafile 00004 to /dms01/app/data/O02DMS3/users01.dbf
restoring datafile 00005 to /dms01/app/data/O02DMS3/undotbs02.dbf
channel ORA_AUX_DISK_1: reading from backup piece /dms01/app/dump/rman/bp_05n9o9 ur_1_1_O02DMS3
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/dms01/app/dump/rman/bp_05n9o9ur_1_1_O02DMS3 tag=TAG20120430T181554
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:17
Finished restore at 30-APR-12
contents of Memory Script.:
{
switch clone datafile all;
}
executing Memory Script
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy recid=6 stamp=781989236 filename=/dms01/app/data/O02DMS3/sys tem01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=7 stamp=781989236 filename=/dms01/app/data/O02DMS3/und otbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=8 stamp=781989236 filename=/dms01/app/data/O02DMS3/sys aux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=9 stamp=781989236 filename=/dms01/app/data/O02DMS3/use rs01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=10 stamp=781989236 filename=/dms01/app/data/O02DMS3/un dotbs02.dbf
Finished Duplicate Db at 30-APR-12
input datafile copy recid=6 stamp=781989236 filename=/dms01/app/data/O02DMS3/sys tem01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=7 stamp=781989236 filename=/dms01/app/data/O02DMS3/und otbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=8 stamp=781989236 filename=/dms01/app/data/O02DMS3/sys aux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=9 stamp=781989236 filename=/dms01/app/data/O02DMS3/use rs01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=10 stamp=781989236 filename=/dms01/app/data/O02DMS3/un dotbs02.dbf
Finished Duplicate Db at 30-APR-12
RMAN> exit
7.verify the role on both side.
standby:
SQL> select INST_ID,database_role from gv$database;
SQL> select INST_ID,database_role from gv$database;
INST_ID DATABASE_ROLE
---------- ----------------
1 PHYSICAL STANDBY
---------- ----------------
1 PHYSICAL STANDBY
PRIMARY:
SQL> select INST_ID,database_role from gv$database;
SQL> select INST_ID,database_role from gv$database;
INST_ID DATABASE_ROLE
---------- ----------------
1 PRIMARY
---------- ----------------
1 PRIMARY
8.setting Parameters
primary side:
alter system set log_archive_config='DG_CONFIG=(DMS,O02DMS3DR)' scope=both sid='*';
alter system set LOG_ARCHIVE_DEST_2='SERVICE=O02DMS3DR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=O02DMS3 LGWR ASYNC' scope=both sid='*';
standby side:
alter system set log_archive_config='DG_CONFIG=(DMS,O02DMS3DR)' scope=both sid='*';--don't miss it ,otherwise it will raise an error like:
ORA-16047: DGID mismatch between destination setting and standby
primary side:
alter system set log_archive_config='DG_CONFIG=(DMS,O02DMS3DR)' scope=both sid='*';
alter system set LOG_ARCHIVE_DEST_2='SERVICE=O02DMS3DR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=O02DMS3 LGWR ASYNC' scope=both sid='*';
standby side:
alter system set log_archive_config='DG_CONFIG=(DMS,O02DMS3DR)' scope=both sid='*';--don't miss it ,otherwise it will raise an error like:
ORA-16047: DGID mismatch between destination setting and standby
9.startup mrp and active log transport service.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
perform. it on standby.
perform. it on standby.
keep an eye on alert logfile.
alter system set log_archive_dest_state_2=defer;
alter system set log_archive_dest_state_2=enable;
alter system set log_archive_dest_state_2=enable;
col DEST_NAME for a30;
set linesize 200;
select DEST_NAME,STATUS,PROTECTION_MODE,ERROR from V$ARCHIVE_DEST_STATUS;
perform. it on primary.
set linesize 200;
select DEST_NAME,STATUS,PROTECTION_MODE,ERROR from V$ARCHIVE_DEST_STATUS;
perform. it on primary.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21993926/viewspace-722497/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21993926/viewspace-722497/