DB2 database backup and recovery

Source: Internet
Author: User

The db2 tutorial is: backup and recovery of the DB2 database. Recently, I have recovered a database, and I want to write some of the statements I have used, which is the same as xdjm that has encountered the same problem.
First, let's talk about the backup of the db2 database. I use the backup command.
Db2 backup database name (my database is jsdb)
I forgot to mention that you need to stop the database you want to back up before backup. I used db2stop force (the reason why the force parameter is used is that it is so easy to stop and save time) and db2start. This ensures that the backup is successful.
After the backup is complete, db2 will tell you a timestamp, for example, 20040831 (several digits later). In this way, a folder with the same name as your database will be generated in the current directory, for example, jsdb. This folder directory level is very important. If an error occurs, the system will prompt that the file cannot be found during recovery.
After the backup is complete, it is restored. I use the restore command.
Db2 restore database name (jsdb) taken at timestamp (20040831)
Note the following two points when executing this statement: 1. Test the backup folder to the current directory (I used a cd c: \ command to set the current directory as a drive c, test the jsdb folder to the c root directory); 2. the timestamp must be consistent with that in the jsdb directory.
In this way, the database is restored.
<

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.