The following articles mainly describe the DB2 online backup and redirection recovery. If you are interested in the actual operations related to DB2 online backup and redirection recovery, you can click to view the following articles. The following describes the specific solution and hope it will be helpful for your future study.
Online
Objective: To back up the database server and redirect the backup to the local database.
1. First, execute the following command on the database server to perform full DB2 online backup (including logs) (db2? Backup allows you to view the backup help information)
- Db2 backup db wdcs online to E: \ Allan include logs timestamp is 20100420093345
Copy the backup image to the local C: \ temp path.
2. Run the following command on the database server to view the current tablespace in the database.
- db2 list tablespaces show detail
3. Create a tablespace container for the original database locally. Run the following command in the cmd window:
- mkdir C:\DB2 \NODE0000\wdcs\syscatspace C:\DB2 \NODE0000\wdcs\indexspace1
- C:\DB2 \NODE0000\wdcs\systoolspace C:\DB2 \NODE0000\wdcs\systoolstmpspace
- C:\DB2 \NODE0000\wdcs\tablespace1 C:\DB2 \NODE0000\wdcs\tempspace1 C:\DB2 \NODE0000\wdcs\userspace1
4. create a local empty database wdcs with the same name as the database server: create db wdcs
5. Start executing the database recovery command on the local machine (Save the specified log storage path as C: \ db2workspace \ wdcs_log)
- db2 restore db wdcs from c:\temp taken at 20100420093345 into wdcs logtarget c:\db2workspace\wdcs_log redirect
You are prompted to specify the storage container path.
6. specify the container for the tablespace of the local database to be restored and run the following commands (numbers:, and 8 are the tablespace IDs of the source database, the path after path is the path created in step 3rd above. The ID number and path correspond one to one. The final file "c: \ db2workspace \ wdcscontainer \ dms. dat "50000; file" c: \ db2workspace \ wdcscontainer \ index. dat "50000 is the tablespace container that re-establishes the database management type)
- db2 set tablespace containers for 0 using (path "c:\DB2\node0000\wdcs\syscatspace")
- db2 set tablespace containers for 1 using (path "c:\DB2\node0000\wdcs\tempspace1")
- db2 set tablespace containers for 2 using (path "c:\DB2\node0000\wdcs\userspace1")
- db2 set tablespace containers for 3 using (path "c:\DB2\node0000\wdcs\systoolspace")
- db2 set tablespace containers for 4 using (path "c:\DB2\node0000\wdcs\tablespace1")
- db2 set tablespace containers for 5 using (path "c:\DB2\node0000\wdcs\indexspace1")
- db2 set tablespace containers for 6 using (path "c:\DB2\node0000\wdcs\systoolstmpspace")
- db2 set tablespace containers for 7 using (file "c:\db2workspace\wdcscontainer\dms.dat" 50000)
- db2 set tablespace containers for 8 using (file "c:\db2workspace\wdcscontainer\index.dat" 50000)
7. then proceed with the recovery:
- db2 restore db wdcs continue
8. Finally, execute the prefix:
- db2 rollforward db wdcs to end of logs and stop overflow log path (C:\db2workspace\wdcs_log)
The above content is an introduction to online DB2 backup and redirection recovery. I hope you will get some benefits.