Before making any changes to the database, make a back up of the database and store the backup in a secure location.
cd /opt/rsa/am/utils
./rsautil manage-readonly-dbusers -a create -o ocadmin -u rouser -i <IP address where SSH is enabled>
Enter Operations Console (OC) password: <enter Operations Console admin user name>
Enter password for the read-only database user: <enter password for the read-only user>
Confirm password for the read-only database user: <confirm password for the read-only user>
Executing action: 'create'.
Trusted Root SSL CA certificate was copied in file '/opt/rsa/am/utils/RSAAMTrustedRootSSLCA.crt'.
'create' action complete.
cd /opt/rsa/am/pgsql/bin
./psql -h localhost -p 7050 -d db -U rouser -c 'SELECT name FROM am_host;'
Password for user rouser: <enter password for the read-only database user>
name
------------------------------------
2k8r2-lac72-1.2k8r2-vcloud.local
am8p.vcloud.local
./psql -h localhost -p 7050 -d db -U rouser -o myfilename.csv -c 'SELECT name FROM am_host;'
cd /opt/rsa/am/pgsql/bin
./psql -h localhost -p 7050 -d db -U rouser -f /path_to_file/mysqlquery.sql
Password for user rouser: <enter password for the read-only database user>
cd /opt/rsa/am/pgsql/bin
./psql -h localhost -p 7050 -d db -U <read-only user>
db=> SELECT serial_number FROM rsa_rep.am_token;
serial_number
---------------
000112259786
000112259787
db=> \q