Search the VMware Knowledge Base (KB)
View by Article ID

Interacting with the vCenter Server Appliance 6.5 embedded vPostgres Database (2147285)

  • 1 Ratings
Language Editions

Purpose

The article provide steps to connect to the embedded vPostgres Database of a vCenter Server Appliance 6.5.

Caution: Ensure you have working backups and/or snapshots of the vCenter Server Appliance 6.5 before interacting with the vCenter Server Appliance 6.5 Database.

Resolution

To connect to the embedded vPostgres Database of a vCenter Server Appliance 6.5:

  1. Connect to the vCenter Server Appliance 6.5 usingSSH

  2. Run the shell command to switch to the BASH Shell: 
    shell

  3. Connect to the VCDB by running this command from the vCenter Server Appliance 6.5 BASH Shell:

    /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

    Example:


    #/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
     psql.bin (9.4.9 (VMware Postgres 9.4.9.0-4442725 release))
     Type "help" for help.
     VCDB=#
    • To list all databases in instance run the following command: 

      \l+

      Example:
      VCDB=# \l+
      List of databases
      Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
      -----------+----------+----------+-------------+-------------+-----------------------+---------+------------+--------------------------------------------
      VCDB | vc | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/vc +| 69 MB | pg_default |
      | | | | | vc=CTc/vc | | |
      postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 6540 kB | pg_default | default administrative connection database
      template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 6409 kB | pg_default | unmodifiable empty database
      | | | | | postgres=CTc/postgres | | |
      template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 6417 kB | pg_default | default template for new databases
      | | | | | postgres=CTc/postgres | | |

    • To list all tables and their size run the following command: 

      \d+

      Example:

      VCDB=# \d+
      Schema | Name | Type | Owner | Size | Description
      --------+--------------------------------------------+----------+-------+------------+----------------
      vc | cis_kv_keyvalue | table | vc | 80 kB |
      vc | cis_kv_keyvalue_surr_key_seq | sequence | vc | 8192 bytes |
      vc | cis_kv_providers | table | vc | 16 kB |
      vc | cis_kv_providers_surr_key_seq | sequence | vc | 8192 bytes |
      vc | cl_config | table | vc | 8192 bytes |
      vc | cl_dbversion | table | vc | 8192 bytes |
      vc | cl_dirty_marker | table | vc | 16 kB |
      vc | cl_entity_lock | table | vc | 8192 bytes |
      vc | cl_entity_lock_metadata | table | vc | 8192 bytes |
      vc | cl_file | table | vc | 8192 bytes |
      vc | cl_file_version | table | vc | 0 bytes |
      vc | cl_item_ovftemplate_view | view | vc | 0 bytes |
      vc | cl_item_type_adapter | table | vc | 8192 bytes |
      vc | cl_library | table | vc | 8192 bytes |
      vc | cl_library_storage | table | vc | 0 bytes |
      vc | cl_libraryitem | table | vc | 8192 bytes |
      vc | cl_libraryitemversion | table | vc | 8192 bytes |
      vc | cl_libraryitemversionfile_view | view | vc | 0 bytes |
      vc | cl_librarywithitems_view | view | vc | 0 bytes |
      vc | cl_orphan_file | table | vc | 8192 bytes |
      vc | cl_simple_activity | table | vc | 8192 bytes |
      vc | cl_simple_activity_parameter | table | vc | 8192 bytes |
      vc | cl_sq_dirty_marker_id | sequence | vc | 8192 bytes |
      vc | cl_storage | table | vc | 8192 bytes |
      vc | cl_update_session_file | table | vc | 8192 bytes |
      vc | cl_vcenter_task | table | vc | 0 bytes |
      vc | iso_vcenter_task | table | vc | 0 bytes |
      vc | ovf_vcenter_task | table | vc | 0 bytes |
      vc | vdc_entity_lock | table | vc | 8192 bytes |
      vc | vdc_entity_lock_metadata | table | vc | 8192 bytes |
      vc | vdc_simple_activity | table | vc | 8192 bytes |
      vc | vdc_simple_activity_parameter | table | vc | 8192 bytes |
      vc | vpx_access | table | vc | 8192 bytes |
      vc | vpx_access_seq | sequence | vc | 8192 bytes |
      vc | vpx_access_surr_key_seq | sequence | vc | 8192 bytes |
      vc | vpx_alarm | table | vc | 128 kB |
      vc | vpx_alarm_action | table | vc | 64 kB |
      vc | vpx_alarm_disabled_actions | table | vc | 0 bytes |
      vc | vpx_alarm_expr_comp | table | vc | 88 kB |

    • Run SQL Statements using Standard SQL syntax.

      Note:
      Ensure to end the statement with a semi-colon (;)


      Example:
      SELECT * FROM VPX_VERSION;
      SELECT * FROM VPX_HOST;

    • Run this command to quit psql:

      \q

See Also

Language Editions

ja,2148108;zh_cn,2148273

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 1 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 1 Ratings
Actions
KB: