• No results found

(Optional) Use a Script to Create Microsoft SQL Server Database Objects Manually

In document vsphere Installation and Setup (Page 195-198)

You can create database objects manually with this method of configuring the SQL database.

Alternatively, you can configure a SQL Server ODBC connection and run the Install package. The vCenter Server installer will create database objects. See “Configure a SQL Server ODBC Connection,” on page 198.

Using a script to create database objects manually requires that you take one of the following actions.

n Grant the db_owner role to the database user in VCDB and in MSDB. See “Set Database Permissions by Using the dbo Schema and the db_owner Database Role,” on page 192 and “Use a Script to Create a vCenter Server User by Using the dbo Schema and db_owner Database Role,” on page 193.

n Grant the VC_ADMIN_ROLE role to the database user in VCDB and in MSDB, and grant the VC_USER_ROLE role to the database user in VCDB. See “Set Database Permissions By Manually Creating Database Roles and the VMW Schema,” on page 191.

Prerequisites

Create the SQL Server database. You can create the SQL Server database manually or by using a script. See

“Create a SQL Server Database and User for vCenter Server,” on page 190

Procedure

1 Log in to a Microsoft SQL Server Management Studio session as user_name for a user account that you created on the vCenter Server and MSDB databases.

2 Locate the dbschema scripts in the vCenter Server installation

package /installation_directory/vCenter-Server/dbschema directory.

3 Open the VCDB_mssql.SQL and the Topn_DB_mssql.sql files by using Microsoft SQL Server Management Studio and replace all occurrences of $schema with the schema name.

4 Open VCDB_views_mssql.sql file by using Microsoft SQL Server Management Studio and replace all occurrences of ; with ; new line, and go.

5 Run the scripts in sequence on the database.

The DBO user must own the objects created by these scripts. Open the scripts one at a time in Microsoft SQL Server Management Studio and press F5 to execute each script in the order shown here.

VCDB_mssql.SQL

insert_stats_proc_mssql.sql load_stats_proc_mssql.sql purge_stat2_proc_mssql.sql purge_stat3_proc_mssql.sql purge_usage_stats_proc_mssql.sql stats_rollup1_proc_mssql.sql stats_rollup2_proc_mssql.sql stats_rollup3_proc_mssql.sql cleanup_events_mssql.sql delete_stats_proc_mssql.sql upsert_last_event_proc_mssql.sql load_usage_stats_proc_mssql.sql TopN_DB_mssql.sql

calc_topn1_proc_mssql.sql calc_topn2_proc_mssql.sql calc_topn3_proc_mssql.sql calc_topn4_proc_mssql.sql clear_topn1_proc_mssql.sql clear_topn2_proc_mssql.sql clear_topn3_proc_mssql.sql clear_topn4_proc_mssql.sql rule_topn1_proc_mssql.sql rule_topn2_proc_mssql.sql rule_topn3_proc_mssql.sql rule_topn4_proc_mssql.sql

process_license_snapshot_mssql.sql l_stats_rollup3_proc_mssql.sql l_purge_stat2_proc_mssql.sql l_purge_stat3_proc_mssql.sql l_stats_rollup1_proc_mssql.sql l_stats_rollup2_proc_mssql.sql VCDB_views_mssql.sql

6 (Optional) You can also run the following scripts to enable database health monitoring.

7 For all supported editions of Microsoft SQL Server (except Microsoft SQL Server Express), run these scripts to set up scheduled jobs on the database.

These scripts ensure that the SQL Server Agent service is running.

job_schedule1_mssql.sql

8 For all the procedures you created in Step 5, grant the execute privilege to the vCenter Server database.

grant execute on insert_stats_proc to vCenter_db_user grant execute on purge_stat2_proc to vCenter_db_user grant execute on purge_stat3_proc to vCenter_db_user grant execute on purge_usage_stat_proc to vCenter_db_user grant execute on stats_rollup1_proc to vCenter_db_user grant execute on stats_rollup2_proc to vCenter_db_user grant execute on stats_rollup3_proc to vCenter_db_user grant execute on cleanup_events_tasks_proc to vCenter_db_user grant execute on delete_stats_proc to vCenter_db_user

grant execute on upsert_last_event_proc to vCenter_db_user grant execute on load_usage_stats_proc to vCenter_db_user grant execute on load_stats_proc to vCenter_db_user grant execute on calc_topn1_proc to vCenter_db_user grant execute on calc_topn2_proc to vCenter_db_user grant execute on calc_topn3_proc to vCenter_db_user grant execute on calc_topn4_proc to vCenter_db_user grant execute on clear_topn1_proc to vCenter_db_user grant execute on clear_topn2_proc to vCenter_db_user grant execute on clear_topn3_proc to vCenter_db_user grant execute on clear_topn4_proc to vCenter_db_user grant execute on rule_topn1_proc to vCenter_db_user grant execute on rule_topn2_proc to vCenter_db_user grant execute on rule_topn3_proc to vCenter_db_user grant execute on rule_topn4_proc to vCenter_db_user

grant execute on process_license_snapshot_proc to vCenter_db_user grant execute on l_stats_rollup3_proc to vCenter_db_user

grant execute on l_purge_stat2_proc to vCenter_db_user grant execute on l_purge_stat3_proc to vCenter_db_user grant execute on l_stats_rollup1_proc to vCenter_db_user grant execute on l_stats_rollup2_proc to vCenter_db_user

If you ran the script process_performance_data_mssql.sql in Step 5, grant the following execute privilege to the vCenter Server database.

grant execute on process_performance_data_proc to vCenter_db_user

9 On the machine on which you intend to install vCenter Server, create a DSN that points to the database server with the schema.

10 Run the vCenter Server installer.

11 If a database reinitialization warning message appears in the vCenter Server installer, select Do not overwrite, leave my existing database in place and continue the installation.

This message appears if you are using a database that has vCenter Server tables that were created by a previous installation. The message does not appear if the database is clean.

12 When prompted, provide the database user login.

In document vsphere Installation and Setup (Page 195-198)