Posts Tagged Database

db2 geeks – we do everything by typing commands

Catalog remote node

catalog tcpip node db2node remote hostname server service_name

uncatalog node db2node

Catalog remote DB2 databases

catalog database db_name as alias_name at node db2node

uncatalog database dbname

List all odbc data sources

list system/user odbc data sources

catalog/uncatalog system/user odbc data source <data source name>

connect to database user name using password

Run sql scripts

To run a script, enter the following command:

db2 -f script_name -o -t -z log_name

db2 –tvf script_name

Describe Table Schema

Describe table <table_name>

Describe Table Indexes

Describe indexes for table <table_name>

Create Index

Create index <index_name> on <table_name>(field1, field2….)

Create unique index <index_name> on <table_name>(field1, field2….) include (field3, field4….) ALLOW REVERSE SCANS COLLECT SAMPLED DETAILED STATISTICS

Drop Index

Drop index <index_name>

Instance-level commands(CREATE DATABASE and FORCE APPLICATION)

Eg.Reslove the table lock

attach to nodename user user name using password

list applications

force application (appid1, appid2)

OR

db2 attach to $DB2INSTANCE

db2 force application all

db2 detach

,

No Comments