DB2 SQL statements commonly used in backup and restore

Source: Internet
Author: User
Tags db2 connect db2 connect to db2 sql statements

Initializing the Environment

0. Start Db2start

1.CMD Environment Input Db2cmd New Open DB2 Action window

2. Connect to the database DB2 connect to Db_name

3. In the local Host BACKUP statement DB2 BACKUP DATABASE db_name to D:

Timestamp when backup image was successfully backed up

4. Create a database in this environment DB2 create databases Db_name

DB2 CREATE DATABASE pb_db using CodeSet GBK territory ZH_CN pagesize 8192---building;

DB2 Connect to pb_db---connection;

DB2 Create Bufferpool testpool size pagesize 32k--Temporary tablespace buffer pool;

DB2 Create temporary Tablespace temp (tablespace_name) pagesize 32k managed by database using the path \ file where the files ' database is located. ' 5 Extentsize bufferpool testpool-temporary table space;

------View the tablespace for a database

DB2 List tablespaces Show Detail

Command completed successfully

5. Connect to the database

DB2 Connect to Db_name

6. DB2 RESTORE Database Old_name from D:\ (write only to the root directory where the backup file resides) taken at 201722 to New_name

Error sql2542n--table space not backed up, requires redirection of tablespace backup

DB2 SQL statements commonly used in backup and restore

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.