Get DB2 Version
$ db2level
DB21085I Instance "db2con01" uses "64" bits and DB2 code release "SQL09073" with level identifier "08040107".
Informational tokens are "DB2 v9.7.0.3", "special_25384", "IP23092_25384", and Fix Pack "3".
Product is installed at "/opt/db2/db2_97_03".Catalog
To automatically generate required SQL for cataloging databases.
- Create python script...
### extract.py
AdminTask.extractConfigProperties('[-propertiesFileName WC_MyCo_config.properties]')- Create script to parse dbnames, hosts, and ports
./mkcatalog.sh- Here is output that is currently generated...
db2 catalog tcpip node da1014sa remote s1ad6b.myco.com server 50141
db2 catalog db da1014sa as da1014sa at node da1014sa
db2 catalog tcpip node stg014sa remote s1qa4b.myco.com server 50140
db2 catalog db stg014sa as stg014sa at node stg014sa
db2 catalog tcpip node stg012sa remote s1qa8b.myco.com server 50120
db2 catalog db stg012sa as stg012sa at node stg012sa
db2 catalog tcpip node stg012sa remote s1qa8b.myco.com server 50120
db2 catalog db stg012sa as stg012sa at node stg012sa
db2 catalog tcpip node ds1012sa remote s1st5b.myco.com server 50121
db2 catalog db ds1012sa as ds1012sa at node ds1012sa
db2 catalog tcpip node DS1014SA remote s1st6b.myco.com server 50141
db2 catalog db DS1014SA as DS1014SA at node DS1014SA
db2 list node directoryConnect to database
For example...
db2con01@s1ad7a: /opt/db/db2/instance/db2con01> db2 connect to db001sa user pocsa12 using foo
Database Connection Information
Database server = DB2/AIX64 9.7.3
SQL authorization ID = POCSA12
Local database alias = DAT012SAList information...
qasa14@s1qa4b: /opt/db/db2/instance/qasa14> db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias = STG014SA Database name = STG014SA Local database directory = /opt/db/db2/dbdir/qasa14/stg014sa Database release level = d.00 Comment = WCS71 QA STAGE DATABASE Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number = PORT number 50140
Database settings
PROD
update database configuration for prd01a using stmtheap 60000;
update database configuration for prd01a using locklist 250000;
update database configuration for prd01a using maxlocks 80;
update database configuration for prd01a using pckcachesz 60000;STAGE
update database configuration for stg012sa using stmtheap 60000;
update database configuration for stg012sa using locklist 80000;
update database configuration for stg012sa using maxlocks 80;
update database configuration for stg012sa using pckcachesz 60000;See DB Admin for more info.
See also