Beruflich Dokumente
Kultur Dokumente
(//docs.oracle.com/en/) (#)
Home(/)/Database(/en/database/)/OracleDatabaseOnlineDocumentation11gRelease2(11.2)(../../index.htm)/DatabaseAdministration
(../../nav/portal_4.htm)
DatabaseBackupandRecoveryUser'sGuide
27TransportingDataAcrossPlatforms
YoucanuseRMANtotransporttablespacesacrossplatformswithdifferentendianformats.YoucanalsouseRMANtotransportanentire
databasetoadifferentplatformsolongasthetwoplatformshavethesameendianformat.
Thischaptercontainsthefollowingtopics:
OverviewofCrossPlatformDataTransportation(#CHDECFIB)
PerformingCrossPlatformTablespaceConversionontheSourceHost(#CHDHHCGI)
PerformingCrossPlatformDataFileConversionontheDestinationHost(#CHDGHFEG)
CheckingtheDatabaseBeforeCrossPlatformDatabaseConversion(#CHDJAAHJ)
ConvertingDataFilesontheSourceHostWhenTransportingaDatabase(#CHDJFBED)
ConvertingDataFilesontheDestinationHostWhenTransportingaDatabase(#CHDDIIIJ)
OverviewofCrossPlatformDataTransportation
Thissectionexplainsthebasicconceptsandtasksinvolvedintransportingtablespacesanddatabasesacrossplatforms.
PurposeofCrossPlatformDataTransportation
Youcantransporttablespacesinadatabasethatrunsononeplatformintoadatabasethatrunsonadifferentplatform.Typicalusesofcross
platformtransportabletablespacesincludethefollowing:
Publishingstructureddataastransportabletablespacesfordistributiontocustomers,whocanconvertthetablespacesforintegrationinto
theirexistingdatabasesregardlessofplatform
MovingdatafromalargedatawarehouseservertodatamartsonsmallercomputerssuchasLinuxbasedworkstationsorservers
Sharingreadonlytablespacesacrossaheterogeneousclusterinwhichallhostssharethesameendianformat
Afulldiscussionoftransportabletablespaces,theiruses,andthedifferenttechniquesforcreatingandusingthemisfoundinOracleDatabase
Administrator'sGuide.(../../server.112/e25494/tspaces.htm#ADMIN01101)
YoucanalsouseRMANtotransportanentiredatabasefromoneplatformtoanother.Forexample,businessrequirementsdemandthatyou
runyourdatabasesonlessexpensiveserversthatuseadifferentplatform.Inthiscase,youcanuseRMANtotransporttheentiredatabase
ratherthanrecreateitanduseimportutilitiesortransportabletablespacestorepopulatethedata.
Youcanconvertadatabaseonthedestinationhostorsourcehost.Reasonsforconvertingonthedestinationhostinclude:
Avoidingperformanceoverheadonthesourcehostduetotheconversionprocess
Distributingadatabasefromonesourcesystemtomultiplerecipientsonseveraldifferentplatforms
Evaluatingamigrationpathforanewplatform
BasicConceptsofCrossPlatformDataTransportation
YoumustusetheRMANCONVERTcommandinatransportabletablespaceoperationwhenthesourceplatform(glossary.htm#CHDDHGAF)is
differentfromthedestinationplatform(glossary.htm#CHDHAEJF)andtheendianformatsaredifferent.Ifyouareconvertingpartofthedatabase
betweenplatformsthathavethesameendianformat,youcanuseoperatingsystemmethodstocopythefilesfromthesourcetothe
destination.Ifyouareconvertinganentire,sameendiandatabase,anydatafileswithundoinformationmustbeconverted.Youcannotcopy
thedatafilesdirectlyfromthesourcetothedestinationplatform.
TablespaceandDataFileConversion
YoucanperformtablespaceconversionwiththeRMANCONVERTTABLESPACEcommandonthesourcehost,butnotonthedestinationhost.
TheCONVERTTABLESPACEcommanddoesnotperforminplaceconversionofdatafiles.Rather,thecommandproducesoutputfilesinthe
correctformatforuseonthedestinationplatform.Thecommanddoesnotalterthecontentsofdatafilesinthesourcedatabase.
YoucanusetheCONVERTDATAFILEcommandtoconvertfilesonthedestinationhost,butnotonthesourcehost.TheDataPumpExport
utilitygeneratesanexportdumpfile(glossary.htm#CHDJBIBB)that,withdatafilesmanuallycopiedtothedestinationhost,canbeimportedinto
thedestinationdatabase.Untilthedatafilesaretransportedintothedestinationdatabase,thedatafilesarenotassociatedwithatablespace
nameinthedatabase.Inthiscase,RMANcannottranslatethetablespacenameintoalistofdatafiles.Therefore,youmustuseCONVERT
DATAFILEandidentifythedatafilesbyfilename.
Note:
UsingCONVERTTABLESPACEorCONVERTDATAFILEisonlyonestepinusingcrossplatformtransportabletablespaces.Read
thediscussionoftransportabletablespacesinOracleDatabaseAdministrator'sGuide(../../server.112/e25494/tspaces.htm#ADMIN01101)in
itsentiretybeforeattemptingtofollowtheproceduresinthischapter.
DatabaseConversion
Toconvertawholedatabasetoadifferentplatform,bothplatformsmustusethesameendianformat.TheRMANCONVERTDATABASE
commandautomatesthemovementofanentiredatabasefromasourceplatformtoadestinationplatform.Thetransporteddatabasecontains
thesamedataasthesourcedatabaseandalsohas,withafewexceptions,thesamesettingsasthesourcedatabase.
Filesautomaticallytransportedtothedestinationplatforminclude:
Datafilesthatbelongtopermanenttablespaces
Unliketransportingtablespacesacrossplatforms,transportingentiredatabasesrequiresthatcertaintypesofblocks,suchasblocksinundo
segments,bereformattedtoensurecompatibilitywiththedestinationplatform.Eventhoughtheendianformatsforthesourceand
destinationplatformsarethesame,thedatafilesforatransportabledatabasemustundergoaconversionprocess.Youcannotsimplycopy
datafilesfromoneplatformtoanotherasyoucanwhentransportingtablespaces.
Initializationparameterfileorserverparameterfile
Ifthedatabaseusesatextbasedinitializationparameterfile,thenRMANtransportsit.Ifthedatabaseusesaserverparameterfile,then
RMANgeneratesaninitializationparameterfilebasedontheserverparameterfile,transportsitandcreatesanewserverparameterfileat
thedestinationbasedonthesettingsintheinitializationparameterfile.
Usually,someparametersintheinitializationparameterfilerequiremanualupdatingforthenewdatabase.Forexample,youmaychange
theDB_NAMEandparameterssuchasCONTROL_FILESthatindicatethelocationsoffilesonthedestinationhost.
Youcanconverttheformatofthedatafileseitheronthesourceplatformoronthedestinationplatform.TheCONVERTDATABASEON
DESTINATIONPLATFORMcommanddoesnotconverttheformatofdatafiles.Rather,itgeneratesscriptsthatyoucanrunmanuallytoperform
theconversion.TheCONVERTSCRIPTparametercreatesaconvertscript(glossary.htm#CHDBBCEF)thatyoucanmanuallyexecuteatthe
destinationhosttoconvertdatafilecopiesinbatchmode.TheTRANSPORTSCRIPTparametergeneratesatransportscript
(glossary.htm#CHDJJJJD)thatcontainsSQLstatementstocreatethenewdatabaseonthedestinationplatform.
PerformingCrossPlatformTablespaceConversionontheSource
Host
SeethelistofCONVERTcommandprerequisitesdescribedinOracleDatabaseBackupandRecoveryReference.
(../../backup.112/e10643/rcmsynta012.htm#RCMRF192)Meetalltheseprerequisitesbeforedoingthestepsinthissection.
Forpurposesofillustration,assumethatyoumusttransporttablespacesfinanceandhrfromsourcedatabaseprod_source,whichrunson
aSunSolarishost.Youplantotransportthemtodestinationdatabaseprod_destrunningonaLinuxPC.Youplantostoretheconverted
datafilesinthetemporarydirectory/tmp/transport_linux/onthesourcehost.
Toperformcrossplatformtablespaceconversiononthesourcehost:
1. StartSQL*Plusandconnecttothesourcedatabaseprod_sourcewithadministratorprivileges.
2. QuerythenameforthedestinationplatformintheV$TRANSPORTABLE_PLATFORMview.
Thedatabasehasalistofitsowninternalnamesforeachplatformsupportingcrossplatformdatatransport.Youmayneedtheexact
nameofthesourceordestinationplatformasaparametertotheCONVERTcommand.QueryV$TRANSPORTABLE_PLATFORMtogetthe
platformnames.ThefollowingexamplequeriesLinuxplatformnames:
SELECTPLATFORM_ID,PLATFORM_NAME,ENDIAN_FORMATFROMV$TRANSPORTABLE_PLATFORMWHERE
UPPER(PLATFORM_NAME)LIKE'%LINUX%'
ThePLATFORM_NAMEforLinuxonaPCisLinuxIA(32bit).
3. Placethetablespacestobetransportedinreadonlymode.Forexample,enter:
ALTERTABLESPACEfinanceREADONLYALTERTABLESPACEhrREADONLY
4. Chooseamethodfornamingtheoutputfiles.
YoumustusetheFORMATorDB_FILE_NAME_CONVERTargumentstotheCONVERTcommandtocontrolthenamesoftheoutputfiles.
Therulesarelistedinorderofprecedence:
a. FilesthatmatchanypatternsprovidedinCONVERT...DB_FILE_NAME_CONVERTclausearenamedbaseduponthispattern.
b. IfyouspecifyaFORMATclause,thenanyfilenotnamedbasedonpatternsprovidedinCONVERT...DB_FILE_NAME_CONVERT
clauseisnamedbasedontheFORMATpattern.
Note:
YoucannotuseCONVERT...DB_FILE_NAME_CONVERTtogenerateoutputfilenamesfortheCONVERTcommandwhen
thesourceanddestinationfileshaveOracleManagedFilenames.
5. StartRMANandconnecttothesourcedatabase(notthedestinationdatabase)asTARGET.Forexample,enter:
%rmanRMAN>CONNECTTARGETSYS@prod_source
6. RuntheCONVERTTABLESPACEcommandtoconvertthedatafilesintotheendianformatofthedestinationhost.
Inthefollowingexample,theFORMATargumentcontrolsthenameandlocationoftheconverteddatafiles:
RMAN>CONVERTTABLESPACEfinance,hr2>TOPLATFORM'LinuxIA(32bit)'3>FORMAT
'/tmp/transport_linux/%U'
Theresultisasetofconverteddatafilesinthe/tmp/transport_linux/directory,withdatainthecorrectendianformatfortheLinux
IA(32bit)platform.
SeeAlso:
OracleDatabaseBackupandRecoveryReference(../../backup.112/e10643/rcmsynta012.htm#RCMRF192)forthefullsemanticsofthe
CONVERTcommand
7. Followtherestofthegeneraloutlinefortransportingtablespaces:
a. UsetheOracleDataPumpExportutilitytocreatetheexportdumpfileonthesourcehost.
b. Movetheconverteddatafilesandtheexportdumpfilefromthesourcehosttothedesireddirectoriesonthedestinationhost.
c. PlugthetablespaceintothenewdatabasewiththeImportutility.
d. Ifapplicable,placethetransportedtablespacesintoread/writemode.
PerformingCrossPlatformDataFileConversiononthe
DestinationHost
SeethelistofCONVERTcommandprerequisitesdescribedinOracleDatabaseBackupandRecoveryReference.
(../../backup.112/e10643/rcmsynta012.htm#RCMRF192)Meettheseprerequisitesbeforedoingthestepsinthissection.
AboutCrossPlatformDataFileConversionontheDestinationHost
Datafileconversionnecessitatesthatyouchooseatechniquefornamingtheoutputfiles.YoumustusetheFORMATor
DB_FILE_NAME_CONVERTargumentstotheCONVERTcommandtocontrolthenamingofoutputfiles.Therulesarelistedinorderof
precedence:
1. FilesthatmatchanypatternsprovidedinCONVERT...DB_FILE_NAME_CONVERTclausearenamedbaseduponthispattern.
2. IfyouspecifyaFORMATclause,thenanyfilenotnamedbasedonpatternsprovidedinCONVERT...DB_FILE_NAME_CONVERTclause
isnamedbasedontheFORMATpattern.
Note:
YoucannotuseCONVERT...DB_FILE_NAME_CONVERTtogenerateoutputfilenamesfortheCONVERTcommandwhenboththe
sourceanddestinationfilesareOracleManagedFiles.
Ifthesourceanddestinationplatformsdiffer,thenyoumustspecifytheFROMPLATFORMparameter.Viewplatformnamesbyqueryingthe
V$TRANSPORTABLE_PLATFORM.TheFROMPLATFORMvaluemustmatchtheformatofthedatafilestobeconvertedtoavoidanerror.Ifyoudo
notspecifyFROMPLATFORM,thenthisparameterdefaultstothevalueofthedestinationplatform.
UsingCONVERTDATAFILEtoConvertDataFileFormats
ThissectionexplainshowtousetheCONVERTDATAFILEcommand.Thesectionassumesthatyouintendtotransporttablespacesfinance
(datafilesfin/fin01.dbfandfin/fin02.dbf)andhr(datafileshr/hr01.dbfandhr/hr02.dbf)fromasourcedatabasenamed
prod_source.ThedatabaserunsonaSunSolarishost.Youplantotransportthesetablespacesintoadestinationdatabasenamed
prod_dest,whichrunsonaLinuxPC.Youplantoperformconversiononthedestinationhost.
Whenthedatafilesarepluggedintothedestinationdatabase,youplantostorethemin/orahome/dbsandpreservethecurrentdirectory
structure.Thatis,datafilesforthehrtablespacearestoredinthe/orahome/dbs/hrsubdirectory,anddatafilesforthefinancetablespace
arestoredinthe/orahome/dbs/findirectory.
Toperformcrossplatformdatafileconversiononthedestinationhost:
1. StartSQL*Plusandconnecttothesourcedatabaseprod_sourcewithadministratorprivileges.
2. QuerythenameforthesourceplatforminV$TRANSPORTABLE_PLATFORM.
Thedatabasehasalistofitsowninternalnamesforeachplatformsupportingcrossplatformdatatransport.Youmayneedtheexact
nameofthesourceordestinationplatformasaparametertotheCONVERTcommand.Forexample,youcanobtaintheplatformname
oftheconnecteddatabaseasfollows:
SELECTPLATFORM_NAMEFROMV$TRANSPORTABLE_PLATFORMWHEREPLATFORM_ID=(SELECTPLATFORM_IDFROM
V$DATABASE)
Forthisscenario,assumethatthePLATFORM_NAMEforthesourcehostisSolaris[tm]OE(64bit).
3. Identifythetablespacestobetransportedfromthesourcedatabaseandplacetheminreadonlymode.
Forexample,enterthefollowingSQLstatementstoplacefinanceandhrinreadonlymode:
ALTERTABLESPACEfinanceREADONLYALTERTABLESPACEhrREADONLY
4. Onthesourcehost,useDataPumpExporttocreatetheexportdumpfile
Inthisexample,thedumpfileisnamedexpdat.dmp.
5. Maketheexportdumpfileandthedatafilestobetransportedavailabletothedestinationhost.
YoucanuseNFStomakethedumpfileandcurrentdatabasefiles(notcopies)accessible.Alternatively,youcanuseanoperating
systemutilitytocopythesefilestothedestinationhost.
Inthisexample,youstorethefilesinthe/tmp/transport_solaris/directoryofthedestinationhost.Youpreservethesubdirectory
structurefromtheoriginallocationofthefiles,thatis,thedatafilesarestoredas:
/tmp/transport_solaris/fin/fin01.dbf
/tmp/transport_solaris/fin/fin02.dbf
/tmp/transport_solaris/hr/hr01.dbf
/tmp/transport_solaris/hr/hr02.dbf
6. StartRMANandconnecttothedestinationdatabase(notthesourcedatabase)asTARGET.Forexample,enterthefollowing
command:
%rmanRMAN>CONNECTTARGETSYS@prod_dest
7. ExecutetheCONVERTDATAFILEcommandtoconvertthedatafilesintotheendianformatofthedestinationhost.
Inthisexample,youuseDB_FILE_NAME_CONVERTtocontrolthenameandlocationoftheconverteddatafiles.Youalsospecifythe
FROMPLATFORMclause.
RMAN>CONVERTDATAFILE2>'/tmp/transport_solaris/fin/fin01.dbf',3>
'/tmp/transport_solaris/fin/fin02.dbf',4>'/tmp/transport_solaris/hr/hr01.dbf',5>
'/tmp/transport_solaris/hr/hr02.dbf'6>DB_FILE_NAME_CONVERT7>
'/tmp/transport_solaris/fin','/orahome/dbs/fin',8>'/tmp/transport_solaris/hr','/orahome/dbs/hr'9>
FROMPLATFORM'Solaris[tm]OE(64bit)
Theresultisasetofconverteddatafilesinthe/orahome/dbs/directorythatarenamedasfollows:
/orahome/dbs/fin/fin01.dbf
/orahome/dbs/fin/fin02.dbf
/orahome/dbs/hr/hr01.dbf
/orahome/dbs/hr/hr02.dbf
8. Followtherestofthegeneraloutlinefortransportingtablespaces:
a. PlugthetablespaceintothenewdatabasewiththeImportutility.
b. Ifapplicable,placethetransportedtablespacesintoreadonlymode.
SeeAlso:
OracleDatabaseBackupandRecoveryReference(../../backup.112/e10643/rcmsynta012.htm#RCMRF192)forthesyntaxandsemanticsofthe
CONVERTcommand
CheckingtheDatabaseBeforeCrossPlatformDatabase
Conversion
Asexplainedin"BasicConceptsofCrossPlatformDataTransportation"(#CHDIGEAB),youcanusetheRMANCONVERTDATABASEcommand
toautomatethecopyingofanentiredatabasefromoneplatformtoanother.
Beforeconvertingthedatabase,seethelistofCONVERTDATABASEcommandprerequisitesdescribedinOracleDatabaseBackupand
RecoveryReference.(../../backup.112/e10643/rcmsynta012.htm#RCMRF192)Confirmthatyoumeetalltheseprerequisitesbeforeattemptingthe
procedureinthissection.
Oneprerequisiteisthatboththesourceanddestinationplatformmustsharethesameendianformat.Forexample,youcantransporta
databasefromMicrosoftWindowstoLinuxforx86(bothlittleendian),orfromHPUXtoAIX(bothbigendian),butnotfromHPUXtoLinuxfor
x86(bigendiantolittleendian).
Note:
IfyoucannotusetheCONVERTDATABASEcommandbecausetheplatformsdonotshareendianformats,thenyoucancreatea
databaseonadestinationplatformmanuallyandtransportneededtablespacesfromthesourcedatabasewithcrossplatform
transportabletablespaces.
Whenyoutransportentiredatabases,notethatcertainfilesrequireRMANconversiontoensurecompatibilitywiththedestinationplatform.
Eventhoughtheendianformatsforthesourceanddestinationplatformarethesame,thesefilescannotbesimplycopiedfromthesourceto
thedestinationsystem.ThefollowingkindsoffilesrequireRMANconversion:
Anyfilecontainingundosegments
Anyfilecontainingautomaticsegmentspacemanagement(ASSM)segmentheadersthatisbeingtransportedtoorfromtheHPTru64
platform
TheCONVERTDATABASEcommand,bydefault,processesalldatafilesinthedatabaseusingRMANconversion.TheRMANconversion
copiesthefilesfromonelocationtoanother,evenwhenitdoesnotmakeanychangestothefile.Ifyouhaveotherpreferredmeanstocopy
thosefilesthatdonotrequireRMANconversion,youcanusetheSKIPUNNECESSARYDATAFILESoptionoftheCONVERTDATABASE
command.Ifyouselectthisoption,thentheCONVERTDATABASEcommandonlyprocessesthekindsoffilespreviouslymentioned.Allother
filesmustbecopiedbytheuserfromthesourcetothedestinationdatabase.
Thefilesshouldbecopiedwhilethesourcedatabaseisopeninreadonlymode.Similarly,iftheconversionisperformedatthedestination,all
datafilesshouldbecopiedtothedestinationwhenthesourcedatabaseisopeninreadonlymode.
Topreparefordatabaseconversion:
1. StartaSQL*PlussessionasSYSDBAonthesourcedatabase.
2. Openthedatabaseinreadonlymode.
ALTERDATABASEOPENREADONLY
3. EnsurethatserveroutputisoninSQL*Plus.
Forexample,enterthefollowingSQL*Pluscommand:
SETSERVEROUTPUTON
4. ExecutetheDBMS_TDB.CHECK_DBfunction.
Thischeckensuresthatnoconditionswouldpreventthetransportofthedatabase,suchasincorrectcompatibilitysettings,indoubtor
activetransactions,orincompatibleendianformatsbetweenthesourceplatformanddestinationplatform.
YoucancallCHECK_DBwithoutargumentstoseeifaconditionatthesourcedatabasepreventstransport.Youcanalsocallthis
functionwiththeargumentsshowninTable271(#CHDDHABI).
Table271CHECK_DBFunctionParameters
Parameter Description
target_platform_name Thenameofthedestinationplatformasitappearsinthe
V$DB_TRANSPORTABLE_PLATFORM
(../../server.112/e40402/dynviews_1109.htm#REFRN30376)view.
Thisparameterisoptional,butisrequiredwhenthe
skip_optionparameterisused.Ifomitted,itisassumedthat
thedestinationplatformiscompatiblewiththesourceplatform,
andonlytheconditionsnotrelatedtoplatformcompatibilityare
tested.
skip_option Specifieswhich,ifany,partsofthedatabasetoskipwhen
checkingwhetherthedatabasecanbetransported.Supported
values(oftypeNUMBER)are:
SKIP_NONE(or0),whichchecksalltablespaces
SKIP_OFFLINE(or2),whichskipscheckingdatafilesin
offlinetablespaces
SKIP_READONLY(or3),whichskipscheckingdatafilesin
readonlytablespaces
Example271(#CHDGHFJE)illustratesexecutingCHECK_DBona32bitLinuxplatformfortransportingadatabaseto32bitWindows,
skippingreadonlytablespaces.
Example271ExecutingDBMS_TDB.CHECK_DB
DECLAREdb_readyBOOLEANBEGINdb_ready:=DBMS_TDB.CHECK_DB('MicrosoftWindowsIA(32
bit)',DBMS_TDB.SKIP_READONLY)END/PL/SQLproceduresuccessfullycompleted.
Ifnowarningsappear,orifDBMS_TDB.CHECK_DBreturnsTRUE,thenyoucantransportthedatabase.ProceedtoStep6.
Ifwarningsappear,orifDBMS_TDB.CHECK_DBreturnsFALSE,thenyoucannotcurrentlytransportthedatabase.ProceedtoStep5.
5. Examinetheoutputtolearnwhythedatabasecannotbetransported,fixtheproblemifpossible,andthenreturntotheStep4.Seethe
DBMS_TDB(../../appdev.112/e40758/d_tdb.htm#ARPLS650)documentationfortheconditionspresent.
6. ExecutetheDBMS_TDB.CHECK_EXTERNALfunctiontoidentifyanyexternaltables,directories,orBFILEs.RMANcannotautomatethe
transportofthesefiles,soyoumustcopythefilesmanuallyandrecreatethedatabasedirectories.
Example272(#CHDIADJF)showshowtocalltheDBMS_TDB.CHECK_EXTERNALfunction.
Example272ExecutingDBMS_TDB.CHECK_EXTERNAL
DECLAREexternalBOOLEANBEGIN/*valueofexternalisignored,butwithSERVEROUTPUTsettoON*
dbms_tdb.check_externaldisplaysreportofexternalobjects*onconsole*/external:=
DBMS_TDB.CHECK_EXTERNALEND/
Ifnoexternalobjectsexist,thentheprocedurecompleteswithnooutput.Ifexternalobjectsexist,however,thentheoutputissimilarto
thefollowing:
Thefollowingexternaltablesexistinthedatabase:SH.SALES_TRANSACTIONS_EXTThefollowing
directoriesexistinthedatabase:SYS.DATA_PUMP_DIR,SYS.MEDIA_DIR,SYS.DATA_FILE_DIR,
SYS.LOG_FILE_DIRThefollowingBFILEsexistinthedatabase:PM.PRINT_MEDIAPL/SQLprocedure
successfullycompleted.
ConvertingDataFilesontheSourceHostWhenTransportinga
Database
Whenyoutransportentiredatabases,certaintypesofblocks,suchasblocksinundosegments,mustbereformattedtoensurecompatibility
withthedestinationplatform.Eventhoughtheendianformatsforthesourceanddestinationplatformarethesame,thedatafilesfora
transportabledatabasemustundergoaconversionprocess.Youcannotsimplycopydatafilesfromoneplatformtoanotherasyoucanwhen
transportingtablespaces.
DatafileswithundoinformationandthosefromtheHPTru64platformmustbeconverted.Bydefault,alldatafilesareconvertedwhenthe
CONVERTDATABASEcommandisexecuted.If,however,SKIPUNNECESSARYDATAFILESisusedintheCONVERTDATABASEcommand,then
thedatafileswithundosegmentsandthosefromtheHPTru64platformareconverted.Thedatafileswithoutundosegmentscanbecopied
tothenewdatabaseusingFTP,anoperatingsystemcopycommand,orsomeothermechanism.
ThissectionassumesthatyouhavealreadymetalloftheCONVERTDATABASEprerequisitesandfollowedthestepsin"Checkingthe
DatabaseBeforeCrossPlatformDatabaseConversion"(#CHDJAAHJ).Thegoalofthisprocedureistoconverttheformatofdatafilesonthe
sourcehostaspartofacrossplatformdatabasetransport.
AssumethatyouwanttoconvertadatabaserunningonSolaristoadatabasethatrunsonWindows.
Toconvertthedatabaseonthesourceplatform:
1. Openthesourcedatabaseinreadonlymode.
ALTERDATABASEOPENREADONLY
2. StartRMANandconnecttothesourcedatabaseasTARGET.Forexample,enterthefollowingcommands:
%rmanRMAN>CONNECTTARGETSYS@source_db
3. RuntheCONVERTDATABASEcommand.
Example273(#CHDHADBA)showsaCONVERTDATABASEcommand(sampleoutputincluded).TheTRANSPORTSCRIPTparameter
specifiesthelocationofthegeneratedSQLscriptthatyoucanusetocreatethenewdatabase.TheTOPLATFORMparameterindicates
theplatformofthedestinationdatabase.TheDB_FILE_NAME_CONVERTparameterspecifiesthenamingschemeforthegenerateddata
files.
Example273ConvertingaDatabaseontheSourceHost
RMAN>CONVERTDATABASE2>NEWDATABASE'newdb'3>TRANSPORTSCRIPT'/tmp/convertdb/transportscript.sql'
4>TOPLATFORM'MicrosoftWindowsIA(32bit)'5>DB_FILE_NAME_CONVERT'/disk1/oracle/dbs'
'/tmp/convertdb'Startingconvertat25NOV06usingchannelORA_DISK_1Externaltable
SH.SALES_TRANSACTIONS_EXTfoundinthedatabaseDirectorySYS.DATA_PUMP_DIRfoundinthedatabase
DirectorySYS.MEDIA_DIRfoundinthedatabaseDirectorySYS.DATA_FILE_DIRfoundinthedatabase
DirectorySYS.LOG_FILE_DIRfoundinthedatabaseBFILEPM.PRINT_MEDIAfoundinthedatabaseUserSYS
withSYSDBAandSYSOPERprivilegefoundinpasswordfileUserOPERwithSYSDBAprivilegefoundin
passwordfilechannelORA_DISK_1:startingdatafileconversioninputdatafilefno=00001
name=/disk1/oracle/dbs/tbs_01.fconverteddatafile=/tmp/convertdb/tbs_01.fchannelORA_DISK_1:datafile
conversioncomplete,elapsedtime:00:00:15channelORA_DISK_1:startingdatafileconversioninput
datafilefno=00002name=/disk1/oracle/dbs/tbs_ax1.fconverteddatafile=/tmp/convertdb/tbs_ax1.fchannel
ORA_DISK_1:datafileconversioncomplete,elapsedtime:00:00:03...channelORA_DISK_1:starting
datafileconversioninputdatafilefno=00016name=/disk1/oracle/dbs/tbs_52.fconverted
datafile=/tmp/convertdb/tbs_52.fchannelORA_DISK_1:datafileconversioncomplete,elapsedtime:
00:00:01RunSQLscript/tmp/convertdb/transportscript.sqlonthedestinationplatformtocreate
databaseEditinit.orafileinit_00gb3vfv_1_0.ora.ThisPFILEwillbeusedtocreatethedatabaseon
thedestinationplatformTorecompileallPL/SQLmodules,runutlirp.sqlandutlrp.sqlonthe
destinationplatformTochangetheinternaldatabaseidentifier,useDBNEWIDUtilityFinishedbackupat
25NOV06
4. AfterCONVERTDATABASEcompletes,youcanopenthesourcedatabaseread/writeagain.
5. MovethedatafilesgeneratedbyCONVERTDATABASEtothedesiredlocationsonthedestinationhost.
InExample273(#CHDHADBA),thecommandcreatesthefilesinthe/tmp/convertdb/directoryonthesourcehost.Movethesefiles
tothedirectoryonthedestinationhostthatwillcontainthedestinationdatabasefiles.
6. Ifthepathtothedatafilesisdifferentonthedestinationhost,theneditthetransportscripttorefertothenewdatafilelocations.
7. Ifnecessary,edittheinitializationparameterfiletochangeanysettingsforthedestinationdatabase.
Youshouldeditseveralentriesatthetopoftheinitializationparameterfilewhenthedatabaseismovedtothedestinationplatform.For
example,theinitializationparameterfilemaylookasfollows:
#Pleasechangethevaluesofthefollowingparameters:control_files="/tmp/convertdb/cf_DNEWDBT_id
1778429277_00gb9u2s"db_recovery_file_dest="/tmp/convertdb/orcva"db_recovery_file_dest_size=
10737418240instance_name="NEWDBT"service_names="NEWDBT.example.com"plsql_native_library_dir=
"/tmp/convertdb/plsqlnld1"db_name="NEWDBT"
8. Ifnecessary,editthetransportscripttousethenewnamesfortheconverteddatafiles.
InExample273(#CHDHADBA),thetransportscriptisnamed/tmp/convertdb/transportscript.sql.Yourunthisscriptonthe
destinationhosttocreatethedatabase.Thus,youmusteditthisscriptwiththecorrectnamesforthedatafiles.
9. Onthedestinationhost,startSQL*PlusandconnecttothedestinationdatabaseinstanceasSYSDBAusingoperatingsystem
authentication.
Forexample,connectasfollows:
SQL>CONNECT/ASSYSDBA
Ifyouchoosenottouseoperatingsystemauthentication,thenyoumustfirstconfigureOracleNetfiles,createapasswordfile
(glossary.htm#CHDIDFHF),andstartthelistener.Youcanthenconnecttotheinstancewithanetservicename.
10. ExecutethetransportscriptinSQL*Plustocreatethenewdatabaseonthedestinationhost.
SQL>@transportscript
Whenthetransportscriptfinishes,thecreationofthenewdatabaseiscomplete.
ConvertingDataFilesontheDestinationHostWhenTransporting
aDatabase
ThissectionassumesthatyouhavealreadymetalloftheCONVERTDATABASEcommandprerequisitesandfollowedthestepsin"Checking
theDatabaseBeforeCrossPlatformDatabaseConversion"(#CHDJAAHJ).Thegoalofthisprocedureistoconverttheformatofdatafileson
thedestinationhostaspartofacrossplatformdatabasetransport.
Performthedatafileconversioninthefollowingphases:
1. PerformingPreliminaryDataFileConversionStepsontheSourceHost(#CHDDGGAB)
2. ConvertingDataFilesontheDestinationHost(#CHDCAEFA)
PerformingPreliminaryDataFileConversionStepsontheSourceHost
Inthisprocedure,youexecutetheCONVERTDATABASEcommandonthesourcehost.Thiscommandgeneratesaninitializationparameterfile
andscriptsthatyoucaneditforuseonthedestinationhost.Youalsocopytheunconverteddatafilesfromthesourcehosttothedestination
host.
Toperformpreliminarydatafileconversionstepsonthesourcehost:
1. Ensurethatthedatabaseisopeninreadonlymode.
2. StartRMANandconnecttothesourcedatabaseasTARGET.
Forexample,enterthefollowingcommands:
%rmanRMAN>CONNECTTARGETSYS@source_db
3. RuntheCONVERTDATABASEONDESTINATIONPLATFORMcommand.
Example274(#CHDFEJBC)showsasampleCONVERTDATABASEcommand(sampleoutputincluded).TheONDESTINATIONPLATFORM
parameterspecifiesthatanyCONVERTcommandsrequiredfordatafilesshouldbeperformedonthedestinationplatformratherthan
thesourceplatform.TheFORMATparameterspecifiesthenamingschemeforthegeneratedfiles.
Example274ExecutingCONVERTDATABASEONDESTINATIONPLATFORM
RMAN>CONVERTDATABASE2>ONDESTINATIONPLATFORM3>CONVERTSCRIPT'/tmp/convertdb/convertscript
target'4>TRANSPORTSCRIPT'/tmp/convertdb/transportscripttarget'5>NEWDATABASE'newdbt'6>FORMAT
'/tmp/convertdb/%U'Startingconvertat28JAN05usingtargetdatabasecontrolfileinsteadof
recoverycatalogallocatedchannel:ORA_DISK_1channelORA_DISK_1:sid=39devtype=DISKExternaltable
SH.SALES_TRANSACTIONS_EXTfoundinthedatabaseDirectorySYS.DATA_PUMP_DIRfoundinthedatabase
DirectorySYS.MEDIA_DIRfoundinthedatabaseDirectorySYS.DATA_FILE_DIRfoundinthedatabase
DirectorySYS.LOG_FILE_DIRfoundinthedatabaseBFILEPM.PRINT_MEDIAfoundinthedatabaseUserSYS
withSYSDBAandSYSOPERprivilegefoundinpasswordfileUserOPERwithSYSDBAprivilegefoundin
passwordfilechannelORA_DISK_1:startingtocheckdatafilesinputdatafilefno=00001
name=/disk1/oracle/dbs/tbs_01.fchannelORA_DISK_1:datafilecheckingcomplete,elapsedtime:00:00:00
channelORA_DISK_1:startingtocheckdatafilesinputdatafilefno=00002
name=/disk1/oracle/dbs/tbs_ax1.fchannelORA_DISK_1:datafilecheckingcomplete,elapsedtime:00:00:00
channelORA_DISK_1:startingtocheckdatafilesinputdatafilefno=00017
name=/disk1/oracle/dbs/tbs_03.fchannelORA_DISK_1:datafilecheckingcomplete,elapsedtime:00:00:00
...channelORA_DISK_1:startingtocheckdatafilesinputdatafilefno=00015
name=/disk1/oracle/dbs/tbs_51.fchannelORA_DISK_1:datafilecheckingcomplete,elapsedtime:00:00:00
channelORA_DISK_1:startingtocheckdatafilesinputdatafilefno=00016
name=/disk1/oracle/dbs/tbs_52.fchannelORA_DISK_1:datafilecheckingcomplete,elapsedtime:00:00:00
RunSQLscript/tmp/convertdb/transportscripttargetonthedestinationplatformtocreatedatabase
Editinit.orafile/tmp/convertdb/init_00gb9u2s_1_0.ora.ThisPFILEwillbeusedtocreatethedatabase
onthedestinationplatformRunRMANscript/tmp/convertdb/convertscripttargetondestinationplatform
toconvertdatafilesTorecompileallPL/SQLmodules,runutlirp.sqlandutlrp.sqlonthedestination
platformTochangetheinternaldatabaseidentifier,useDBNEWIDUtilityFinishedbackupat28JAN05
ThecommandinExample274(#CHDFEJBC)createsatransportscript,aninitializationparameterfileforthenewdatabase,anda
convertscriptcontainingRMANCONVERTDATAFILEcommandsforeachdatafilebeingconverted.
Note:
CONVERTDATABASEONDESTINATIONPLATFORMdoesnotproduceconverteddatafilecopies.Thecommandonlycreates
scripts.
4. Useanoperatingsystemutilitytocopythefollowingfilestoatemporarylocationonthedestinationhost:
Thedatafilestobeconverted
Theconvertscript
Thetransportscript
Theinitializationfileforthedestinationdatabase
5. Makethesourcedatabaseread/write.
ConvertingDataFilesontheDestinationHost
Thissectionexplainshowtousethescriptcreatedintheprevioussectiontoconvertthedatafilesonthedestinationhost.
Theconvertscriptcreatedinthepreviousphaseusestheoriginaldatafilenamesofthesourcedatabasefiles.TheFORMATparameter
specifiesthenamethatwasgeneratedwiththeFORMATorDB_FILE_NAME_CONVERTparameteroftheCONVERTDATABASEcommand.
Ifthedatafilesofthesourcedatabaseareaccessiblefromthedestinationhostwiththesamepathnames,thensolongasthesource
databaseisreadonlyyoucanruntheconvertscriptonthedestinationhostwithoutanychanges.Forexample,ifthesourceanddestination
hostsbothuseNFStomountadiskcontainingthesourcedatafiles,andifthemountpointforbothhostsis/fs1/dbs/,thennoeditingis
needed.
Toconvertthedatafilesonthedestinationhost:
1. Ifnecessary,edittheconvertscript.
Inthescript,oneCONVERTDATAFILEcommandexistsforeachdatafiletobeconverted.Theconvertscriptshouldindicatethecurrent
temporaryfilenamesoftheunconverteddatafilesandtheoutputfilenamesoftheconverteddatafiles.Atypicalconvertscriptlooks
asfollows:
RUN{CONVERTFROMPLATFORM'LinuxIA(32bit)'PARALLELISM10DATAFILE'/disk1/oracle/dbs/tbs_01.f'
FORMAT'/tmp/convertdb/data_DTV_I1778429277_TSSYSTEM_FNO1_7qgb9u2s'DATAFILE
'/disk1/oracle/dbs/tbs_ax1.f'FORMAT'/tmp/convertdb/data_DTV_I1778429277_TSSYSAUX_FNO2_7rgb9u2s'
DATAFILE'/disk1/oracle/dbs/tbs_03.f'FORMAT'/tmp/convertdb/data_DTV_I1778429277_TSSYSTEM_FNO
17_7sgb9u2s'DATAFILE'/disk1/oracle/dbs/tbs_51.f'FORMAT'/tmp/convertdb/data_DTV_I1778429277_TS
TBS_5_FNO15_8egb9u2u'DATAFILE'/disk1/oracle/dbs/tbs_52.f'FORMAT'/tmp/convertdb/data_DTV_I
1778429277_TSTBS_5_FNO16_8fgb9u2u'}
EditeachDATAFILEcommandintheconvertscripttospecifythetemporarylocationofeachdatafileasinput.Also,edittheFORMAT
parameterofeachcommandtospecifythedesiredfinallocationofthedatafilesofthetransporteddatabase.
2. Ifnecessary,edittheinitializationparameterfileonthedestinationhosttochangesettingsforthedestinationdatabase.
Youshouldeditseveralentriesatthetopoftheinitializationparameterfilebeforemovingthedatabasetothedestinationplatform.For
example,theinitializationparameterfilemaylookasfollows:
#Pleasechangethevaluesofthefollowingparameters:control_files="/tmp/convertdb/cf_DNEWDBT_id
1778429277_00gb9u2s"db_recovery_file_dest="/tmp/convertdb/orcva"db_recovery_file_dest_size=
10737418240instance_name="NEWDBT"service_names="NEWDBT.example.com"plsql_native_library_dir=
"/tmp/convertdb/plsqlnld1"db_name="NEWDBT"
3. Onthedestinationhost,useSQL*PlustostartthedatabaseinstanceinNOMOUNTmode.
Specifytheinitializationparameterfilethatyoucopiedintheprecedingstep.Forexample,enterthefollowingcommand:
SQL>STARTUPNOMOUNTPFILE='/tmp/init_convertdb_00i2gj63_1_0.ora'
4. StartRMANandconnecttothedestinationdatabase(notthesourcedatabase)asTARGET.Forexample,enterthefollowing
command:
%rmanRMAN>CONNECTTARGETSYS@prod_dest
5. RuntheconvertscriptattheRMANprompt.Forexample,enterthefollowingcommand:
RMAN>@/tmp/convertdb/convertscripttarget
6. Shutdownthedatabaseinstance.
ThisstepisnecessarybecausethetransportscriptthatmustexecutealreadyincludesaSTARTUPNOMOUNTcommand.
7. Ifnecessary,editthetransportscripttousethenewnamesfortheconverteddatafiles.
InExample273(#CHDHADBA),thetransportscriptis/tmp/convertdb/transportscript.sql.Yourunthisscriptonthedestination
hosttocreatethedatabase.Thus,youmusteditthisscriptwiththecorrectnamesforthedatafiles.
8. ExecutethetransportscriptinSQL*Plus.
Forexample,createthenewdatabaseonthedestinationhostasfollows:
SQL>@/tmp/convertdb/transportscript
Whenthetransportscriptcompletes,thedestinationdatabaseiscreated.
(#)