WebSphere Issues

08/11/2010

DB2 usefull commands

Filed under: DB2, Linux — Ishtiaque @ 9:00 am
Purpose Command
Start and Stop DB2 server db2start and db2stop (db2stop force)
Restart a database db2 restart db sample
Start and Stop HADR for a db as primary db2 deactivate db sample

db2 start hadr on db sample as primary

db2 stop hadr on db sample as primary

Start and Stop HADR for a db as standby db2 deactivate db sample

db2 start hadr on db sample as standby

db2 stop hadr on db sample as standby

View  the status of HADR db db2 get snapshot for db on sample | grep State

db2pd –d sample –hadr

List db directory db2 list db directory
List  node directory db2 list node directory
List actiave databases db2 list active databases
Initialize db2 command line db2cmd
Connect to a db db2 connect to sample user db2admin using pwd
Disconnect from a db db2 disconnect
List all environment variables db2set –lr
Update a db config parameter db2 update db cfg for sample using param value
Update a dbm config parameter db2 update dbm cfg using param value
List all paramter of a db db2 get db cfg for sample
List all parameter of dbm db2 get dbm cfg
To query a db2 client db2 query client
To set a client parameter db2 set client MAX_NETBIOS_CONNECTIONS 254
Execute a SQL script db2 -tvf /opt/sqlscript.sql
To disconnect or stop all apps d2b force application all
View active db2 process status db2_local_ps
List all applications db2 list applications show details
List tablesspaces of a db db2 list tablespaces show detail
Lsit tables of a db db2 list tables
Rollforward a db db2 rollforward db sample to end of logs and complete
List agents and apps of a db db2pd -db “sample” -applications –agents
Catalog a db node db2 catalog tcpip node db2node remote  [hostname|ip_address] server [svcename|port_number]
Uncatalog a db node db2 uncatalog node node_name
Cataloga  a db catalog database sample as mysample at node db2node
Uncatalog a db db2 uncatalog db sample
List and Update db2 license db2licm -l (-a option will udpate license)
View db2 version db2level
Update number of active databases db2 udpate dbm cfg using NUMDB 12
Backup a db db2 backup db sample to /opt/db2
Restore a db db2 restore db sample from  /opt/db2
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: