Skip to main content

Migrate vCD database to another SQL server

This post describes steps to migrate vCloud Director MSSQL database to another server

Migrate DB to new SQL server

As part of repointing vCD database it must be detached from old SQL server, attached to new SQL server and provide permission for vCD login user as a prerequisite

1. Log in to the vCD database as a user with sufficient privileges and detach the database by running these commands:

    USE master;
    GO
    ALTER DATABASE vCD_DB_Name
    SET SINGLE_USER
    WITH ROLLBACK IMMEDIATE;
    GO
    ALTER DATABASE vCD_DB_Name
    SET READ_ONLY;
    GO
    ALTER DATABASE vCD_DB_Name
    SET MULTI_USER;
    GO

2. Copy the backup files to these locations:

    c:\Program Files\Microsoft SQL Server\MSSQL\DATA\vCD_DB_Name.mdf
    c:\Program Files\Microsoft SQL Server\MSSQL\DATA\vCD_DB_Name.ldf

Note: There must be two files with the extensions .mdf and .ldf. 

3. Log in to the new vCD database and attach the backup using these commands:

    USE master;
    GO
    EXEC sp_attach_db @dbname = N’vCD_DB_Name‘,
    c:\Program Files\Microsoft SQL Server\MSSQL\DATA\vCD_DB_Name.mdf
    c:\Program Files\Microsoft SQL Server\MSSQL\DATA\vCD_DB_Name.ldf
    GO

4. Create a login user by running these commands:

    USE master
    GO
    exec sp_addlogin ‘UserName‘, ‘PassWord’, ‘vCD_DB_Name‘

5. Provide access to the database for the new user by running these commands:

    USE [vCD_DB_Name];
    GO
    - exec sp_change_users_login ‘Report’
    EXEC sp_change_users_login ‘Update_One’, 'UserName', 'vCD_DB_Name'
    GO

·  Repoint DB to new SQL server

       1. Shutdown the vCD service 

           Service vmware-vcd stop  

·      2. Open the /opt/vmware/vcloud-director/etc/global.properties file using a text editor.

·          Comment out or remove these lines: 

             database.jbdcUrl=
     database.username=
     database.password=

 

·      3. Log in to the vCD server and configure vCD to use the new database by running this command:
    /opt/vmware/vcloud-director/bin/configure

      

4. Start the vCD service 

5. Open the global.properties file and it should point now to new SQL DB server

   

Log into the cloud portal and navigate under Manage & Monitor click on Cloud Cells and you would notice other cells in the server group status is Disconnected

  

       Repeat the same above steps(1-5) on remaining cells in the server group. Eventually you will see other cells in the server group status as connected.  

        

                

 

Comments

Popular posts from this blog

Deleting stale kubernetes clusters in vCD

Unlike the previous version the CSE 4.x is a stateless appliance and its data is stored in VMware Cloud Director Database.  The cluster creation and deletion compared with CSE 3.x version has improved. Besides, there are some scenarios where the cluster deletion is failing even when the "Force Delete" option is chosen. We can use vCD API explorer to delete it, the following are the API queries you can execute  Under definedEntity POST /1.0.0/entities/{id}/resolve DELETE /1.0.0/entities/{id}

Manage RabbitMQ using VCP LCM

I have been working in vCD for quite some time, and most of the implementation engineers or consultants faced issues during the deployment or upgrade of RabbitMQ for the vCD message queuing service. From vCD 10.2.2, we can use the built-in MQTT client instead of RabbitMQ however, for VCD multisite configuration or some 3rd party applications need RabbitMQ, such as Veeam or VMware HCX. Using the VCP LCM, we can create a new RabbitMQ environment or manage an existing environment. The reason for this blog is that none of the VMware documentation has the information that registering an existing RMQ instance is only going to work if the RMQ instance was previously deployed by the VCP LCM (or at least, if it is a similar setup based on a Bitnami RMQ VM). Other RMQ instances (e.g., running in CentOS) are not supported and cannot be imported into the VCP LCM 1.5. I hope this information will be useful for someone who is performing green field deployment or upgrading an existing setup.  

vCloud Director Availability On-premises installation

In my previous post  Provider setup we have seen vCDA provider installation. Here, we will see vCDA 4.0.1 On-premises installation. Download the On-premise OVA from  VMware Download and deploy it in your vCenter.  Note: Ensure that vCenter Server , ESXi , Platform Services Controller , VMware Cloud Director , and the VMware Cloud Director Availability appliance all use the same NTP server.