DB2 Database

 

+
Search Tips   |   Advanced Search


  1. DB2 Version
  2. Catalog
  3. Connect to database
  4. Settings
  5. Common DB2 commands


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.

  1. Create python script...

      ### extract.py
      AdminTask.extractConfigProperties('[-propertiesFileName WC_MyCo_config.properties]')

  2. Create script to parse dbnames, hosts, and ports

    ./mkcatalog.sh

  3. 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 directory


Connect 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 = DAT012SA

List information...


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

  1. DB2 database product documentation
  2. DB2 Connect v7