Implementation of DB2 database backup and recovery in Linux

Source: Internet
Author: User

Today, we will focus on the actual application code for backing up and recovering DB2 databases in Linux, I saw data on the actual application code of the DB2 database backup and recovery in the Linux environment on the relevant website two days ago. I thought it was good and I would like to share it with you.

Linux, environment, database Linux, database, Environment

Restore the database backed up by the following backup script

DB2 database backup script:

 
 
  1. ./Home/db2admin/sqllib/db2profile
  2. Db2 backup db datedb online to/dbbackup/date include logs
  3. Cd/dbbackup/datetoday = 'date + "% Y % m % d "'
  4. File1 = "* $ today *"
  5. Ftpfile = 'ls $ file1'
  6. Echo $ ftpfile
  7. Lftp-c "open ftp address; user username and password @ \ $0; put $ ftpfile"
  8. Find/dbbackup/date-ctime + 15-exec rm {}\;

Recovery command:

Log on to the server using the root command and switch to the database user name using the su-db2admin command.

Go to the backup file storage directory

Run the following command:

 
 
  1. [db2admin@localhost db2back]$ db2 restore db datedb from /hom  

The above content is an introduction to the backup and recovery of the DB2 database in the Linux environment. I hope you will have some gains.

The above content is an introduction to the backup and recovery of the DB2 database in the Linux environment. I hope you will have some gains.

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.