Professional Documents
Culture Documents
0 DatabaseMigration
www.sybase.com
Contents
Introduction..................................................................................................................................................3 Prerequisites.................................................................................................................................................3 EmbeddedIQ12.7engine ............................................................................................................................4 . Newmigrationtooliqunload.....................................................................................................................4 Schemaunloadmode...................................................................................................................................5 Databasemigrationmode............................................................................................................................5 Databasemigrationprocessoverview..........................................................................................................6 Migrationexample........................................................................................................................................7 Beforeandaftermigrationfiles....................................................................................................................9 Postmigrationdataverification....................................................................................................................9
Principal Author
MarkDeLaFranier delafran@sybase.com
Revision History
Version1.0July2009
SybaseIQ15.0DatabaseMigration Version1.0July2009
Introduction
SybaseIQ15.0includesmanynewfeatures:enhancedmultiplexcapabilities,tablespacesanddata partitioningthatsupportInformationLifecycleManagement(ILM)capabilitiesandextensivequery parallelism.Additionally,itsclassleadingperformancehasalsobeensignificantlystrengthened.To achievethis,partsoftheserverhaveundergonesubstantialchanges;inthecaseofthecatalogstore;a newstorageformathasbeenadopted. ThecatalogstoreinSybaseIQ12.7workedwithallearlierversionsoftheproduct;theserverincluded logicthatsupportedallfunctionalityineachearlierversion.Databasemigrationwasstraightforward userssimplyperformedanalterdatabaseupgradewhenupgradingtothenextversionofSybaseIQ. Thissimpleprocesswascalledupgradingthedatabase.Fromanengineeringperspective,however,the supportforlegacyversionsimposedseverelimitations,makingitcumbersometodelivernewand innovativefeatures.Additionally,legacycodealsorestrictedthetypeofoptimizationsthatcouldbe performed. AspartoftheupgradetoSybaseIQ15.0,adatabasefilemigrationisnowrequired,ratherthanasimple databaseupgrade.AnewfullyautomatedmigrationtooliqunloadincludedwithSybaseIQ15.0,re createsthecatalogstoreandreloadsitwiththeexistingdatabaseschemametadata.Onlythecatalogis recreated;theIQdataandtempdbspacesarenotchanged. Themigrationprocessiscompletelyautomated,selfcontained,anddoesnotrequireyourexisting SybaseIQ12.7software.Thereareafewpremigrationstepsyouneedtofollowtoensureasmoothand errorfreemigration. TheremainderofthisdocumentdiscussesthehighlightsofdatabasemigrationtoSybaseIQ15.0. Note:Ifyouaremigratinga12.7multiplexdatabase,seeChapter5,MigratingData,intheInstallation andConfigurationGuideforadditionalinstructions.Therearesomekeypreandpostmigrationsteps thatamultiplexrequires.
Prerequisites
iqunloadhastwoworkingmodes:schemaunloadandmigration.Migrationmodeusesaspecialengine bundledwithSybaseIQ15.0,anddoesnotrequireanyearlierversionsofSybaseIQ.Schemaunload moderequiresthatthedatabaseberunninginanexistingSybaseIQserver12.6ESD#11,orlater,or SybaseIQ12.7ESD#5,orlater.SchemaunloadisnotsupportedwithIQ15.0orlaterservers.
SybaseIQ15.0DatabaseMigration Version1.0July2009
EmbeddedIQ12.7engine
ThespecialdatabaseenginethatcomeswithSybaseIQ15.0iscalledtheunloadsupportengine iqunlspt.TheunloadsupportengineisaselfcontainedsubsetoftheSybaseIQ12.7(ESD#5) databaseengine. ThisengineisinstalledwhenyouinstallSybaseIQ15.0worksonlywiththemigrationtoolinan embeddedmannerthatis,itrunsinthebackgroundandcontainsnoconsoleorGUIwindow.When yourunthemigrationtool,youwillseetheiqunlsptprocessrunning. iqunlsptacceptsstartupargumentsifyourdatabaserequiresspecialswitchesormemorysettings.This isusefulforprovidingdiagnosticswitches,suchaszorzr,whiletroubleshooting.Sincethemigration processrecreatesonlyyourdatabaseschema,itisunlikelythatyouwillneedtosetanycommandline argumentsfortheunloadsupportengine.
Newmigrationtooliqunload
iqunloadhasthesamelookandfeelasotherIQcommandlinetools.Italsoacceptsthesameformatfor commandlinearguments.Forexample,itacceptsthesamenetworkconnectivityoptionsviac,as dbisqlordbping. Unlikealterdatabaseupgrade,iqunloadmigratesdatabaseoptions.Duringmigration,allexisting databaseoptionsforwhichvaluesarenolongerthedefaultvaluearesaved,andanewdatabaseis createdwithSybaseIQ15.0options.Afterwards,thesavedoptionsareapplied,overwritinganySybase IQ15.0options.OptionsthatarenolongeravailableinSybaseIQ15.0areignored. Rememberthatonlythecatalogisrecreated;noexistingdataintheIQdatastoresareaffectedor changed.Asanextraprecaution,dbspacesareopenedinreadonlymodeduringthemigrationprocess. ThisprovidesawindowofopportunityduringwhichyoucanrevertbacktoSybaseIQ12.7/12.6inthe eventoffailure. iqunloadhastwomodesofoperation: Schemaunloadmode Migrationmode
Thefollowingsectionsdiscussthedifferencesbetweenthesetwomodes.
SybaseIQ15.0DatabaseMigration Version1.0July2009
Schemaunloadmode
TheschemaunloadmoderesultsiniqunloadgeneratingareloadSQLfilethatcontainsalltheSQL statementsnecessarytorecreatetheschemaforadatabase.Youcanuseschemaunloadmodeto createanemptyversionofadatabase.Whenyouexecuteiqunloadinschemaunloadonlymode,using thecommandlineargumentn,afilethatcontainsalltheSQLnecessarytocreatethedatabaseschema iscreated. OncetheschemaSQLfileisgenerated,manuallycreateanewdatabaseandexecutethegeneratedSQL file.Nodataismigrated.Tomigratedataintothenewdatabase,manuallyextractthedatafromyour olderdatabaseandmanuallyloaditintothenewdatabase. TheschemaunloadmodedoesnotusethespecialunloadsupportenginethatcomeswithSybaseIQ 15.0.Toruntheschemaunloadmode,youmustconnecttoyourexistingSybaseIQdatabaseserver.In addition,youmustcopythreesupportingSQLfilesfromyourSybaseIQ15.0installationtoyourearlier versionserver.SeeChapter6,MigratingDataintheSybaseIQ15.0InstallationandConfiguration Guide.
Databasemigrationmode
UsedatabasemigrationmodetomigrateadatabasetoSybaseIQ15.0.Duringmigration,iqunload automaticallyusestheunloadsupportenginetostartyourexistingdatabase,thenusestheSybaseIQ 15.0servertorecreatethecatalogstore.iqunloadinterfaceswithbothdatabaseenginestocarryout themigrationinanautomatedfashion. iqunload: 1. StartstheSybaseIQ12.7/12.6databasewiththeunloaddatabaseengine. 2. Performsvariousinternaldatabasechecks. 3. Determinesifthedatabaseisamultiplexwriteserver,inwhichcasesomeextrastepsaretaken tomigratethewritertoanIQ15.0coordinator. 4. Generatestheschema(similartoschemaunloadmode). 5. StartstheSybaseIQ15.0server. 6. Createsanewdatabase.
SybaseIQ15.0DatabaseMigration Version1.0July2009 5
Databasemigrationprocessoverview
Withtheunloadsupportengine,theSybaseIQ15.0databaseserver,andiqunload,youarereadyto beginthemigrationprocess.Eventhoughiqunloadisautomated,thereareseveralstepsyoumust manuallyperform,toensuretherearenopreorpostmigrationdataerrors.Thesestepsalsoprovide youtheopportunitytocreateabackupofthedatabaseandtocheckforobjectsthatarenolonger supportedinSybaseIQ15.0. Themigrationprocessstepsare: 1. StartyourexistingdatabasewithSybaseIQ12.7/12.6andverifyyourdatabaseiscleanand errorfreebycallingthesp_iqcheckdbstoredprocedure. 2. UsetheSQLbackupcommandtobackuptheSybaseIQ12.7database. 3. Checkforunsupportedobjecttypes.SeeChapter6,MigratingData,intheSybaseIQ15.0 InstallationandConfigurationGuide. 4. ShutdowntheSybaseIQ12.7/12.6serversthatareusingthedatabase. 5. Runiqunloadautomigratethedatabase. 6. StartthemigrateddatabaseinreadonlymodewiththeSybaseIQ15.0server,andperform somedataverificationchecks.Ifthereisanerror,youcanreverttothepreviousdatabaseas longasyoudonotperformstep7.SeethefollowingsectionPostmigrationDataVerification forfurtherdetails. 7. Ifstep6hasnoerrors,restartthedatabaseinwritemodewithSybaseIQ15.0server. FollowingthesestepsresultsinamigrateddatabasethatisreadyforSybaseIQ15.0.
SybaseIQ15.0DatabaseMigration Version1.0July2009 6
Migrationexample
Assumingyouhavecheckedyourdatabaseforerrors,performedasuccessfulbackup,andshutdown downtheSybaseIQ12.7/12.6serverrunningthedatabase(steps14fromabove)youarereadyto executethemigrationtool. IfyouweregoingtomigratetheSybaseIQ12.7Windowsdemodatabase,thecommandis: iqunloadauc"dbf=%ASDIR%\demo\asiqdemo.db;uid=DBA;pwd=SQL" Onlythefullpathtothedatabase,theuserID,andpasswordarerequired. Note:%ASDIR%istheWindowsenvironmentvariable,forUNIX,use$ASDIR. Yousee: Iqunloadoutput
Sybase IQ Unload Utility Version 15.0.0.5120 Connecting and initializing Unloading user and group definitions Unloading table definitions Unloading index definitions Unloading functions Unloading view definitions Unloading procedures Unloading triggers Unloading SQL Remote definitions Unloading MobiLink definitions Creating new database Reloading user and group definitions Reloading table definitions Reloading index definitions Reloading functions Reloading view definitions Reloading procedures Reloading triggers Reloading SQL Remote definitions Reloading MobiLink definitions Successfully backed up file "d:\sybase\asiq-12.7\demo\asiqdemo.db" by renaming it to "d:\sybase\asiq-12.7\demo\asiqdemo.db.before_schema_reload". Successfully backed up file "d:\sybase\asiq-12.7\demo\asiqdemo.iqmsg" by renaming it to "d:\sybase\asiq-12.7\demo\asiqdemo.iqmsg.before_schema_reload". Successfully reloaded schema of database "d:\sybase\asiq-12.7\demo\asiqdemo.db".
Theaboveoutputcorrespondstothedifferentstepsiqunloadperforms.Younextsee:
Connecting and initializing
SybaseIQ15.0DatabaseMigration Version1.0July2009 7
iqunloadstartsboththeunloadsupportengineonthedatabase,andaSybaseIQ15.0utilityserver. Oncebothserversarerunning,variousdatabasechecksareperformedagainstyourolddatabase.
Unloading Unloading Unloading Unloading Unloading Unloading Unloading Unloading Unloading user and group definitions table definitions index definitions functions view definitions procedures triggers SQL Remote definitions MobiLink definitions
SybaseIQ15.0DatabaseMigration Version1.0July2009
Successfully backed up file "d:\sybase\asiq-12.7\demo\asiqdemo.iqmsg" by renaming it to "d:\sybase\asiq-12.7\demo\asiqdemo.iqmsg.before_schema_reload". Successfully reloaded schema of database "d:\sybase\asiq-12.7\demo\asiqdemo.db".
Finally,iqunloadperformsafilesystembackupofyourexistingcatalogrelatedfiles.Theseare operatingsystemfiles,andnotaresultofSQLbackupdatabasecommand.
Beforeandaftermigrationfiles
ThefollowtableliststhefilesthatarepartoftheIQ12.7demodatabase,andwhatthecorresponding filesareaftermigration. Before After Description asiqdemo.db asiqdemo.db.before_schema_reload TheIQ12.7catalogdatabase.This fileiscopiedattheOSlevelupon successfulmigration;itisnota resultoftheSQLbackupcommand. asiqdemo.log asiqdemo.log Thedatabaselogfileisregenerated whenthemigrateddatabaseisused withtheIQ15.0server. asiqdemo.iq asiqdemo.iq TheoldIQ12.7IQ_SYSTEM_MAIN dbspace.Thisfileandallotheruser dbspacesarenotaffectedbythe migrationprocess.Thisdbspaceis addedasafiletoausermain dbspace. asiqdemo.iqtmp asiqdemo.iqtmp TheIQ_SYSTEM_TEMPdbspace.No operationsareperformedonthis dbpaceduringmigration.Thisfile becomestheIQ15.0database temporarystore. asiqdemo.iqmsg asiqdemo.iqmsg.before_schema_reload TheIQ12.7messagefile.Thisfileis copiedattheOSlevelupon successfulmigration. asiqdemo.db ThenewIQ15.0migratedcatalog database. new_main_store.iq ThenewIQ_SYSTEM_MAINdbspace forthemigrateddatabase.
Postmigrationdataverification
SybaseIQ15.0DatabaseMigration Version1.0July2009 9
Sybaserecommendsthatyoumanuallyperformthesepostmigrationdatacheckswhilethedatabase remainsinreadonlymode: sp_iqcheckdb() select(s)onyourtables Ifyouencounteraproblemwhileperformingthesedatacheckswiththedatabaseinreadonlymode, youcanrevertbacktotheIQ12.7catalogbysimplycopyingallthe.before_schema_reloadfilesto thesamefilewithoutthe.before_schema_loadfileextension. Onceyouhavesuccessfullyperformedthereadonlychecks,stopthedatabaseserverandrestartitin writemode. Note:Whenyoustartthemigrateddatabaseinwritemode,SybaseIQ15.0flagsthedatabasefilesas 15.0,andIQ12.xserverscannolongerusethedatabasefiles.Toreturntoversion12.x,youmustfully restoretheolderdatabase. SeeChapter6,MigratingData,intheSybaseIQ15.0InstallationandConfigurationmanualfor additionalpostmigrationdetails. Congratulations,younowhaveamigrateddatabaseandarereadytoexplorethenewfeaturesof SybaseIQ15.0!
SybaseIQ15.0DatabaseMigration Version1.0July2009
10
11