Backing up and restoring the vCenter Server Appliance Inventory Service database
search cancel

Backing up and restoring the vCenter Server Appliance Inventory Service database

book

Article ID: 309004

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This article provides steps to back up and restore the vCenter Server Appliance (VCSA) Inventory Service database. Backing up the database retains:
  • Any Storage Profiles that you are using via the vSphere Profile-Driven Storage service.
  • Tags.
  • vCloud Director relies on the Managed Object ID component, which is only contained within the Inventory Service database for use with Storage Profiles.

Note: This article is only supported for backup and restore of the vCenter Inventory Service to the same vCenter Server Appliance. Use of image-based backup and restore is the only solution supported for performing a full, secondary appliance restore.


Environment

VMware vCenter Server Appliance 5.1.x
VMware vCenter Server Appliance 5.0.x

Resolution

Before you begin, ensure you have these installed:
  • An SSH client for connecting to the vCenter Server Appliance
  • WinSCP (or any SCP client) for retrieving and replacing the Inventory Service database recovery file.

Backing up the vCenter Inventory Service database:

  1. Connect to the vCenter Server Appliance via SSH. For more information, see Enable or Disable SSH Administrator Login on the VMware vCenter Server Appliance section in the vCenter Server 5.5 and Host Management Guide (for vSphere 5.1 and 5.5) and the vCenter Server 5.0 and Host Management Guide (for vSphere 5.0).

  2. Stop the vCenter Inventory Service by running the command:

    service vmware-inventoryservice stop

  3. Navigate to this directory:

    cd /usr/lib/vmware-vpx/inventoryservice/scripts/

  4. To back up the vCenter Inventory Service database, run the command:

    ./backup.sh -file backup_file_name

    Where backup_file_name is the location and file name to be generated, for example:

    /usr/lib/vmware-vpx/inventoryservice/scripts # ./backup.sh -file /tmp/InventoryServiceDB.DB

    A successful export of the vCenter Inventory Service database displays output similar to:

    Opening Inventory Service data files
    Inventory Service data files opened
    Backing up data...
    Backup completed successfully


  5. Using WinSCP, connect to the vCenter Server Appliance and download the InventoryServiceDB.DB file from the /tmp/ directory.
  6. Start the vCenter Inventory Service by running the command:

    service vmware-inventoryservice start

Restoring the vCenter Inventory Service database

  1. Connect to the vCenter Server Appliance via SSH. For more information, see Enable or Disable SSH Administrator Login on the VMware vCenter Server Appliance section in the vCenter Server 5.5 and Host Management Guide (for vSphere 5.1 and 5.5) and the vCenter Server 5.0 and Host Management Guide (for vSphere 5.0).

  2. Using WinSCP, connect to the vCenter Server Appliance and upload the backup copy of the InventoryServiceDB.DB file to the /tmp/ directory.
  3. Stop the vCenter Inventory Service by running the command:

    service vmware-inventoryservice stop

  4. Navigate to this directory:

    cd /usr/lib/vmware-vpx/inventoryservice/scripts/

  5. To restore the vCenter Inventory Service database from backup, run the command:

    ./restore.sh -backup backup_file_name

    Where backup_file_name is the location and file name to be used, for example:

    /usr/lib/vmware-vpx/inventoryservice/scripts # ./restore.sh -backup /tmp/InventoryServiceDB.DB

    A successful export of the vCenter Inventory Service database displays output similar to:

    Restoring from backup: /tmp/InventoryServicedb.DB
    Restoring...
    Attempting to save existing data to /storage/db/inventoryservice/data-1382478584969.old
    Saved existing data to /storage/db/inventoryservice/data-1382478584969.old
    Restore completed successfully


  6. Start the vCenter Inventory Service by running the command:

    service vmware-inventoryservice start
When the restore is complete, log in to the vSphere Web Client (The default URL is https://VCSA_FQDN:9443) to verify that the Inventory Service is working correctly. Perform these checks:
  • Ensure that all virtual machines are listed in the VM and Templates view and the Hosts and Clusters view.
  • Ensure that any Tags configured in the environment are restored.


Additional Information

vCenter Server Appliance Inventory Service データベースのバックアップとリストア
备份和还原 vCenter Server Appliance Inventory Service 数据库