Вы находитесь на странице: 1из 17

Oracle11gCrossplatformActiveStandbyWindowsPrimarydatabaseand

LinuxActiveStandby

Thisnotedescribestheprocedureofconfiguringacrossplatformusingthe11gRMANActiveDuplicateaswellasanActiveStandby
DatabasesetupoveraWindowsandLinuxplatform.

TheMetalinknoteDataGuardSupportforHeterogeneousPrimaryandPhysicalStandbysinSameDataGuardConfiguration[ID
413484.1]describesthesupportedcrossplatformcombinationsbetweenaprimaryandstandbydatabase.

Theenvironmentusedisasfollows:

Primary

Windows764bit
11gRelease2

DB_UNIQUE_NAME=orcl

ActiveStandby

OracleEnterpriseLinux5.764bit
11gRelease2

DB_UNIUE_NAME=orcl_dr

Addstaticentryinlistener.ora

(SID_DESC=
(GLOBAL_DBNAME=orcl_dr)
(ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)

(SID_NAME=orcl_dr)
)

Reloadlistenerorstopandstartlistener

Addentriesintnsnames.oraonbothsourceandtarget

ORCL_DR=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=linux01.gavinsoorma.com)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=orcl_dr)
)
)

ORCL=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=gavinpc)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=orcl)
)
)

Createpasswordfileontargetensuresamepasswordisusedtheprimarydatabasepasswordfile

Createdirectoryforaudit_file_dest


Createdirectoryfordatabasefiles

OntheWindowsserverthedatafilelocationisC:\ORADATA|ORCL.OntheLinuxmachinethecorrespondinglocationis
'/u01/oradata/orcl_dr'

Createdirectoryforlog_archive_dest_1'/u01/oradata/orcl_dr/arch/'

Createinit.orain$ORACLE_HOME/dbslocationwithoneentry

*.DB_NAME=orcl_dr

STARTUPNOMOUNTthestandbydatabase

ThisistheRMANcommandusedtocreateaDuplicatefromActiveDatabase.

Notethedb_file_name_convertandlog_file_name_convertparameters.

DUPLICATETARGETDATABASE
FORSTANDBY
FROMACTIVEDATABASE
NOFILENAMECHECK
DORECOVER
SPFILE
SETDB_UNIQUE_NAME="orcl_dr"
SETAUDIT_FILE_DEST="/u02/app/oracle/admin/orcl_dr/adump"
SETDIAGNOSTIC_DEST="/u02/app/oracle"
SETLOG_ARCHIVE_DEST_2="service=orcl_drLGWRSYNCREGISTERVALID_FOR=(online_logfile,primary_role)"
SETFAL_SERVER="orcl_dr"
SETFAL_CLIENT="orcl"

SET
CONTROL_FILES='/u01/oradata/orcl_dr/control01.ctl','/u01/oradata/orcl_dr/control02.ctl','/u01/oradata/orcl_dr/control03
.ctl'
SETDB_FILE_NAME_CONVERT='C:\ORADATA\ORCL\','/u01/oradata/orcl_dr/'
SETLOG_FILE_NAME_CONVERT='C:\ORADATA\ORCL\','/u01/oradata/orcl_dr/';

NotethemistakeImadeherewasnotsettingtheparametersLOG_ARCHIVE_DEST_1andLOG_ARCHIVE_FORMATintheaboveRMAN
Duplicatescript

Thatiswhywewillseearchivelogfilesbeingcreatedonthetargetlike:

/u02/app/oracle/product/11.2.0/dbhome_1/dbs/c:oradataorclarchARC0000000005_0765492451.0001

FromthePrimarydatabaserunthefollowingcommand

c:\app\gavin\product\11.2.0\dbhome_2\BIN>rmantargetsys/oracle11gauxiliarysys/oracle11g@orcl_dr

RecoveryManager:Release11.2.0.1.0ProductiononWedOct2618:22:362011

Copyright(c)1982,2009,Oracleand/oritsaffiliates.Allrightsreserved.

connectedtotargetdatabase:ORCL(DBID=1293273184)
connectedtoauxiliarydatabase:ORCL_DR(notmounted)

RMAN>DUPLICATETARGETDATABASE
2>FORSTANDBY
3>FROMACTIVEDATABASE
4>NOFILENAMECHECK
5>DORECOVER
6>SPFILE

7>SETDB_UNIQUE_NAME="orcl_dr"
8>SETAUDIT_FILE_DEST="/u02/app/oracle/admin/orcl_dr/adump"
9>SETDIAGNOSTIC_DEST="/u02/app/oracle/diag"
10>SETLOG_ARCHIVE_DEST_2="service=orcl_drLGWRSYNCREGISTERVALID_FOR=(online
_logfile,primary_role)"
11>SETFAL_SERVER="orcl_dr"
12>SETFAL_CLIENT="orcl"
13>SETCONTROL_FILES='/u01/oradata/orcl_dr/control01.ctl','/u01/oradata/orcl_dr
/control02.ctl','/u01/oradata/orcl_dr/control03.ctl'
14>SETDB_FILE_NAME_CONVERT='C:\ORADATA\ORCL\','/u01/oradata/orcl_dr/'
15>SETLOG_FILE_NAME_CONVERT='C:\ORADATA\ORCL\','/u01/oradata/orcl_dr/';

StartingDuplicateDbat26OCT11
usingtargetdatabasecontrolfileinsteadofrecoverycatalog
allocatedchannel:ORA_AUX_DISK_1
channelORA_AUX_DISK_1:SID=10devicetype=DISK

contentsofMemoryScript:
{
backupascopyreuse
targetfile'C:\app\gavin\product\11.2.0\dbhome_2\DATABASE\PWDorcl.ORA'auxil
iaryformat
'/u02/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl_dr'targetfile
'C:\APP\GAVIN\PRODUCT\11.2.0\DBHOME_2\DATABASE\SPFILEORCL.ORA'auxiliaryformat

'/u02/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl_dr.ora';
sqlclone"altersystemsetspfile=''/u02/app/oracle/product/11.2.0/dbhome_1
/dbs/spfileorcl_dr.ora''";
}
executingMemoryScript

Startingbackupat26OCT11

allocatedchannel:ORA_DISK_1
channelORA_DISK_1:SID=222devicetype=DISK
Finishedbackupat26OCT11

sqlstatement:altersystemsetspfile=''/u02/app/oracle/product/11.2.0/dbhome_
1/dbs/spfileorcl_dr.ora''

contentsofMemoryScript:
{
sqlclone"altersystemsetdb_unique_name=
''orcl_dr''comment=
''''scope=spfile";
sqlclone"altersystemsetAUDIT_FILE_DEST=
''/u02/app/oracle/admin/orcl_dr/adump''comment=
''''scope=spfile";
sqlclone"altersystemsetDIAGNOSTIC_DEST=
''/u02/app/oracle/diag''comment=
''''scope=spfile";
sqlclone"altersystemsetLOG_ARCHIVE_DEST_2=
''service=orcl_drLGWRSYNCREGISTERVALID_FOR=(online_logfile,primary_role)''
comment=
''''scope=spfile";
sqlclone"altersystemsetFAL_SERVER=
''orcl_dr''comment=
''''scope=spfile";
sqlclone"altersystemsetFAL_CLIENT=
''orcl''comment=
''''scope=spfile";
sqlclone"altersystemsetCONTROL_FILES=
''/u01/oradata/orcl_dr/control01.ctl'',''/u01/oradata/orcl_dr/control02.ctl'',
''/u01/oradata/orcl_dr/control03.ctl''comment=
''''scope=spfile";

sqlclone"altersystemsetdb_file_name_convert=
''C:\ORADATA\ORCL\'',''/u01/oradata/orcl_dr/''comment=
''''scope=spfile";
sqlclone"altersystemsetLOG_FILE_NAME_CONVERT=
''C:\ORADATA\ORCL\'',''/u01/oradata/orcl_dr/''comment=
''''scope=spfile";
shutdowncloneimmediate;
startupclonenomount;
}
executingMemoryScript

sqlstatement:altersystemsetdb_unique_name=''orcl_dr''comment=''''sco
pe=spfile

sqlstatement:altersystemsetAUDIT_FILE_DEST=''/u02/app/oracle/admin/orcl
_dr/adump''comment=''''scope=spfile

sqlstatement:altersystemsetDIAGNOSTIC_DEST=''/u02/app/oracle/diag''com
ment=''''scope=spfile

sqlstatement:altersystemsetLOG_ARCHIVE_DEST_2=''service=orcl_drLGWRSY
NCREGISTERVALID_FOR=(online_logfile,primary_role)''comment=''''scope=spfile

sqlstatement:altersystemsetFAL_SERVER=''orcl_dr''comment=''''scope=s
pfile

sqlstatement:altersystemsetFAL_CLIENT=''orcl''comment=''''scope=spfi
le

sqlstatement:altersystemsetCONTROL_FILES=''/u01/oradata/orcl_dr/control
01.ctl'',''/u01/oradata/orcl_dr/control02.ctl'',''/u01/oradata/orcl_dr/control

03.ctl''comment=''''scope=spfile

sqlstatement:altersystemsetdb_file_name_convert=''C:\ORADATA\ORCL\'','
'/u01/oradata/orcl_dr/''comment=''''scope=spfile

sqlstatement:altersystemsetLOG_FILE_NAME_CONVERT=''C:\ORADATA\ORCL\'',
''/u01/oradata/orcl_dr/''comment=''''scope=spfile

Oracleinstanceshutdown

connectedtoauxiliarydatabase(notstarted)
Oracleinstancestarted

TotalSystemGlobalArea835104768bytes

FixedSize2217952bytes
VariableSize230688800bytes
DatabaseBuffers595591168bytes
RedoBuffers6606848bytes

contentsofMemoryScript:
{
backupascopycurrentcontrolfileforstandbyauxiliaryformat'/u01/oradat
a/orcl_dr/control01.ctl';
restoreclonecontrolfileto'/u01/oradata/orcl_dr/control02.ctl'from
'/u01/oradata/orcl_dr/control01.ctl';
restoreclonecontrolfileto'/u01/oradata/orcl_dr/control03.ctl'from
'/u01/oradata/orcl_dr/control01.ctl';
}
executingMemoryScript

Startingbackupat26OCT11
usingchannelORA_DISK_1
channelORA_DISK_1:startingdatafilecopy
copyingstandbycontrolfile
outputfilename=C:\APP\GAVIN\PRODUCT\11.2.0\DBHOME_2\DATABASE\SNCFORCL.ORAtag=
TAG20111026T182824RECID=2STAMP=765570526
channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:45
Finishedbackupat26OCT11

Startingrestoreat26OCT11
allocatedchannel:ORA_AUX_DISK_1
channelORA_AUX_DISK_1:SID=134devicetype=DISK

channelORA_AUX_DISK_1:copiedcontrolfilecopy
Finishedrestoreat26OCT11

Startingrestoreat26OCT11
usingchannelORA_AUX_DISK_1

channelORA_AUX_DISK_1:copiedcontrolfilecopy
Finishedrestoreat26OCT11

contentsofMemoryScript:
{
sqlclone'alterdatabasemountstandbydatabase';
}
executingMemoryScript

sqlstatement:alterdatabasemountstandbydatabase

contentsofMemoryScript:
{

setnewnamefortempfile1to
"/u01/oradata/orcl_dr/TEMP01.DBF";
switchclonetempfileall;
setnewnamefordatafile1to
"/u01/oradata/orcl_dr/SYSTEM01.DBF";
setnewnamefordatafile2to
"/u01/oradata/orcl_dr/SYSAUX01.DBF";
setnewnamefordatafile3to
"/u01/oradata/orcl_dr/UNDOTBS01.DBF";
setnewnamefordatafile4to
"/u01/oradata/orcl_dr/USERS01.DBF";
setnewnamefordatafile5to
"/u01/oradata/orcl_dr/EXAMPLE01.DBF";
backupascopyreuse
datafile1auxiliaryformat
"/u01/oradata/orcl_dr/SYSTEM01.DBF"datafile
2auxiliaryformat
"/u01/oradata/orcl_dr/SYSAUX01.DBF"datafile
3auxiliaryformat
"/u01/oradata/orcl_dr/UNDOTBS01.DBF"datafile
4auxiliaryformat
"/u01/oradata/orcl_dr/USERS01.DBF"datafile
5auxiliaryformat
"/u01/oradata/orcl_dr/EXAMPLE01.DBF";
sql'altersystemarchivelogcurrent';
}
executingMemoryScript

executingcommand:SETNEWNAME

renamedtempfile1to/u01/oradata/orcl_dr/TEMP01.DBFincontrolfile

executingcommand:SETNEWNAME

executingcommand:SETNEWNAME

executingcommand:SETNEWNAME

executingcommand:SETNEWNAME

executingcommand:SETNEWNAME

Startingbackupat26OCT11
usingchannelORA_DISK_1
channelORA_DISK_1:startingdatafilecopy
inputdatafilefilenumber=00001name=C:\ORADATA\ORCL\SYSTEM01.DBF
outputfilename=/u01/oradata/orcl_dr/SYSTEM01.DBFtag=TAG20111026T182947
channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:02:25
channelORA_DISK_1:startingdatafilecopy
inputdatafilefilenumber=00002name=C:\ORADATA\ORCL\SYSAUX01.DBF
outputfilename=/u01/oradata/orcl_dr/SYSAUX01.DBFtag=TAG20111026T182947
channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:01:55
channelORA_DISK_1:startingdatafilecopy
inputdatafilefilenumber=00005name=C:\ORADATA\ORCL\EXAMPLE01.DBF
outputfilename=/u01/oradata/orcl_dr/EXAMPLE01.DBFtag=TAG20111026T182947
channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:53
channelORA_DISK_1:startingdatafilecopy
inputdatafilefilenumber=00003name=C:\ORADATA\ORCL\UNDOTBS01.DBF
outputfilename=/u01/oradata/orcl_dr/UNDOTBS01.DBFtag=TAG20111026T182947
channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:35
channelORA_DISK_1:startingdatafilecopy
inputdatafilefilenumber=00004name=C:\ORADATA\ORCL\USERS01.DBF
outputfilename=/u01/oradata/orcl_dr/USERS01.DBFtag=TAG20111026T182947

channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:25
Finishedbackupat26OCT11

sqlstatement:altersystemarchivelogcurrent

contentsofMemoryScript:
{
backupascopyreuse
archiveloglike"C:\ORADATA\ORCL\ARCH\ARC0000000005_0765492451.0001"auxilia
ryformat
"/u02/app/oracle/product/11.2.0/dbhome_1/dbs/c:oradataorclarchARC0000000005_076
5492451.0001";
catalogclonearchivelog"/u02/app/oracle/product/11.2.0/dbhome_1/dbs/c:orad
ataorclarchARC0000000005_0765492451.0001";
switchclonedatafileall;
}
executingMemoryScript

Startingbackupat26OCT11
usingchannelORA_DISK_1
channelORA_DISK_1:startingarchivedlogcopy
inputarchivedlogthread=1sequence=5RECID=3STAMP=765570963
outputfilename=/u02/app/oracle/product/11.2.0/dbhome_1/dbs/c:oradataorclarchAR
C0000000005_0765492451.0001RECID=0STAMP=0
channelORA_DISK_1:archivedlogcopycomplete,elapsedtime:00:00:25
Finishedbackupat26OCT11

catalogedarchivedlog
archivedlogfilename=/u02/app/oracle/product/11.2.0/dbhome_1/dbs/c:oradataorcl
archARC0000000005_0765492451.0001RECID=1STAMP=765570981

datafile1switchedtodatafilecopy

inputdatafilecopyRECID=2STAMP=765570981filename=/u01/oradata/orcl_dr/SYSTE
M01.DBF
datafile2switchedtodatafilecopy
inputdatafilecopyRECID=3STAMP=765570981filename=/u01/oradata/orcl_dr/SYSAU
X01.DBF
datafile3switchedtodatafilecopy
inputdatafilecopyRECID=4STAMP=765570982filename=/u01/oradata/orcl_dr/UNDOT
BS01.DBF
datafile4switchedtodatafilecopy
inputdatafilecopyRECID=5STAMP=765570982filename=/u01/oradata/orcl_dr/USERS
01.DBF
datafile5switchedtodatafilecopy
inputdatafilecopyRECID=6STAMP=765570982filename=/u01/oradata/orcl_dr/EXAMP
LE01.DBF

contentsofMemoryScript:
{
setuntilscn1034319;
recover
standby
clonedatabase
deletearchivelog
;
}
executingMemoryScript

executingcommand:SETuntilclause

Startingrecoverat26OCT11
usingchannelORA_AUX_DISK_1

startingmediarecovery


archivedlogforthread1withsequence5isalreadyondiskasfile/u02/app/or
acle/product/11.2.0/dbhome_1/dbs/c:oradataorclarchARC0000000005_0765492451.0001
archivedlogfilename=/u02/app/oracle/product/11.2.0/dbhome_1/dbs/c:oradataorcl
archARC0000000005_0765492451.0001thread=1sequence=5
mediarecoverycomplete,elapsedtime:00:00:02
Finishedrecoverat26OCT11
FinishedDuplicateDbat26OCT11

RMAN>

ONPRIMARY

SQL>altersystemsetstandby_file_management=AUTOscope=both;

Systemaltered.

SQL>altersystemsetfal_server=orclscope=both;

Systemaltered.

SQL>altersystemsetfal_client=orcl_drscope=both;

Systemaltered.

SQL>altersystemsetLOG_ARCHIVE_DEST_2='SERVICE=orcl_drLGWRSYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
NET_TIMEOUT=60DB_UNIQUE_NAME=orcl_dr'scope=both;

ONSTANDBY

SQL>altersystemsetLOG_ARCHIVE_DEST_1='LOCATION=/u01/oradata/orcl_dr/archVALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=orcl_dr';SQL>

Systemaltered.

SQL>altersystemsetLOG_ARCHIVE_DEST_2='SERVICE=orclLGWRSYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=orcl'scope=both;

Systemaltered.

ShutdownandopentheStandbydatabaseandconfiguretheRealTimeApply(ActiveDataGuard)

SQL>shutdownimmediate;
ORA01109:databasenotopen

Databasedismounted.
ORACLEinstanceshutdown.
SQL>startup;
ORACLEinstancestarted.

TotalSystemGlobalArea835104768bytes
FixedSize2217952bytes
VariableSize230688800bytes
DatabaseBuffers595591168bytes
RedoBuffers6606848bytes
Databasemounted.
Databaseopened.

SQL>recovermanagedstandbydatabaseusingcurrentlogfiledisconnect;
Mediarecoverycomplete

SQL>selectplatform_name,open_modefromv$database;

PLATFORM_NAMEOPEN_MODE

Linuxx8664bitREADONLY.