How to connect/interact with VCVA DB (DB2 and vPostgres)

How to connect/interact with VCVA DB (DB2 and vPostgres)

If you need to connect/interact with the VC appliance database, for example to remove the locks of DB2 or performing an script, you can do the following after being logged in as root via SSH on the appliance:

- On VCVA 5.0 GA with DB2:

1. Turn into the db2inst user:

vcenter:/ # su db2inst1

2. Start the db2 client:

db2inst1@vcenter:/> db2

You'll see a prompt like this:

db2 =>

3. connect to the VCDB database:

db2 => connect to VCDB

(the command is like this, very literal)

4. Change to VC schema:

db2 => set schema vc

5. Perform any command you need. For example, to remove the VPX_SESSIONLOCK lines, you can do like this:

db2 => delete from VPX_SESSIONLOCK
DB20000I  The SQL command completed successfully.

You can type "quit" anytime you want to exit from the db2 client, and "exit" when you want to go back to root userspace.

- On VCVA with vPostgres:

1. Connect to the database using psql:

vcenter:/ # /opt/vmware/vpostgres/1.0/bin/psql -U vc -d VCDB

You'll see a prompt like this:

psql (9.0.4)
Type "help" for help.

VCDB=>

2. Perform any command you need (selects, inserts, etc). For example, to list all tables:

VCDB=> \dt

There are a lot of new tables in 5.1, (mainly the vpx_hist_stat* ones).

To quit, just type "\q"

Hope this helps Smiley Happy

Version history
Revision #:
1 of 1
Last update:
‎11-02-2012 12:09 PM
Updated by: