How to Restore Database from online backup?
If you have an online backup that has the database test with the Time stamp (T1). The steps to take the online backup can be viewed at for DB2 Online Backup. Recovery is required due to data loss for various reasons or records that might have been deleted by mistakenly. Then to restore from the online backup image that is taken with the Timestamp T1 that issues the following command. Then for this close all the applications that uses the database that issues the following command.
db2 force applications all
now you need to issue the command to restore
For Windows : db2 restore db test from d:/db2onlinebkp taken at T1 into test without prompting
Here is the db2onlinebkp is the folder where the online backup image that is kept. If it is kept ion the current path, then there is no need to give from /db2onlinebkp. If you give the command without “without prompting”, then it gives warning on the screen. Here you have the online backup image name and target database name is same (test). Assume that the online backup image name is dbbkp , then the command will be db2 restore db dbbkp from /db2onlinebkp taken at T1 into test without prompting.
Now suppose that database backup is restored is successful, let us connect to the database db2 then connect to test.
Then this following error will be displayed
SQL1117N A connection to or activation of database “TEST” cannot be made because of ROLL-FORWARD PENDING. SQLSTATE=57019
Then the above error will be displayed, because any transaction occurred during the online backup which is written into the database transaction logs. The transaction that is not available with the online backup image, the activities that happened during the online backup are not updated. So it is mandatory to do Roll Forward operation to its minimum point in time or end of logs that is before the database is made available.
So you need to roll forward to the end of logs, the following command:
db2 rollforward db test to end of logs and stop
this will display the following status.
Rollforward Status
Input database alias = test
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0000002.LOG – S0000005.LOG
Last committed transaction = 2011-10-10-20.28.50.000000
DB20000I The ROLLFORWARD command completed successfully.
Note : Then you need to enter the stop the keyword at the end of rollforward command is very important that indicates the database that are made available of the users connections after all the transaction logs that is applied on the database.
If this does not help you then you can recover or access the data of the db2 files by repairing the db2 file. This tool is available in market that helps you to repair your db2 file but all the software that is available for this task that are not trusted some can also destroy your db2 file permanently. So if you want to recover your db2 file without loss of any data then DB2 File Repair Tool is the best software for you that help you to repair your entire corrupted or inaccessible db2 file without losing any data. This tool automatically collects list of all databases that are stored at any default location of db2 and recover desired database.
Steps to Restore Database from online backup:
Step 1: Download, Install and Run DB2 File Repair software. It will provides two options to repair db2 file, first option is for if the database is attached to DB2, then you can select the option ‘Repair the database stored at default location‘, and if the database is not attached to DB2 then choose the manual selection of database.
Step 2: It will provide you the list of database attached to DB2. Select the particular database you want to repair and recover corresponding database objects.
Step 3: In this step this tool provide the list of recoverable database files. You can see the preview by clicking on it.
Step 4: Give the path location for the recoverable database and its object to be saved. Click on ‘Ok’ button.
222 Total Views 2 Views Today