Migrating the vCenter Server database from SQL Express to full SQL Server
search cancel

Migrating the vCenter Server database from SQL Express to full SQL Server

book

Article ID: 305868

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This article provides steps to migrate a VMware vCenter Server database from a SQL Express server to a full SQL Server instance

Notes:
  • When performing an in place upgrade of SQL Express to SQL Server the roll up jobs will need to be created.
  • You may need to migrate from SQL Express to SQL Server if you are close to or exceeding 5 hosts, 50 virtual machines, or 4 GB database size. (In Microsoft SQL Express 2008 and newer, the maximum database size is increased to 10 GB.)


Environment

VMware vCenter Server 5.5.x

Resolution

To migrate the vCenter Server database from an SQL Express instance to full SQL Server:

Note: Ensure that you are using the dbo schema and not custom schemas in your vCenter Server database.
  1. Stop the VirtualCenter Server service.
  2. Take a complete backup of the vCenter Server database. Do not skip this step.
  3. Stop the vCenter Server database on the SQL Express server.
  4. Copy the backed up database to the full SQL Server host.
  5. Create a new database on the full SQL Server.
  6. Restore the backed up SQL Express vCenter Server database to the newly created database. To ensure a proper restore, navigate to Options and click Overwrite existing database with replace.

    Notes:
    • The instructions above also apply when full SQL Server is installed locally on the vCenter Server Windows host. SQL Express 2005 is upgraded to SQL Server 2008 after you have created the new 2008 database and restored the SQL Express 2005 database to the SQL 2008 Server.
    • If the new instance of full SQL Server is installed locally for the database migration, the vCenter Service's SQL Server Instance dependency may need to be recreated or modified.
    • You must remove and recreate the system DSN so that it uses the SQL Native Client 10.0/11.0 driver. Download the x86 for vCenter Server 4.0 and earlier, and x64 for vCenter Server 4.1 and later.

      Note: The preceding links were correct as of October 24, 2014. If you find a link is broken, provide a feedback and a VMware employee will update the link.
       
    • Ensure the DSN connects to the newly created database on SQL 2008 Server. For vCenter Server 4.1 and later, ensure a 64-bit DSN is created for the ODBC connection.
    • For vCenter Server 5.1, the Single Sign-On (SSO) database may also have to be migrated.
       
  7. Configure the vCenter Server account that connects to the database as the dbo user of the MSDB system database.
  8. Update the ODBC connection on vCenter Server.

    Note: This procedure modifies the Windows registry. Before making any registry modifications, ensure that you have a current and valid backup of the registry and the virtual machine. For more information on backing up and restoring the registry, see Microsoft Knowledge Base article 136393.

    To update the ODBC connection settings for vCenter Server 4.x/5.x:
     
    1. Click Start > Run, type regedit, and click OK. The Registry Editor window opens.
    2. Navigate to HKEY_LOCAL_MACHINE > SOFTWARE > VMware, Inc > VMware VirtualCenter.
    3. Modify the key DbInstanceName and remove the current Value data. Do not delete this key.
    4. Modify the key DbServerType and change the Value data from Bundled to Custom.
    5. Navigate to HKEY_LOCAL_MACHINE > SOFTWARE > VMware, Inc > VMware VirtualCenter > DB.
    6. If the ODBC connection name is changed, modify Key 1 with the name of the new ODBC connection.
    7. Modify Key 4 and change the ODBC driver to the new driver.
    8. Modify key 2 and add the vCenter Server user, for example sa.
       
To update the ODBC connection settings for vCenter Server 6.x:
  1. Navigate to: C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx. (Default Path)
  2. Take a backup copy of vpxd.cfg
  3. Open the vpxd.cfg file in a text editor.
  4. Locate the <DB> element and modify the value for <key_2> to reflect the new database user ID.
