Thursday, 11 April 2013

Creation Of Database in DB2 LUW


In DB2 UDB, an instance can contain several databases

            Each database is a truly closed and independent unit.

            Each database has its own catalog table space, temporary table space, and user table space which are created by default upon successful database creation.
            DB2 UDB does contain a binary file known as the system database directory that contains entries of all the databases you can connect from your DB2 UDB machine. This directory is kept at the instance level.

            When an instance is created, no database are created by default. You need to explicitly create a database using the create database command. Or  create a database using the Control center

Syntax:

 CREATE DATABASE <dbname> AUTOMATIC STORAGE <yes/no? ON <path> DBPATH ON <path> PAGESIZE 8 K DFT_EXTENT_SZ <integer>    RESTRICTIVE



Some of the Database Commands:

db2 list db directory                 // Displays the all the databases

db2 connect to <dbname> user <uname> using <password>  

db2 disconnect <dbname>     // Completly Disconnect all db and coming to normal position.

db2 connect reset                   // Completly Disconnect all db and coming to normal position.

db2 deactivate db <dbname> // partially disconnect the db, But it will work. like hold.

db2 activate db <dbname>     //

db2 list active databases         // Display the current database.


db2 list applications                 // Display  all applications which are connect to the current db
db2 force application all           // Disconnect all applications which are connect to the current db, and db also disconnected.

If we tuning the database parameters :   db2 get db cfg for <dbname> show detail
for update db cfg parametars :   db2 update db cfg for <dbname> using <parametar name> <value>



1 comment: