Pages

Saturday, November 5, 2011

Using DB2 from command prompt


you have to connect to a database. To connect to a database, enter the command:
db2 CONNECT TO MAXDB72 USER userID USING password
To connect to a database, and have DB2 prompt you for the password, issue the command:
db2 CONNECT TO MAXDB72 USER userID
To connect to a database using the default user ID, issue the command:
db2 CONNECT TO MAXDB72
select all of the rows from the EMPLOYEE table in the Asset database, issue this command:
db2 "SELECT * FROM employee"

List down all Instances
db2ilist
list down active instances
db2 list active databases
List all databases in an instance
db2 list db directory

Checking db2 running or not

bash-3.00$ netstat  -an | grep 50000
bash-3.00$ ps   -eaf |  grep db2
bash-3.00$ ps   -eaf |  grep db2sysc 

No comments:

Post a Comment