1. Trang chủ
  2. » Công Nghệ Thông Tin

VirtualCenter Database Maintenance docx

22 252 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 22
Dung lượng 619,81 KB

Nội dung

Technical Note Copyright © 2008 VMware, Inc. All rights reserved. 1 VirtualCenter Database Maintenance VirtualCenter 2.0.x and Microsoft SQL Server ThisdocumentdiscusseswaystomaintaintheVirtualCenterdatabaseforincreasedperformanceand manageability.ItcoversallversionsofVirtualCenter2.0.x.Therecommendationsinthisdocumentpertain specificallytoMicrosoftSQLServer2000,buttheconceptsandpracticesworkequallywellwithSQLServer 2005.Thisdocumentassumesthereaderhas aworkingknowledgeofSQLServer. Thisdocumentcoversthefollowingtopics:  “Installation”onpage 1  “BackupandRecovery”onpage 6  “ReducingDatabasePrivilegesafterInstallationforHigherSecurity”onpage 17  “Performance”onpage 17  “PurgingOldData”onpage 21  “EnablingAutomaticStatistics”onpage 21  “UpgradingtoaNewVersionofSQLServer”onpage 21  “AppendixA:PurgingOldDatabaseRecords”onpage 21  “AppendixB:AutomatingConnectionstoESXServerHosts”onpage 21  “References”onpage 21 ForfurtherinformationonmaintainingaSQLServerdatabase,see“References”onpage 21orconsulta trainedSQLServerdatabaseadministrator. Installation WhensettingupthedatabaseforusebyVirtualCenter,observetheprinciplesdescribedinthefollowing sections. Use Supported Versions of the Database and the ODBC Drivers ItisimportanttouseonlysupportedversionsofMicrosoftSQLServ erwithVirtualCenter.Besurethatboth thedatabaseversionandtheODBCdriverversionaresupportedfortheparticularversionofVirtualCenter youareusing. ChecktheproductcompatibilityguidesforthelatestinformationonsupporteddatabaseandODBC driver versions.SupportfornewversionsisoftenaddedwithpatchorupdatereleasesofVirtualCenter ,sobesure tocheckthecompatibilityguideandreleasenoteswheneveryouupgradeVirtualCenter. IfyouareusingSQLServer2005,followthespecialsetupinstructionsinVMwareknowledgebasearticle 6565318,“Requirementsfor RunningVirtualCenterwithMSSQL2005.”Foralinktothisarticle,see “References”onpage 21. Copyright © 2008 VMware, Inc. All rights reserved. 2 VirtualCenter Database Maintenance Separating Critical Files onto Separate Drives WhencreatingtheSQLServerdatabases,makesurethedatabaseandtransactionlogfilesareplacedon separatephysicaldrives.Youshouldalsoplacethetempdbdatabaseonaseparatephysicaldriveifpossible. ThisarrangementdistributestheI/Otothedatabaseanddramaticallyimprovesitsperformance.Ifathird drive isnotfeasible,placethetempdbfilesonthetransactionlogdrive. Sizing the Database Using the VirtualCenter Database Sizing Calculator TheVirtualCenterDatabaseSizingCalculatorisanExcel‐formatspreadsheetthatestimatesthesizeofthe databaseaccordingtospecificationsyouenter.Youneedtospecifythenumberofhostsandvirtualmachines youexpectyourinstallationtoincludeplussomeadditionalinformationonthenumberofdevicesperhost and virtualmachine.Youmuchalsospecifywhichstatisticscollectionlevelyouplantouse,becausethishas anextremelylargeimpactonthesizeofthedatabase.Thespreadsheetusesthisdatatoestimatethesizeto whichthedatabaseisexpectedtogrowafteroneyear.Thespreadsheetalso providesupperandlowerbounds onthisestimate,aswellastheexpectedmaximumsizeofthetempdbdatabase,whichisusedduringthe calculationofaveragesandotherroll‐upvalues. VMwarerecommendsthatyouleavetheautogrowoptiononandperiodicallymonitorthesizeofthedatabase, toensure thatyoucandetectanyproblemswithdatabasegrowthwithoutterminatingVirtualCenter unexpectedly.VMwaredoesnotrecommendoperatingatstatisticscollectionlevel3or4forextendedperiods oftime.Formoreinformation,seethepaper“VirtualCenterMonitoringandPerformanceStatistics.” Tocheckthestatusofstatisticsrollup,youcandownload ascriptfromtheVMwareWebsite.Whenyourun thescriptagainstyourdatabase,ittellsyouifthereareanyoutstandingrecordsthatwerenotrolledupdur i ng theappropriaterollupperiod.Youcanusethisscripttodetermineifdatabaseperformanceorconfiguration issuesarepreventingstatisticsrollups fromoperatingproperly.Fordetailsandadownloadlink,seeVMware knowledgebasearticle3034858,“StatisticsRollupStoredProcedures‐OptionalParametersandDiagnostics.” Foralinktothisarticle,see“References”onpage 21. Selecting the Appropriate Database Recovery Model SQLServerusestransactionlogstorecordchangesmadetothedatabase.Intheeventoffailure,itusesthese logstorecoverthelateststateofthedatabase.Whenanyinformationinadatabaseischanged,SQLServerfirst writesthechangetothetransactionlog,thencommitsthetransaction. Itwritesthechangetothedatabaseitself onlywhenacheckpointoccurs.SQLServerperiodicallyinitiatesacheckpointforeachdatabase.Duringa checkpoint,SQLServerwritesallcommittedtransactionstothedatabaseitself. TherecoverymodelyouuseinSQLServeraffectsthenumberofchangesthatarerecorded. Thesettingalso greatlyaffectsthesizeofthetransactionlogs.Setthedatabaserecoverymodelaccordingtoyourbusiness continuityneeds,operationalprocedures,anddiskspacelimitations. Whenyousettherecoverymodeltofull,SQLServerfullylogsalloperationsofthedatabase.Thetransaction logscontinuegrowinguntil youperformabackupofthedatabaseandthetransactionlogs.Therateofgrowth dependsonthetransactionvolumeofthedatabase.IntheVirtualCenterdatabase,thetransactionvolumeis determinedbythenumberofhostsandvirtualmachinesyouaremanagingwithVirtualCenter .Ifyousetthe recovery modeltofull,youmustbackupyourdatabaseandtransactionlogsregularly,orthetransactionlogs continuetogrowwithoutanylimit.Youcanrecoverthedatabaseeithertothepointoffailureortoaspecific point,dependingupontheconfiguration.Thisrecoverymodelisusuallyappropriatefora production installationofVirtualCenter. Whenyousettherecoverymodeltosimple,SQLServerlimitsthesizeofthetransactionlogsandrotatesthe datainthelogstomaintainaspecificsize.However,inthecaseofadatabasecrash,youcanrecoveronlythe lastfullordifferentialbackup. ThismodemightbeappropriateifyouareusingVirtualCenterina demonstrationenvironmentorhavenointentionofbackinguptransactionlogsregularly. FormoreinformationonSQLServerrecoverymodels,seetheMicrosoftreference“DesigningaBackupand RestoreStrategy”aswellasVMwareknowledgebasearticle1001046,“SQL ServerRecoveryModelAffects TransactionLogDiskSpaceRequirements.”Forlinkstothesearticles,see“References”onpage 21. Copyright © 2008 VMware, Inc. All rights reserved. 3 VirtualCenter Database Maintenance Do Not Use the Master Database for VirtualCenter WhenyouconfigureSQLServer ,besuretocreateaseparatedatabaseforVirtualCenter.Beginningwith VirtualCenter2.0.2,theVirtualCenterinstallercheckstodetermineifthechosendatasourcename(DSN) pointstothemasterdatabase.Youcannotcontinueifitdoes.However,earlierversionsofVirtualCenterdo notperformthis check.Ifyoudonotcreateaseparatedatabase,VirtualCentercreatesitstablesinthemaster database.ThisisabadpracticebecauseitmixestheVirtualCentertableswiththeSQLServersystem‐related tables. Setting Up a New Database for VirtualCenter 11.GotoStart>AllPrograms>MicrosoftSQLServer>EnterpriseManager. 2 Expandthetree,right‐clickDatabases,andselectNewDatabasefromthecontextmenu. 3EnterthenameofyourdatabaseintheNamefield(VCDBinthisexample). 4Verifythatyourdataandtransactionlogfilesare locatedontheproperpartitions.See“SeparatingCritical FilesontoSeparateDrives”onpage 2formoreinformation.Afterconfirmingthelocations,clickOK. 5Right‐clicktheVirtualCenterdatabase(VCDBinthisexample)andselectPropertiesfromthecontext menu. 6ClicktheOptionstabandselecttheproperrecoverymodelforyour environment.See“Selectingthe AppropriateDatabaseRecoveryModel”onpage 2formoreinformation.Aftermakingthisselection,click OK. Copyright © 2008 VMware, Inc. All rights reserved. 4 VirtualCenter Database Maintenance 7InEnterpriseManager,expandtheSecurityfolder,right‐clickLogins,andselectNewLoginfromthe contextmenu. 8Enterthenewlog‐innameintheNamefield(VClogininthisexample),selectSQLServer Authentication,andenterapasswordinthePasswordfield,thenclickOK. N OTEMicrosoftWindowsNTauthenticationisnotsupportedwithremoteSQLServerinstallations.SQL Serverauthenticationworksequallywellonbothlocalandremoteinstallations.Thismeansthatifyou decideatalatertimetomovethedatabasetoaremoteSQLServerhost,SQLServerauthenticationallows youto dosoinfarfewerstepsbyfollowingthebackupandrestoreprocedureinthisdocumentand changingtheVirtualCenterSystemDSNtopointtothenewserver. Copyright © 2008 VMware, Inc. All rights reserved. 5 VirtualCenter Database Maintenance 9ClicktheDatabaseAccesstab,selecttheVirtualCenterdatabase(VCDBinthisexample)andthe db_ownerdatabaserole,thenclickOK. 10 Re‐enterthepassword,thenclickOK. Creating a VirtualCenter System DSN on the VirtualCenter Server Host 1GotoStart>AllPrograms>AdministrativeTools>DataSources(ODBC). 2ClicktheSystemDSNtab,clickAdd,selectSQLServer,thenclickFinish. 3EnterappropriatevaluesintheName,Description, andServerfields,thenclickNext. Copyright © 2008 VMware, Inc. All rights reserved. 6 VirtualCenter Database Maintenance 4 SelectWithSQLSeverauthenticationusingaloginIDandpasswordenteredbyauser,enterthe VirtualCenterdatabaseloginandpasswordcreatedduringthedatabasesetup,thenclickNext. 5 SelectChangethedefaultdatabasetoandchoosetheVirtualCenterdatabase,clickNext,thenclick Finish. 6ClickTestDataSource .Ifthetestissuccessful,adialogboxappearsstating“Testcompleted successfully.”ClickOK,thenclickOKagaintoexitDataSources. YourVirtualCenterdatabaseisnowreadyforuse. Backup and Recovery Properbackupsarecriticaltodatabasemaintenance.Thissectioncoversbothregular,day‐to‐daybackupsand thosethatinvolvesavingandrestoringtheentiredatabaseallatonce,aprocedurethatisusefulfordisaster recoveryormigration. Scheduling Regular Backups Toschedulebackupsofthedatabase,launchtheDatabaseMaintenancePlanWizardonSQLServerEnterprise ManagerorManagementStudio.TherecommendedbackupstrategyforVirtualCenterdatabasesistohavea fullbackupdailyandanhourlytransactionlogbackupifyouareusingthefullrecoverymodel.Definethe backup retentionpolicyaccordingtoyourlocalneeds.Formoreinformationonbackupstrategies,see “DesigningaBackupandRestoreStrategy”ontheMicrosoftWebsite.Foralinktothisarticle,see “References”onpage 21. Copyright © 2008 VMware, Inc. All rights reserved. 7 VirtualCenter Database Maintenance What You Need to Restore the VirtualCenter Server and Database After a Disaster. YoumayneedsomeoralloftheitemslistedbelowtorestoreVirtualCenteranditscomponentsintheevent ofasystemfailureordisaster.Followyourcompanydisasterrecoveryguidelinesforstorageandhandlingof theseitems.  InstallationmediaforthesameversionofVirtualCenteryouarerestoring  VMwareInfrastructure3licensefileorrunninglicenseserver  SQLServerbackupfiles  SSLfilesfoundin:C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\SSLontheVirtualCenterhost  Notesfromtheoriginalinstallationregardingtheselections,settings,andinformationused Steps for Backup and Recovery of the VirtualCenter Database ThissectionprovidesinstructionsforcreatingabackupoftheVirtualCenterdatabase,thenrestoringthat databasetoanotherSQLServerhost.Theusecasesforthistwo‐stageprocessinclude:  Disasterrecovery—IftheprimaryVirtualCentersite,includingdatabase,failscatastrophically,youcan bringupasecondinstanceofVirtualCenterServerwiththemostrecentcopyofthedatabase,allrunning atasecondarysite.ThisdocumentalsocoversrecoveringtheVirtualCenterdatabaseandVirtualCenter Serverindependentlydependingonthesituation.  Databasemigration—IfyouneedtomovetheVirtualCenterdatabasetoanotherserver—forexample,to takeadvantageofbetterhardware—youcanrestorethedataonthenewserver,thenestablisha connectionformyourexistingVirtualCenterinstallation. Youcancopydatafromonedatabasetoanotherinseveralways:  BackupfromwithinSQLServer,thenrestoretothenewlocation—Thismethodmaintainsalldatabase optimizationsandallowsyoutospecifythedatabaseuser,thusavoidinganyproblemswithuserrights. Thisisthemethoddescribedinthispaperforthebackupandrestoreprocedure.Theseinstructions assumebothservers arerunningthesameversionofSQLServer.  UsetheDatabaseCopyWizard—Thismethodcarriesoverthedatabaseoptimizationsbutassumesthat theoriginaldatabaseuserexistsonthetargetsystemwithallthesamepermissionsasontheoriginal system Creating a Backup of the VirtualCenter Database 1MakesureallusersaredisconnectedfromVirtualCenterServer. 2OntheVirtualCenterSeverhost,gotoStart>AllPrograms>AdministrativeTools>Computer Management>Services. Copyright © 2008 VMware, Inc. All rights reserved. 8 VirtualCenter Database Maintenance 3 ChoosetheVMwareVirtualCenterServerserviceandclicktheStopbutton. 4OntheSQLServerhost,gotoStart>AllPrograms>MicrosoftSQLServer>EnterpriseManager. 5 ExpandtheservertreeandchooseDatabases. 6Right‐clicktheVirtualCenterdatabase(VCDBinthisexample)andchooseAllTasks>BackupDatabase fromthecontextmenu.  Copyright © 2008 VMware, Inc. All rights reserved. 9 VirtualCenter Database Maintenance 7IntheSQLServerBackupdialogbox,selectDatabase‐complete,thenunderDestinationclickAdd.  8Enterthebackupfilenameandlocation(C:\Backup.bakforthisexample),thenclickOK. 9ClickOKintheSQLServ erBackupdialogbox.Aprogressindicatorappears,followedbyacompletion notification.  10 Verifythe fileexistsinthelocationyouspecified. 11 OntheVirtualCenterSeverhost,gotoStart>AllPrograms>AdministrativeTools>Computer Management>Services. 12 ChoosetheVMwareVirtualCenterServerserviceandclicktheStartbutton. Restoring a Backup Copy of the VirtualCenter Database to a Different Server 1CopyyourbackupfiletothenewSQLServerhost(C:\Backup.bakinthisexample). 2OntheVirtualCenterSeverhost,gotoStart>AllPrograms>AdministrativeTools>Computer Management>Services. Copyright © 2008 VMware, Inc. All rights reserved. 10 VirtualCenter Database Maintenance 3 ChoosetheVMwareVirtualCenterServerserviceandclicktheStopbutton. 4OnthenewSQLServerhost,gotoStart>AllPrograms>MicrosoftSQLServer>EnterpriseManager. 5 Expandthetree,right‐clickDatabases,andchooseAllTasks>RestoreDatabasefromthecontextmenu. [...]... the VirtualCenter System DSN to Use a Restored Database Follow the steps in this section if you need to reestablish the DSN so VirtualCenter uses a restored database NOTE   If the VirtualCenter database was originally set up to use SQL Server authentication and the login and  password are unchanged, updating the VirtualCenter system DSN to use the restored database is all that is  required 1 On the VirtualCenter Server host, go to Start > All Programs > Administrative Tools > Data Source ... Select SQL Server authentication and enter your VirtualCenter database login and password 4 Type the following commands into the Query input box, replacing   with the  appropriate entry for your organization (vcdb is the database in the example shown in the screen shot),  then click Execute Query.  USE GO SELECT * FROM VPX_SEQUENCE Copyright © 2008 VMware, Inc All rights reserved 13 VirtualCenter Database Maintenance. .. VirtualCenter database login was created using the steps outlined in “Setting Up a New Database for  VirtualCenter  on page 3, your original login and user have the same name, because this is the SQL Server  default (see the examples below) Reassociating the VirtualCenter Database User and Login If you do not know your VirtualCenter database user name, see “Finding Orphaned VirtualCenter Database User Names” on page 13.  1 Open SQL Query Analyzer from the Tools menu in Enterprise Manager... Choose the VMware VirtualCenter Server service and click the Start button Copyright © 2008 VMware, Inc All rights reserved 15 VirtualCenter Database Maintenance Installing a New Instance of VirtualCenter to be Used with an Existing Database You may need to install a new instance of VirtualCenter to be used with an existing database if you lose your  original server or if you want to move VirtualCenter to different hardware. The installation described here uses ... Enter the VirtualCenter DSN name you created before starting this installation. Enter the VirtualCenter database login and password, then click Next 9 If your DSN, login, and password are correct, a message about reinitializing the database appears. Click  No Copyright © 2008 VMware, Inc All rights reserved 16 VirtualCenter Database Maintenance 10 If your database is set to the full recovery model (see “Selecting the Appropriate Database Recovery  Model” on page... Appropriate Database Recovery Model” on page 2 for more information. After selecting the recovery  model, click OK Creating a Login for an Existing VirtualCenter Database User Because the database was restored from another server, the users and permissions still exist within the  database but have no corresponding login on this new server, leaving the users orphaned. If the original  VirtualCenter database login was created using the steps outlined in “Setting Up a New Database for ... C:\Backup.bak), click OK, then click OK again.  9 In the Restore database dialog box, click the Options tab and select Force restore over existing database Copyright © 2008 VMware, Inc All rights reserved 11 VirtualCenter Database Maintenance 10 Click OK. A progress indicator appears, followed by a completion notification 11 Right‐click the VirtualCenter database and choose Properties. Click the Options tab and select the proper ... 2008 VMware, Inc All rights reserved 19 VirtualCenter Database Maintenance Choose the VMware VirtualCenter Server service and click the Stop button 2 Reindex the table Enter the following command: USE GO DBCC DBREINDEX ('VPX_HIST_STAT', '', 70) GO Comparison of Defragmentation and Reindexing If you can schedule downtime for the VirtualCenter server to be offline, DBREINDEX generally rebuilds indexes ... VirtualCenter Database Maintenance 3 Close and reopen SQL Server Enterprise Manager to refresh the data throughout the console Finding Orphaned VirtualCenter Database User Names 1 Open SQL Query Analyzer from the Tools menu in Enterprise Manager 2 Type the following commands into the Query input box, replacing   with the  appropriate entry for your organization (vcdb is the database in the example shown in the screen shot), ... automatic process, you must install an exact copy of the SSL certificates from the original VirtualCenter Server  host on the new VirtualCenter Server host. Copy the files found in the following directory from the original  server to the new one: C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\ SSL 1 On your VirtualCenter Server host, set up the system DSN as described in “Creating a VirtualCenter System DSN on the VirtualCenter Server Host” on page . reserved. 1 VirtualCenter Database Maintenance VirtualCenter 2.0.x and Microsoft SQL Server Thisdocumentdiscusseswaystomaintainthe VirtualCenter database forincreasedperformanceand manageability.Itcoversallversionsof VirtualCenter 2.0.x.Therecommendationsinthisdocumentpertain specificallytoMicrosoftSQLServer2000,buttheconceptsandpracticesworkequallywellwithSQLServer 2005.Thisdocumentassumesthereaderhas aworkingknowledgeofSQLServer. Thisdocumentcoversthefollowingtopics: . 3 VirtualCenter Database Maintenance Do Not Use the Master Database for VirtualCenter WhenyouconfigureSQLServer ,besuretocreateaseparate database for VirtualCenter. Beginningwith VirtualCenter 2.0.2,the VirtualCenter installercheckstodetermineifthechosendatasourcename(DSN) pointstothemaster database. Youcannotcontinueifitdoes.However,earlierversionsof VirtualCenter do notperformthis check.Ifyoudonotcreateaseparate database, VirtualCenter createsitstablesinthemaster database. Thisisabadpracticebecauseitmixesthe VirtualCenter tableswiththeSQLServersystem‐related tables. Setting

Ngày đăng: 23/03/2014, 12:20

w