Thông tin tài liệu
Technical Note
Copyright © 2008 VMware, Inc. All rights reserved. 1
VirtualCenter Database Maintenance
VirtualCenter 2.0.x and Microsoft SQL Server
ThisdocumentdiscusseswaystomaintaintheVirtualCenterdatabaseforincreasedperformanceand
manageability.ItcoversallversionsofVirtualCenter2.0.x.Therecommendationsinthisdocumentpertain
specificallytoMicrosoftSQLServer2000,buttheconceptsandpracticesworkequallywellwithSQLServer
2005.Thisdocumentassumesthereaderhas
aworkingknowledgeofSQLServer.
Thisdocumentcoversthefollowingtopics:
“Installation”onpage 1
“BackupandRecovery”onpage 6
“ReducingDatabasePrivilegesafterInstallationforHigherSecurity”onpage 17
“Performance”onpage 17
“PurgingOldData”onpage 21
“EnablingAutomaticStatistics”onpage 21
“UpgradingtoaNewVersionofSQLServer”onpage 21
“AppendixA:PurgingOldDatabaseRecords”onpage 21
“AppendixB:AutomatingConnectionstoESXServerHosts”onpage 21
“References”onpage 21
ForfurtherinformationonmaintainingaSQLServerdatabase,see“References”onpage 21orconsulta
trainedSQLServerdatabaseadministrator.
Installation
WhensettingupthedatabaseforusebyVirtualCenter,observetheprinciplesdescribedinthefollowing
sections.
Use Supported Versions of the Database and the ODBC Drivers
ItisimportanttouseonlysupportedversionsofMicrosoftSQLServ erwithVirtualCenter.Besurethatboth
thedatabaseversionandtheODBCdriverversionaresupportedfortheparticularversionofVirtualCenter
youareusing.
ChecktheproductcompatibilityguidesforthelatestinformationonsupporteddatabaseandODBC
driver
versions.SupportfornewversionsisoftenaddedwithpatchorupdatereleasesofVirtualCenter ,sobesure
tocheckthecompatibilityguideandreleasenoteswheneveryouupgradeVirtualCenter.
IfyouareusingSQLServer2005,followthespecialsetupinstructionsinVMwareknowledgebasearticle
6565318,“Requirementsfor
RunningVirtualCenterwithMSSQL2005.”Foralinktothisarticle,see
“References”onpage 21.
Copyright © 2008 VMware, Inc. All rights reserved. 2
VirtualCenter Database Maintenance
Separating Critical Files onto Separate Drives
WhencreatingtheSQLServerdatabases,makesurethedatabaseandtransactionlogfilesareplacedon
separatephysicaldrives.Youshouldalsoplacethetempdbdatabaseonaseparatephysicaldriveifpossible.
ThisarrangementdistributestheI/Otothedatabaseanddramaticallyimprovesitsperformance.Ifathird
drive
isnotfeasible,placethetempdbfilesonthetransactionlogdrive.
Sizing the Database Using the VirtualCenter Database Sizing Calculator
TheVirtualCenterDatabaseSizingCalculatorisanExcel‐formatspreadsheetthatestimatesthesizeofthe
databaseaccordingtospecificationsyouenter.Youneedtospecifythenumberofhostsandvirtualmachines
youexpectyourinstallationtoincludeplussomeadditionalinformationonthenumberofdevicesperhost
and
virtualmachine.Youmuchalsospecifywhichstatisticscollectionlevelyouplantouse,becausethishas
anextremelylargeimpactonthesizeofthedatabase.Thespreadsheetusesthisdatatoestimatethesizeto
whichthedatabaseisexpectedtogrowafteroneyear.Thespreadsheetalso
providesupperandlowerbounds
onthisestimate,aswellastheexpectedmaximumsizeofthetempdbdatabase,whichisusedduringthe
calculationofaveragesandotherroll‐upvalues.
VMwarerecommendsthatyouleavetheautogrowoptiononandperiodicallymonitorthesizeofthedatabase,
toensure
thatyoucandetectanyproblemswithdatabasegrowthwithoutterminatingVirtualCenter
unexpectedly.VMwaredoesnotrecommendoperatingatstatisticscollectionlevel3or4forextendedperiods
oftime.Formoreinformation,seethepaper“VirtualCenterMonitoringandPerformanceStatistics.”
Tocheckthestatusofstatisticsrollup,youcandownload
ascriptfromtheVMwareWebsite.Whenyourun
thescriptagainstyourdatabase,ittellsyouifthereareanyoutstandingrecordsthatwerenotrolledupdur i ng
theappropriaterollupperiod.Youcanusethisscripttodetermineifdatabaseperformanceorconfiguration
issuesarepreventingstatisticsrollups
fromoperatingproperly.Fordetailsandadownloadlink,seeVMware
knowledgebasearticle3034858,“StatisticsRollupStoredProcedures‐OptionalParametersandDiagnostics.”
Foralinktothisarticle,see“References”onpage 21.
Selecting the Appropriate Database Recovery Model
SQLServerusestransactionlogstorecordchangesmadetothedatabase.Intheeventoffailure,itusesthese
logstorecoverthelateststateofthedatabase.Whenanyinformationinadatabaseischanged,SQLServerfirst
writesthechangetothetransactionlog,thencommitsthetransaction.
Itwritesthechangetothedatabaseitself
onlywhenacheckpointoccurs.SQLServerperiodicallyinitiatesacheckpointforeachdatabase.Duringa
checkpoint,SQLServerwritesallcommittedtransactionstothedatabaseitself.
TherecoverymodelyouuseinSQLServeraffectsthenumberofchangesthatarerecorded.
Thesettingalso
greatlyaffectsthesizeofthetransactionlogs.Setthedatabaserecoverymodelaccordingtoyourbusiness
continuityneeds,operationalprocedures,anddiskspacelimitations.
Whenyousettherecoverymodeltofull,SQLServerfullylogsalloperationsofthedatabase.Thetransaction
logscontinuegrowinguntil
youperformabackupofthedatabaseandthetransactionlogs.Therateofgrowth
dependsonthetransactionvolumeofthedatabase.IntheVirtualCenterdatabase,thetransactionvolumeis
determinedbythenumberofhostsandvirtualmachinesyouaremanagingwithVirtualCenter .Ifyousetthe
recovery
modeltofull,youmustbackupyourdatabaseandtransactionlogsregularly,orthetransactionlogs
continuetogrowwithoutanylimit.Youcanrecoverthedatabaseeithertothepointoffailureortoaspecific
point,dependingupontheconfiguration.Thisrecoverymodelisusuallyappropriatefora
production
installationofVirtualCenter.
Whenyousettherecoverymodeltosimple,SQLServerlimitsthesizeofthetransactionlogsandrotatesthe
datainthelogstomaintainaspecificsize.However,inthecaseofadatabasecrash,youcanrecoveronlythe
lastfullordifferentialbackup.
ThismodemightbeappropriateifyouareusingVirtualCenterina
demonstrationenvironmentorhavenointentionofbackinguptransactionlogsregularly.
FormoreinformationonSQLServerrecoverymodels,seetheMicrosoftreference“DesigningaBackupand
RestoreStrategy”aswellasVMwareknowledgebasearticle1001046,“SQL
ServerRecoveryModelAffects
TransactionLogDiskSpaceRequirements.”Forlinkstothesearticles,see“References”onpage 21.
Copyright © 2008 VMware, Inc. All rights reserved. 3
VirtualCenter Database Maintenance
Do Not Use the Master Database for VirtualCenter
WhenyouconfigureSQLServer ,besuretocreateaseparatedatabaseforVirtualCenter.Beginningwith
VirtualCenter2.0.2,theVirtualCenterinstallercheckstodetermineifthechosendatasourcename(DSN)
pointstothemasterdatabase.Youcannotcontinueifitdoes.However,earlierversionsofVirtualCenterdo
notperformthis
check.Ifyoudonotcreateaseparatedatabase,VirtualCentercreatesitstablesinthemaster
database.ThisisabadpracticebecauseitmixestheVirtualCentertableswiththeSQLServersystem‐related
tables.
Setting Up a New Database for VirtualCenter
11.GotoStart>AllPrograms>MicrosoftSQLServer>EnterpriseManager.
2 Expandthetree,right‐clickDatabases,andselectNewDatabasefromthecontextmenu.
3EnterthenameofyourdatabaseintheNamefield(VCDBinthisexample).
4Verifythatyourdataandtransactionlogfilesare
locatedontheproperpartitions.See“SeparatingCritical
FilesontoSeparateDrives”onpage 2formoreinformation.Afterconfirmingthelocations,clickOK.
5Right‐clicktheVirtualCenterdatabase(VCDBinthisexample)andselectPropertiesfromthecontext
menu.
6ClicktheOptionstabandselecttheproperrecoverymodelforyour
environment.See“Selectingthe
AppropriateDatabaseRecoveryModel”onpage 2formoreinformation.Aftermakingthisselection,click
OK.
Copyright © 2008 VMware, Inc. All rights reserved. 4
VirtualCenter Database Maintenance
7InEnterpriseManager,expandtheSecurityfolder,right‐clickLogins,andselectNewLoginfromthe
contextmenu.
8Enterthenewlog‐innameintheNamefield(VClogininthisexample),selectSQLServer
Authentication,andenterapasswordinthePasswordfield,thenclickOK.
N
OTEMicrosoftWindowsNTauthenticationisnotsupportedwithremoteSQLServerinstallations.SQL
Serverauthenticationworksequallywellonbothlocalandremoteinstallations.Thismeansthatifyou
decideatalatertimetomovethedatabasetoaremoteSQLServerhost,SQLServerauthenticationallows
youto
dosoinfarfewerstepsbyfollowingthebackupandrestoreprocedureinthisdocumentand
changingtheVirtualCenterSystemDSNtopointtothenewserver.
Copyright © 2008 VMware, Inc. All rights reserved. 5
VirtualCenter Database Maintenance
9ClicktheDatabaseAccesstab,selecttheVirtualCenterdatabase(VCDBinthisexample)andthe
db_ownerdatabaserole,thenclickOK.
10 Re‐enterthepassword,thenclickOK.
Creating a VirtualCenter System DSN on the VirtualCenter Server Host
1GotoStart>AllPrograms>AdministrativeTools>DataSources(ODBC).
2ClicktheSystemDSNtab,clickAdd,selectSQLServer,thenclickFinish.
3EnterappropriatevaluesintheName,Description, andServerfields,thenclickNext.
Copyright © 2008 VMware, Inc. All rights reserved. 6
VirtualCenter Database Maintenance
4 SelectWithSQLSeverauthenticationusingaloginIDandpasswordenteredbyauser,enterthe
VirtualCenterdatabaseloginandpasswordcreatedduringthedatabasesetup,thenclickNext.
5 SelectChangethedefaultdatabasetoandchoosetheVirtualCenterdatabase,clickNext,thenclick
Finish.
6ClickTestDataSource
.Ifthetestissuccessful,adialogboxappearsstating“Testcompleted
successfully.”ClickOK,thenclickOKagaintoexitDataSources.
YourVirtualCenterdatabaseisnowreadyforuse.
Backup and Recovery
Properbackupsarecriticaltodatabasemaintenance.Thissectioncoversbothregular,day‐to‐daybackupsand
thosethatinvolvesavingandrestoringtheentiredatabaseallatonce,aprocedurethatisusefulfordisaster
recoveryormigration.
Scheduling Regular Backups
Toschedulebackupsofthedatabase,launchtheDatabaseMaintenancePlanWizardonSQLServerEnterprise
ManagerorManagementStudio.TherecommendedbackupstrategyforVirtualCenterdatabasesistohavea
fullbackupdailyandanhourlytransactionlogbackupifyouareusingthefullrecoverymodel.Definethe
backup
retentionpolicyaccordingtoyourlocalneeds.Formoreinformationonbackupstrategies,see
“DesigningaBackupandRestoreStrategy”ontheMicrosoftWebsite.Foralinktothisarticle,see
“References”onpage 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.
YoumayneedsomeoralloftheitemslistedbelowtorestoreVirtualCenteranditscomponentsintheevent
ofasystemfailureordisaster.Followyourcompanydisasterrecoveryguidelinesforstorageandhandlingof
theseitems.
InstallationmediaforthesameversionofVirtualCenteryouarerestoring
VMwareInfrastructure3licensefileorrunninglicenseserver
SQLServerbackupfiles
SSLfilesfoundin:C:\Documents and Settings\All Users\Application Data\VMware\VMware
VirtualCenter\SSLontheVirtualCenterhost
Notesfromtheoriginalinstallationregardingtheselections,settings,andinformationused
Steps for Backup and Recovery of the VirtualCenter Database
ThissectionprovidesinstructionsforcreatingabackupoftheVirtualCenterdatabase,thenrestoringthat
databasetoanotherSQLServerhost.Theusecasesforthistwo‐stageprocessinclude:
Disasterrecovery—IftheprimaryVirtualCentersite,includingdatabase,failscatastrophically,youcan
bringupasecondinstanceofVirtualCenterServerwiththemostrecentcopyofthedatabase,allrunning
atasecondarysite.ThisdocumentalsocoversrecoveringtheVirtualCenterdatabaseandVirtualCenter
Serverindependentlydependingonthesituation.
Databasemigration—IfyouneedtomovetheVirtualCenterdatabasetoanotherserver—forexample,to
takeadvantageofbetterhardware—youcanrestorethedataonthenewserver,thenestablisha
connectionformyourexistingVirtualCenterinstallation.
Youcancopydatafromonedatabasetoanotherinseveralways:
BackupfromwithinSQLServer,thenrestoretothenewlocation—Thismethodmaintainsalldatabase
optimizationsandallowsyoutospecifythedatabaseuser,thusavoidinganyproblemswithuserrights.
Thisisthemethoddescribedinthispaperforthebackupandrestoreprocedure.Theseinstructions
assumebothservers
arerunningthesameversionofSQLServer.
UsetheDatabaseCopyWizard—Thismethodcarriesoverthedatabaseoptimizationsbutassumesthat
theoriginaldatabaseuserexistsonthetargetsystemwithallthesamepermissionsasontheoriginal
system
Creating a Backup of the VirtualCenter Database
1MakesureallusersaredisconnectedfromVirtualCenterServer.
2OntheVirtualCenterSeverhost,gotoStart>AllPrograms>AdministrativeTools>Computer
Management>Services.
Copyright © 2008 VMware, Inc. All rights reserved. 8
VirtualCenter Database Maintenance
3 ChoosetheVMwareVirtualCenterServerserviceandclicktheStopbutton.
4OntheSQLServerhost,gotoStart>AllPrograms>MicrosoftSQLServer>EnterpriseManager.
5 ExpandtheservertreeandchooseDatabases.
6Right‐clicktheVirtualCenterdatabase(VCDBinthisexample)andchooseAllTasks>BackupDatabase
fromthecontextmenu.
Copyright © 2008 VMware, Inc. All rights reserved. 9
VirtualCenter Database Maintenance
7IntheSQLServerBackupdialogbox,selectDatabase‐complete,thenunderDestinationclickAdd.
8Enterthebackupfilenameandlocation(C:\Backup.bakforthisexample),thenclickOK.
9ClickOKintheSQLServ erBackupdialogbox.Aprogressindicatorappears,followedbyacompletion
notification.
10 Verifythe
fileexistsinthelocationyouspecified.
11 OntheVirtualCenterSeverhost,gotoStart>AllPrograms>AdministrativeTools>Computer
Management>Services.
12 ChoosetheVMwareVirtualCenterServerserviceandclicktheStartbutton.
Restoring a Backup Copy of the VirtualCenter Database to a Different Server
1CopyyourbackupfiletothenewSQLServerhost(C:\Backup.bakinthisexample).
2OntheVirtualCenterSeverhost,gotoStart>AllPrograms>AdministrativeTools>Computer
Management>Services.
Copyright © 2008 VMware, Inc. All rights reserved. 10
VirtualCenter Database Maintenance
3 ChoosetheVMwareVirtualCenterServerserviceandclicktheStopbutton.
4OnthenewSQLServerhost,gotoStart>AllPrograms>MicrosoftSQLServer>EnterpriseManager.
5 Expandthetree,right‐clickDatabases,andchooseAllTasks>RestoreDatabasefromthecontextmenu.
[...]... 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
Thisdocumentdiscusseswaystomaintainthe VirtualCenter database forincreasedperformanceand
manageability.Itcoversallversionsof VirtualCenter 2.0.x.Therecommendationsinthisdocumentpertain
specificallytoMicrosoftSQLServer2000,buttheconceptsandpracticesworkequallywellwithSQLServer
2005.Thisdocumentassumesthereaderhas
aworkingknowledgeofSQLServer.
Thisdocumentcoversthefollowingtopics:
. 3
VirtualCenter Database Maintenance
Do Not Use the Master Database for VirtualCenter
WhenyouconfigureSQLServer ,besuretocreateaseparate database for VirtualCenter. Beginningwith
VirtualCenter 2.0.2,the VirtualCenter installercheckstodetermineifthechosendatasourcename(DSN)
pointstothemaster database. Youcannotcontinueifitdoes.However,earlierversionsof VirtualCenter do
notperformthis
check.Ifyoudonotcreateaseparate database, VirtualCenter createsitstablesinthemaster
database. Thisisabadpracticebecauseitmixesthe VirtualCenter tableswiththeSQLServersystem‐related
tables.
Setting
Ngày đăng: 23/03/2014, 12:20
Xem thêm: VirtualCenter Database Maintenance docx