...
<DB>
<key_2>database_user_id</key2>
<key_3>*joqDY/eQvwyLBdLcXXJYZvDAd+FXYY8q7x///vhy4LE=</key_3>
</DB>
...
Note:-If you are using Windows Integrated Authentication to connect to the vCenter Server database, remove the value for <key_3>.
  1. Save the vpxd.cfg file.
  1. To change the database password stored in the registry(vpxd.cfg file in case of vCenter Server 6.x) and to allow the user to update the ODBC information without reinstalling vCenter Server.
    1. Click Start > Run
    2. Type cmd
    3. Right-click on the Command prompt icon and select Run as Administrator.
    4. Run this command:

      C:\Program Files\VMware\Infrastructure\VirtualCenter Server\vpxd.exe -p

      Note: This is the default path to the vCenter Server installation directory. Change the path appropriately, if required.
       
  2. Recreate the rollup jobs. For more information : Verifying jobs and stored procedures installed in vCenter Server 5.1, 5.5 and 6.x
     
  3. Ensure that the vcdb.properties file found in below location reflects the new SQL database information, otherwise, change the URL manually to the new SQL Server address:
vCenter Server 5.x/4.x: C:\ProgramData\VMware\VMware VirtualCenter
vCenter Server 6.x: C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx

Example
vcdb.properties:
usevcdb=true
url=jdbc:sqlserver://<SQL_SERVER_NAME>;databaseName\=<VCDB>

username=username         ------------>(SQL Authentication account )
password=password          ------------>(SQL account password)
dbtype=mssql
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver


Note: If using vCenter Server 5.0 ensure that the database settings used by the Tomcat Server are updated.
 
  1. Start the vCenter Server services.

If vCenter Server service has dependency on SQL Express follow the steps given below:

  1. Open regedit and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\vpxd.
  2. Click the DependOnService column. The value of DependOnService lists all the services the vCenter Server depends on.
  3. Delete the SQL Express service line.
  4. Do similarly check for ControlSet001 and ControlSet002 folders.
  5. Reboot the vCenter Server.
  6. Ensure the SQL Express service was set to manual/disabled and stopped.
  7. Start vCenter service.


Note: If you experience issues accessing the Storage View tab after the migration, see Accessing the Storage tab view in vCenter Server 5.0 fails with an internal error: com.vmware.vim.sms.fault.serviceInitializationException (2015180).

Note:If you are experiencing Error : vcdb.error.read.data Error while reading data from the vCenter Server database: Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. 

make sure while modifying the SQL DB access we follow the permissions as mentioned in https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.install.doc/GUID-B7C29C3F-1D15-47E2-AA79-DC4AB3DF546E.html

And Make sure Granting additional privileges to the vCenter Server database user using KBA https://kb.vmware.com/s/article/2114754


Additional Information

For more information on migrating the Update Manager database, see the Migrating the Update Manager Data and Upgrading Update Manager on a Different Machine section of the vSphere Installation and Setup Guide.
Administrative credentials are required for Oracle and SQL Server databases when installing or upgrading vCenter Server
How to stop, start, or restart vCenter Server services
VMware VirtualCenter Server service does not start automatically after reboot
Upgrading VMware vCenter Server 4.0/4.1 fails with the error: Setup found that multiple schemas exist in the database
Cannot start the vCenter Server service after migrating the db to a new server
VMware vCenter Server fails to populate performance charts and displays an error message when using a custom JDBC SQL port
Verifying jobs and stored procedures in VMware vCenter Server 4.1.x
Verifying jobs and stored procedures installed in VMware vCenter Server 5.0
After migrating the vCenter Server database to a new host, the VMware VirtualCenter Management WebServices service does not function correctly
Accessing the Storage tab view in vCenter Server 5.0 fails with an internal error: com.vmware.vim.sms.fault.serviceInitializationException
Verifying jobs and stored procedures installed in vCenter Server 5.1, 5.5 and 6.x
Updating the vCenter Single Sign-On server database configuration
Migrar la base de datos de vCenter Server de SQL Express 2005 a SQL Server 2008
将 vCenter Server 数据库从 SQL Express 迁移到完整的 SQL Server
vCenter Server データベースを SQL Express から完全な SQL Server に移行する
Migrando o banco de dados do vCenter Server do SQL Express para o SQL Server completo
Moving the VMware vCenter Server 4.x/5.x/6.x SQL database