From the website above do the following in this order:
1. Create a SQL Server Database and User for vCenter Server
2. Set Database Permissions By Manually Creating Database Roles and the VMW Schema
3. Set Database Permissions by Using the dbo Schema and the db_owner Database Role
OR using scripts...make vpxuser has DB Owner
1. Create a SQL Server Database and User for vCenter Server
use [master] go CREATE DATABASE [VCDB] ON PRIMARY (NAME = N'vcdb', FILENAME = N'C:\VCDB.mdf', SIZE = 2000KB, FILEGROWTH = 10% ) LOG ON (NAME = N'vcdb_log', FILENAME = N'C:\VCDB.ldf', SIZE = 1000KB, FILEGROWTH = 10%) COLLATE SQL_Latin1_General_CP1_CI_AS go use VCDB go sp_addlogin @loginame=[vpxuser], @passwd=N'vpxuser!0', @defdb='VCDB', @deflanguage='us_english' go ALTER LOGIN [vpxuser] WITH CHECK_POLICY = OFF go CREATE USER [vpxuser] for LOGIN [vpxuser] go use MSDB go CREATE USER [vpxuser] for LOGIN [vpxuser] go
2. Use a Script to Create a Microsoft SQL Server Database Schema and Roles
Use [VCDB]
CREATE SCHEMA [VMW] go ALTER USER [vpxuser] WITH DEFAULT_SCHEMA =[VMW] go if not exists (SELECT name FROM sysusers WHERE issqlrole=1 AND name = 'VC_ADMIN_ROLE') CREATE ROLE VC_ADMIN_ROLE; GRANT ALTER ON SCHEMA :: [VMW] to VC_ADMIN_ROLE; GRANT REFERENCES ON SCHEMA :: [VMW] to VC_ADMIN_ROLE; GRANT INSERT ON SCHEMA :: [VMW] to VC_ADMIN_ROLE; GRANT CREATE TABLE to VC_ADMIN_ROLE; GRANT CREATE VIEW to VC_ADMIN_ROLE; GRANT CREATE Procedure to VC_ADMIN_ROLE; if not exists (SELECT name FROM sysusers WHERE issqlrole=1 AND name = 'VC_USER_ROLE') CREATE ROLE VC_USER_ROLE go GRANT SELECT ON SCHEMA :: [VMW] to VC_USER_ROLE go GRANT INSERT ON SCHEMA :: [VMW] to VC_USER_ROLE go GRANT DELETE ON SCHEMA :: [VMW] to VC_USER_ROLE go GRANT UPDATE ON SCHEMA :: [VMW] to VC_USER_ROLE go GRANT EXECUTE ON SCHEMA :: [VMW] to VC_USER_ROLE go sp_addrolemember VC_USER_ROLE , [vpxuser] go sp_addrolemember VC_ADMIN_ROLE , [vpxuser] go use MSDB go if not exists (SELECT name FROM sysusers WHERE issqlrole=1 AND name = 'VC_ADMIN_ROLE') CREATE ROLE VC_ADMIN_ROLE; go GRANT SELECT on msdb.dbo.syscategories to VC_ADMIN_ROLE go GRANT SELECT on msdb.dbo.sysjobsteps to VC_ADMIN_ROLE go GRANT SELECT ON msdb.dbo.sysjobs to VC_ADMIN_ROLE go GRANT EXECUTE ON msdb.dbo.sp_add_job TO VC_ADMIN_ROLE go GRANT EXECUTE ON msdb.dbo.sp_delete_job TO VC_ADMIN_ROLE go GRANT EXECUTE ON msdb.dbo.sp_add_jobstep TO VC_ADMIN_ROLE go GRANT EXECUTE ON msdb.dbo.sp_update_job TO VC_ADMIN_ROLE go GRANT EXECUTE ON msdb.dbo.sp_add_jobserver TO VC_ADMIN_ROLE go GRANT EXECUTE ON msdb.dbo.sp_add_jobschedule TO VC_ADMIN_ROLE go GRANT EXECUTE ON msdb.dbo.sp_add_category TO VC_ADMIN_ROLE go sp_addrolemember VC_ADMIN_ROLE , [vpxuser] go
3. Use a Script to Create a vCenter Server User by Using the dbo Schema and db_owner Database Role
use VCDB go sp_addrolemember @rolename = 'db_owner', @membername = 'vpxuser' go use MSDB go sp_addrolemember @rolename = 'db_owner', @membername = 'vpxuser' go
Script 2 needs the following declared at the top.
ReplyDeleteUse [VCDB]
Otherwise it will put the schema in the current database.
Otherwise, nice work..
This is my cleanup script..
drop schema [VMW]
go
EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'RSA'
EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'VUM'
EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'VCDB'
GO
USE [master]
GO
ALTER DATABASE [RSA] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [VUM] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [VCDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
USE [master]
GO
DROP DATABASE [RSA]
DROP DATABASE [VUM]
DROP DATABASE [VCDB]
GO
drop login vpxuser;
drop login RSA_USER;
drop login RSA_DBA;
drop user vpxuser;
drop user RSA_USER;
drop user RSA_DBA;
go
drop role VC_ADMIN_ROLE
drop role VC_USER_ROLE
go
Whackdiddy
http://vtote.wordpress.com