Friday, July 18, 2014

Moving vCenter Server Databases to a different SQL Server / SQL Instance

Assuming that you have documented below mentioned details from Old vCenter Install
1) vCenter and Update Manager Database user passwords
2) RSA_User and RSA_Admin passwords
3) SSO Master Password
Stage 1) - Backup and Restore Databases
  • Stop vCenter Single Sign On,VMware vCenter Inventory ServiceVMware VirtualCenter ServerVMware VirtualCenter Management WebservicesVMware vSphere Update Manager Service and VMware vSphere Web Client.
  • Backup vCenter, Update Manager and RSA Databases and restore in new DB server.
  • Create vCenter, Update Manager and RSA_User and RSA_DBA Users with same passwords on new DB server.
  • Assign Same permissions for users
Stage 2) - Recreate Agent Jobs
  • Open the below location
          vCenter Server 4.x: C:\Program Files\VMware\Infrastructure\VirtualCenter Server\sql
          vCenter Server 5.x: C:\Program Files\VMware\Infrastructure\VirtualCenter Server\sql
  • Copy below mentioned files to a new folder on vCenter server/new SQL Server.
         job_schedule1_mssql.sql
         job_schedule2_mssql.sql
         job_schedule3_mssql.sql
         job_dbm_performance_data_mssql.sql
         job_cleanup_events_mssql.sql
         job_property_bulletin_mssql.sql
         job_topn_past_day_mssql.sql
         job_topn_past_month_mssql.sql
         job_topn_past_week_mssql.sql
         job_topn_past_year_mssql.sql
  • Open job_schedule1_mssql.sql using notepad and copy script
  • On the new SQL server, right click on vCenter Server Database > New Query > Paste the copied script and execute the copied script 
NOTE: Please double check and make sure that you have VCenter server database selected in the Database list and not Master.








  • Repete the same for all the scripts.
  • Once all three jobs are created, navigate to SQL Server Agent and Refresh to see new Jobs created. 
  • Right-click Past Day stats rollup, click Properties.
  • Ensure the owner of the job is the same database login used by VirtualCenter to connect to the database.
  • Repete the same for Past Month stats rollup and Past Week stats rollup.
Stage 3) - Re-pointing SSO Service to the new SQL server
  • Open SSO Install DIR. By default it is C:\Program Files\VMware\Infrastructure\SSOServer and Navigate to \utils
  • Open a command prompt as administrator and run below mentioned command 
       CD C:\Program Files\VMware\Infrastructure\SSOServer\utils
       ssocli configure-riat -a configure-db --database-host <NEW_DBServer_NAME/IP> --database-port <New_DBServer_Port> -m <SSOServerMasterPassword>

  • Open C:\Program Files\VMware\Infrastructure\SSOServer\webapps\lookupservice\WEB-INF\classes
  • Open config file with NotePad
  • Check port number in the URL and DB Server Name at the last line. 
  • Save the file and exit
  • SSO Service is good to start now!
Stage 4) - Re-pointing vCenter Server to new DB Server
  • Start > Run and "Odbcad32.exe"
  • Under System DSN, Change DB Server settings and Save it.
  • Start VMware VirtualCenter Server Service!
Stage 5) - Re-pointing Update Manager Service to the new SQL server
  • Start > Run and "%systemdrive%\Windows\SysWoW64\Odbcad32.exe"
  • Under System DSN, Change DB Server settings and Save it.
  • Start VMware vSphere Update Manager Service!
If all services are started, reboot vCenter so that all the services are restarted once fresh. 
Disable Agent jobs and Databases on old server, you can probably keep them for a couple of days and then to a cleanup. 

Thank you!
R.Hari

Assuming that you have documented below mentioned details from Old vCenter Install
1) Vcenter and Update Manager Database user passwords
2) RSA_User and RSA_Admin passwords
3) SSO Master Password


Stage1) - Move Databases
Stop vCenter Single Sign On, VMware vCenter Inventory Service, VMware VirtualCenter Server, VMware VirtualCenter Management Webservices, VMware vSphere Update Manager Service and VMware vSphere Web Client.
Backup Vcenter, Update Manager and RSA Databases and restore in new DB server.
Create Vcenter, Update Manager and RSA User and RSA DBA Users with Same passwords on new DB server.
Assign Same permissions for users

Stage2) - Recreate Agent Jobs
Open the below location
vCenter Server 4.x: C:\Program Files\VMware\Infrastructure\VirtualCenter Server\sql
vCenter Server 5.x: C:\Program Files\VMware\Infrastructure\VirtualCenter Server\sql

Copy below mentioned files to a new folder
job_schedule1_mssql.sql 
job_schedule2_mssql.sql
job_schedule3_mssql.sql
job_dbm_performance_data_mssql.sql
job_cleanup_events_mssql.sql
job_property_bulletin_mssql.sql
job_topn_past_day_mssql.sql
job_topn_past_month_mssql.sql
job_topn_past_week_mssql.sql
job_topn_past_year_mssql.sql

Open job_schedule1_mssql.sql using notepad and copy script
On the new SQL server, open Vcenter Server Database and Open New Queiry and execute the copied script 
NOTE: Please double check and make sure that you have VCenter server database selected in the Database list and not Master.
Repete the same for all the scripts.

After all three jobs are created, navigate to SQL Server Agent and Refresh to see new Jobs created. 
Right-click Past Day stats rollup, click Properties. Ensure the owner of the job is the same database login used by VirtualCenter to connect to the database.
Repete the same for Past Month stats rollup and Past Week stats rollup.

Stage3) - Repointing SSO Service to the new SQL server
Open SSO Install DIR. By default it is C:\Program Files\VMware\Infrastructure\SSOServer  and Navigate to \utils
Open a command prompt as administrator
CD C:\Program Files\VMware\Infrastructure\SSOServer\utils
ssocli configure-riat -a configure-db --database-host <NEW_DBServer_NAME/IP> --database-port <New_DBServer_Port> -m <SSOServerMasterPassword>

Executing action: 'configure-db'

Updating Database configuration
Generating HA node package

Successfully executed action: 'configure-db'

Open C:\Program Files\VMware\Infrastructure\SSOServer\webapps\lookupservice\WEB-INF\classes
Open config file with NotePad
Check port number in the URL and DB Server Name at the last line. 
Save the file and exit
Try to start SSO Service.

Stage4) - Repointing vCenter Server to new DB Server
Start > Run and  "Odbcad32.exe"
Under System DSN, Change DB Server settings and Save it.

Start VMware VirtualCenter Server

Stage5) - Repointing Update Manager Service to the new SQL server

Start > Run and  "%systemdrive%\Windows\SysWoW64\Odbcad32.exe"
Under System DSN, Change DB Server settings and Save it.

Start VMware vSphere Update Manager

If all services are started, reboot vCenter so that all the services are restared once fresh. 

No comments: