After installing and re-installing VMware vCenter and VUM many times (mostly for testing) all of the manual database creation steps got old pretty fast. So I put some effort into creating a T-SQL script for SQL 2008 that automates most of the tasks.
The T-SQL script below does the following:
1. Adds an existing domain service account for vCenter to SQL. Change the value in the SET command.
2. Grants this account db_owner rights on msdb. Required for vCenter/VUM installation.
3. Creates separate vCenter and VUM databases. Feel free to change their sizes.
4. Sets the ownership of the new databases to the service account.
It’s up to the installer to remove the db_owner rights on the MSDB database after you get done installing vCenter and VUM. I apologize for the line wrapping and weird spacing. It might take a bit of futzing to get it all looking pretty. Of course you will need to tweak the paths and any other information as required.
DECLARE @login_name NVARCHAR(50)
EXEC(‘CREATE LOGIN [‘+@login_name + ‘]FROM WINDOWS’)
EXEC sp_grantdbaccess @login_name
EXEC sp_addrolemember db_owner, @login_name
create database “vCenter Server”
( name = ‘vCenter Server’,
filename = ‘K:DataMSSQLvCenter_server.mdf’,
size = 5000MB,
filegrowth = 250MB )
( name = ‘vCenter Server log’,
filename = ‘L:LogsvCenter_server.ldf’,
size = 200MB,
filegrowth = 20MB )
create database “vCenter Update Manager”
( name = ‘vCenter Update Manager’,
filename = ‘K:DatavCenter_Update_Manager.mdf’,
size = 250MB,
filegrowth = 25MB )
( name = ‘vCenter Update Manger log’,
filename = ‘L:LogsvCenter_Update_Manager.ldf’,
size = 25MB,
filegrowth = 2MB )
EXEC(‘ALTER AUTHORIZATION ON DATABASE::”vCenter server” TO [‘+@login_name + ‘]’)
EXEC(‘ALTER AUTHORIZATION ON DATABASE::”vCenter Update Manager” TO [‘+@login_name + ‘]’)