Ofter after you complete the implementation of your vCD you discover that your company need to decommission the MS Sql server you installed the database of you VMware vCloud Director Database on. This is only one reason why you would have to move a vCloud Director SQL Database to a new Database server, but everyday I learn a new reason from a different customer. What ever your reason to move your vCD DB to a new server, the below procedure is how you do it.
Note: This example assume your DB name is vCloud, make sure you use the database name instead. I have marked it in read when ever it used so you can modify the code with ease.
1- Shutdown your vCD Service using the following command: Service VMware-VCD Stop
2- Move your vCD SQL Database to your new SQL Server using the below steps:
a- Detach your vCD database from your old SQL Server using the
ALTER DATABASE vcloud SET SINGLE_USER WITH ROLLBACK IMMEDIATE
exec sp_detach_db ‘vcloud‘
b- Copy your vCD Database files to your new SQL Server
copy E:\SQLData\vcloud.mdf \\VTvCDDB\E$\SQLData\vcloud.mdf
copy E:\SQLLogs\vcloud.ldf \\VTvCDDB\E$\SQLLogs\vcloud.ldf
c- Attach your vCD Database to your new SQL Server
EXEC sp_attach_db @dbname = N’vcloud‘,
@filename1 = NE:\SQLData\vcloud.mdf’,
@filename2 = N’E:\SQLLogs\vcloud.ldf’ ;
d- Create a new login user on your destination SQL Server
exec sp_addlogin ‘vcloud‘, ‘******’, ‘vcloud‘
e- Assign user required access to the DB
– exec sp_change_users_login ‘Report’
EXEC sp_change_users_login ‘Update_One’, ‘vcloud‘, ‘vcloud‘
3- Configure your VMware vCloud Director to use the new SQL Server.
a- Run the ./configure command again from /opt/vmware/vcloud-director/bin.
b- Complete your vCD Database connection settings making sure you add the port number after the host name when asked for your SQL Server host name. So your host name will look something like: VTvCDDB:1433 Look at the below screenshot for a demonstration.
c- After starting the vCD service wait for few minutes then try to access your vCD portal as well check your log files to ensure that you have no problem or errors being reported.
Although this is a straight forward process, planning is always the great way of success. If you know a DB Server is being decommissioned soon, do not install your vCD DB on it and later on run around trying to figure out how to move it across! I hope this help you smoothly move your vCD SQL Database to a new server.