Backup and recovery of DB2 database

xiaoxiao2021-03-06  71

Recently, I have recovered a database. The hard work does not give you a table, I want to write some of the statements you use, and XDJM who encounters the same problem.

First talk about the backup of the DB2 database, I use the backup command.

DB2 Backup Database Database Name (My library is JSDB)

Forgot to say, you need to stop the database you want to back up before Backup, I use DB2Stop Force (whose way to use force parameters is because so well-lazy, ":) and db2start. This ensures that it can be successfully backed.

After the backup is completed, DB2 will tell you a timestamp, for example: 20040831 (after several bits) This will generate a folder name that is the same as your database name in the current directory, for example: JSDB. This folder directory level is very important. If it is wrong, it will not be able to find a file when it is recovered.

After the backup is completed, it is restored, I use the restore command.

DB2 RESTORE DATABASE Database Name (JSDB) Taken At Time Stamp (20040831)

Doing this statement should pay attention to two points: 1, to pin up the backup file to the current directory (I used a CD C: / command to set the current directory as a C disk, put the JSDB file to the root directory of the C drive); 2, the timestamp and the consistency in the JSDB directory.

In this way, the recovery database is completed.

转载请注明原文地址:https://www.9cbs.com/read-121319.html

New Post(0)