SIGN UP MEMBER LOGIN:    
Blog

Database back up in DB2

Posted by John Milton Blogs | DB2 Dec 27, 2011
In this blog We will look database backup in DB2.

The DB2 backup command allows you to take a snapshot copy of your database at the time the command is executed. The simplest syntax that you can use to run this commands:

BACKUP DATABASE <dbname> [ TO <path> ]

Most commands and utilities can be performed online or offline. Online implies that other
users may be connected and performing operations on the database while you execute
your command. Offline means that no other users are connected to the database while you
perform your operation. To allow for an online operation, add the key word ONLINE to thecommand syntax, otherwise, by default the command will be assuming you are executing it offline.

 
For example, if you want to back up the database SAMPLE to the path C:\BACKUPS you
can issue this command from the DB2 Command Window or Linux shell:
db2 BACKUP DB sample TO C:\BACKUPS

db2 BACKUP DB sample TO C:\BACKUPS

C:\BACKUPS directory must exist prior to executing the command. Also
e n sure there are no connections to the database when you execute the above command,
otherwise you will receive an error message since an offline backup cannot be performed
when there are connections.
To find out if there are connections to databases in an instance, issue this command from
the DB2 command window or Linux shell:

db2 list applications

To force all the connections from all databases in an instance, issue this command from
the DB2 command window or Linux shell:

db2 force applications all

You may not want to run this last command in a production environment with many users;
otherwise you would receive many calls from an - workers! Note as well that the last command runs asynchronously. This means than when you try to run the backup command right after, it may still not work. Wait a few seconds, and repeat the backup command if you received an error the first time.

share this blog :
post comment