cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to DB2 database

Former Member
0 Kudos

Hi,

When iam monitoring databases In sql im connecting to database through sql enterprise,in oracle iam connecting thorugh sqlplus "/as sysdba" command.how i have to connect in db2 database to monitor the db2 database.

Thanku

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

the equivalent of sqlplus in DB2 is db2. But the behavior is somehow different, db2 is the command line tool which starts a background process holding the connection to the database. The background process is called db2bp. If you have some statements to be executed against the database, you may write them into a file and start the script with:

 
db2 -tf <file name> -z <output> 

or if you want to get the statement within the output:

 
db2 -tvf <file name> -z <output> 

The option -t means that commands are separated by semicolons.

To get a connect like "/ as sysdba" you may use "connect to <SID>" because as Beck wrote the db2<sid> user is the equivalent of the sys user in Oracle. In DB2 all users (not schemas) are OS users. DB2 uses the OS to authenticate users, but you have to allow a user to connect to the database if you don't open your database for public (this is default for DB2, but not in SAP environment).

Hope this helps.

Best regards

Ralph

Former Member
0 Kudos

Hi,

For the db2 databse any gui is there like in sql --enterprise manager,in maxdb --dbgui.

Thanku

Former Member
0 Kudos

Hi,

yes there is a Control Center which is a Java application. It has more or less the same functionality as the other tools you mentioned.

Regards

Ralph

Former Member
0 Kudos

Hi Kumarraju,

In a SAP system you can use transaction ST04 (DBACOCKPIT) to administer your database. With it you have a nice distribution of the different tasks related to the administration and monitoring of your DB2 instance and databases.

On the other hand, as part of your installation, you should also have the DB2 Control Center. In Windows look for it in the Start->Programs menu or in Unix type db2cc with your environment (DB2 variables and display information) properly set. From there you can launch another tool, db2 Command Editor, to enter your SQL statements graphically.

In this link, you find a brief description of the different tools available in DB2:

[http://www.ibm.com/developerworks/edu/dm-dw-db2-cert7301.html]

The document is part of series of tutorials covering the basics skills to get the entry certification for DB2.

Regards, Edgardo

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kumarraju,

You may use the user db2<sid>, which is like the Unix's root user for a DB2 instance.

Besides, when you perform a

su - db2<sid>

where <sid> is your SAP sytem id, you get the environment properly set.

Hope this helps

Best regards, Edgardo.