|
||||
Install a Database
As previously mentioned, VMware utilizes industry-standard databases for vCenter Server. Administrators cannot easily use or access the raw data contained in the vCenter Server database; instead, they must use vSphere Client. Components like the datacenters, clusters, resource pools, hosts, and virtual machines, along with their associated configuration and performance data, are stored in the backend database that vCenter Server is connected to. As mentioned, the default installation includes Microsoft SQL Server 2005 Express Edition. The vCenter Server installer automatically creates a data source name (DSN), the database, and the database schema when using the embedded SQL Server 2005 Express. We'll cover installation of the default database when we discuss vCenter Server installation.
We will examine a few alternate database installations—Microsoft SQL Server 2005 (other than Express Edition) or Oracle 10g or 11g—in the following sections.
Create a vCenter Database in Microsoft SQL Server 2005
The default Microsoft SQL Server 2005 Express Edition installation with vCenter Server supports up to 5 hosts and 50 virtual machines. It is not considered as robust as its cousins, Microsoft SQL Server 2005 Standard and Enterprise Editions. In many cases the Standard and Enterprise Editions are chosen due to their enhanced feature set, which they do not share with the Express Edition.
Tables listing the differences among the various editions of Microsoft SQL Server 2005 can be found on Microsoft's website:
http://www.microsoft.com/Sqlserver/2005/en/us/compare-features.aspx
Whether you have chosen to utilize Standard or Enterprise Edition, Microsoft recommends certain configuration settings when you're creating the vCenter Server database. The database can reside on the local system or can be accessed remotely. This database can be created automatically using the SQL 2005 management tools. Using the automatic method will require some additional configuration. To accomplish this easily, use the following steps:
- If vCenter Server is part of a Windows domain, create a domain account that will be used to access the SQL Server instance.
- During initial installation and upgrades, the vpxuser account must have db_owner rights on the MSDB database. This access can be revoked after an installation or upgrade.
- Load SQL Query Analyzer with a user that has DBO privileges, and run the following instructions:
- Use the same SQL Query Analyzer window to run the following scripts in the order they are listed. These scripts, which create the database schema, can be located and run from the vpx/dbshema directory of the installation media.
- There are some additional scripts that work with the SQL Server Agent to handle job scheduling and similar tasks. They are not supported when you're using Microsoft SQL Server 2005 Express Edition, as that edition does not natively provide any scheduling functions. Again, using the same SQL Query Analyzer, load and run each of these scripts in the order listed. Before running the scripts, confirm that the SQL Server Agent is running.
- The database and database schema have now been created and are ready for a DSN to connect to the VCDB instance.
- On the vCenter Server system, open the Windows ODBC Data Source Administrator by choosing Settings → Control Panel → Administrative Tools → Data Sources (ODBC).
Note: If you're using a 64-bit operating system, you are required to run the 32-bit ODBC Administrator application, which is located at C:\Windows\SysWOW64\odbcad32.exe.
- Select the System DSN tab.
- Click Add, select SQL Native Client, and click Finish.
- Type an ODBC DSN name in the Name field, something like vCenter Server.
- Select the server name from the Server drop-down menu and click Next. This can be the local system or a remote system.
- Type the SQL Server machine name in the Server text field (or select it from the Server drop-down list).
- Select Windows Authentication.
- Select the database created for the vCenter Server system from the Change The Default Database To menu and click Next.
- Click Finish.
Note: It is not a best practice to use a Domain Admin account for this purpose but rather a dedicated domain account. Make sure this user has db_datawriter and db_datareader permissions on the SQL instance.
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', →
@defdb='VCDB', @deflanguage='
go
ALTER LOGIN [vpxuser] WITH CHECK_POLICY = OFF
go
CREATE USER [vpxuser] for LOGIN [vpxuser]
go
sp_addrolemember @rolename = 'db_owner', →
@membername = 'vpxuser'
go
use MSDB
go
CREATE USER [vpxuser] for LOGIN [vpxuser]
go
sp_addrolemember @rolename = 'db_owner', →
@membername = 'vpxuser'
go
Remember that you can change the database user, location, and database name within this script. Keep in mind that these values will need to match the DSN created to access the database.
VCDB_mssql.SQL
purge_stat1_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
job_schedule1_mssql.sql
job_schedule2_mssql.sql
job_schedule3_mssql.sql
job_cleanup_events
Note: With a default installation of SQL Server, only a single instance or installation of SQL is present. If multiple SQL Server installations are present on a server, each additional installation is referred to as a named instance. The primary instance does not have a specific name, other than the server name, while named instances are typically signified as SERVERNAME\InstanceName.
A DSN that is compatible with vCenter Server is now available. When the vCenter Server installer prompts for the DSN of the database, select vCenter Server, or whatever value you entered in step 10.
Microsoft SQL Server 2005 is a popular database, and as you can see in steps 1 through 15, it is relatively simple to configure.
Create a vCenter Database in Oracle
Not every environment uses Microsoft SQL Server 2005. For various reasons, administrators are often forced to choose databases already being used in their environment. Oracle is a popular database choice, and VMware supports several versions of Oracle, including 10g and 11g. Oracle has another appeal to environments that have a limited Microsoft footprint: it is available for many other platforms, including Linux, Solaris, and HP-UX. You don't have to have Oracle installed locally on the vCenter Server. Just as with Microsoft's database offering, when you're using Oracle, certain configurations are considered best practices when creating the database. Perform these steps to create the database:
- Log on to a SQL*Plus session with the system account.
- Run the following commands, or script, to create the database:
- Open a SQL*Plus window with a user that has schema owner rights on the vCenter Server database to create the database schema.
- Locate the dbschema scripts in the vCenter Server installation package bin/dbschema directory.
- In SQL*Plus, run the scripts in sequence on the database. ‹path› is the directory path to the bin/dbschema folder.
- All supported editions of Oracle Server require that these additional scripts be run to set up scheduled jobs on the database:
- Oracle can use a local or remote Oracle instance. From the same SQL*Plus window, run the following script (where VPXADMIN is the user):
- If the Oracle database is not installed on the same system as vCenter Server, download and install the Oracle client.
- On the vCenter Server system, open the Windows ODBC Data Source Administrator by choosing Settings ➣ Control Panel ➣Administrative Tools ➣ Data Sources (ODBC).
- Select the System DSN tab and click Add.
- Select the appropriate Oracle driver for your installation and click Finish.
- Enter the name of the DSN, such as vCenter Server.
- Ensure that appropriate values appear in the TNS Names field referencing the local or remote Oracle instances. Select the appropriate TNS Service name.
- Enter the username created in the Create User section.
- Click OK. An Oracle database is now available for the vCenter Server installer.
CREATE SMALLFILE TABLESPACE "VPX" DATAFILE
'/u01/app/oracle/oradata/vcdb/vpx01.dbf' →
SIZE 1G AUTOEXTEND ON NEXT 10M MAXSIZE
UNLIMITED LOGGING EXTENT MANAGEMENT →
LOCAL SEGMENT SPACE MANAGEMENT AUTO;
Note: The datafile path ('/u01/app/oracle/oradata/vcdb/vpx01.dbf' in this case) must be a valid path on your Oracle system; change this to match your particular environment.
@‹path›/VCDB_oracle.SQL
@‹path›/purge_stat1_proc_oracle.sql
@‹path›/purge_stat2_proc_oracle.sql
@‹path›/purge_stat3_proc_oracle.sql
@‹path›/purge_usage_stats_proc_oracle.sql
@‹path›/stats_rollup1_proc_oracle.sql
@‹path›/stats_rollup2_proc_oracle.sql
@‹path›/stats_rollup3_proc_oracle.sql
@‹path›/cleanup_events_oracle.sql
@‹path›/delete_stats_proc_oracle.sql
@‹path›/job_schedule1_oracle.sql
@‹path›/job_schedule2_oracle.sql
@‹path›/job_schedule3_oracle.sql
@‹path›/job_cleanup_events_oracle.sql
CREATE USER "VPXADMIN" PROFILE "DEFAULT" →
IDENTIFIED BY "oracle" DEFAULT TABLESPACE →
"VPX" ACCOUNT UNLOCK; →
grant connect to VPXADMIN; →
grant resource to VPXADMIN; →
grant create view to VPXADMIN; →
grant create sequence to VPXADMIN; →
grant create table to VPXADMIN; →
grant execute on dbms_lock to VPXADMIN; →
grant execute on dbms_job to VPXADMIN; →
grant unlimited tablespace to VPXADMIN;
20727c03.indd 82 11/6/09 1:07:01 AM
|
||||
Note: If you are using a 64-bit operating system, run the 32-bit ODBC Administrator application, which is located at C:\Windows\SysWOW64\odbcad32.exe.
Like SQL Server, Oracle is a popular database and is also relatively simple to configure for use with vCenter Server.
Printed with permission from Wiley Publishing Inc. Copyright 2009. VMware vSphere 4 Administration Instant Reference by Scott Lowe, Jason W. McCarty and Matthew K. Johnson. For more information about this title and other similar books, please visit Wiley Publishing Inc.
This was first published in June 2010
Channel Strategies for the CIO
Join the conversationComment
Share
Comments
Results
Contribute to the conversation