Thursday, February 13, 2014

DB2 : How to restore backup of database (IBM DB2 9.7, command for Linux,Unix,Windos)

To restore the database backup from IBM command line we can use following command.

Command:- db2 restore database <DATABASE_NAME> from <LOCATION>

LOCATION is optional in the above command. In case we are not providing location, DB2 will try to restore back from the location at which command prompt is pointing currently. 

Example:- db2 restore  database SAMPLE from C:\DB2Backups

Screenshot for the above command with LOCATION


Screenshot for the above command without LOCATION

DB2 : How to take backup of database (IBM DB2 9.7, command for Linux,Unix,Windos)

To take the database backup from IBM command line we can use following command.

Backup will be observed on the given location. In case of NOT providing location in below command, backup file will be observed on location on which Command prompt is pointing.

Command:- db2 backup database <DATABASE_NAME> to <LOCATION>

LOCATION is optional in the above command.

Example:- db2 backup database SAMPLE to C:\DB2Backups





Friday, February 7, 2014

DB2 : How to Connect using username?(DB2 9.7 command for Unix,Linux,Windows)

To connect to database instance using a username different from default admin user we use 2 following Commands
1) DB2 CONNECT TO <database>  USER <username>
Example

2) DB2 CONNECT TO <database> USER <username> USING <password>

DB2 : Get a list of all databases on a DB2 instance (IBM DB2 9.7 for Linux, UNIX )

To List all the database in DB2 following command will work. This will be applicable for all the nodes added to the database.

It will return all databases "cataloged" by the instance even if they are remote databases belonging to another instance or server


COMMAND :- DB2 LIST DATABASE DIRECTORY


IBM DOCUMENTATION LINK



DB2 : Get a list of all ACTIVE databases on a DB2 instance (IBM DB2 9.7 for Linux, UNIX )

To List all the active database in DB2 following command will work. This will be applicable for all the nodes added to the database.

COMMAND :-  DB2 LIST ACTIVE DATABSES

IBM DOCUMENTATION LINK