Database creation backup and restoration for DB2 Databases

Source: Internet
Author: User

Database creation backup and restoration for DB2 Databases

Follow these steps to create a database in the Db2 environment:

1. When su-db2inst is missing, an error will occur;

2. db2 enters the db2 command line mode;

3. create database pb_db on/home/db2inst using codeset gbk territory zh_CN pagesize 8192 --- database creation;

4. connect to pb_db --- connection;

5. create bufferpool testpool size 2000 pagesize 32 k -- temporary tablespace buffer pool;

6. create temporary tablespace temp pagesize 32 k managed by database using (file '\ home \ db2inst1 \ rdl \ data' 5000) extentsize 80 bufferpool testpool -- temporary tablespace;

7. create bufferpool pbloop immediate size 1000 pagesize 32 k -- User tablespace buffer pool;

8. create regular tablespace pbxt pagesize 32 k managed by database using (file '\ home \ db2inst1 \ rdl \ data \ user' 1024 M) autoresize no extentsize 32 overhead 10.5 prefetchsize 32 transferrate 0.14 bufferpool pbloop -- User tablespace

Follow these steps to back up a Db2 database:

1. Make sure that no user uses DB2:

Db2 list applications for db pb_db;

2. Stop the database and restart it to disconnect all connections:

Db2stop fZ restart? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcmNlPC9wPgo8cD5kYjJzdGFydDs8L3A + CjxwPiA8aW1nIHNyYz0 =" http://www.2cto.com/uploadfile/Collfiles/20150203/2015020309545319.png "alt =" \ ">

3. Run the BACKUP command: (use TSM as the backup media)

Db2 backup db pb_db use tsm is successfully backed up and a timestamp is returned

Db2 backup db pb_db to/home/db2inst1/rdl/data back up the database in the data folder to generate a 001 File

The steps for restoring a Db2 database are as follows:

1. view the memo history:

Db2 list history backup all for pb_db;

2. Restore data at a certain time point:

Db2 restore database pb_db from/home/db2inst1/rdl/data taken at 20140625141510

In this case, a warning is displayed, and entering y will be 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.