[DB2 learning Document 6] database operations

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

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

1. Create a database
DB2 create databaseDb_name
2. delete a database
DB2 DROP DATABASE DB

3. Connect to the database
DB2 connect to sample
4. Disconnect the database
Connect Reset
Terminate)
(The above two can be disconnected during work)
Disconnect
(A task cannot be disconnected)
5. Back up the database
Check the activity: DB2 list active databases
Back up DB2 backup database sample if no activity exists
For more information about the operations, see document 16-regular backup.
6. Restore the database
DB2 Restore database sample
7. Change the size of DB2 log Space

Note: The following command is used only for DB2 on the developer's own machine to prevent the DB2 database from using hard disk space excessively. If it is a server, the parameter needs to be modified.

DB2 update dB CFG for using logretain off logprimary 3 logsecond 2 logfilsiz 25600;

If the page size is 4 kb, the preceding command creates three 100 MB log files, occupying 300 MB of hard disk space. 25600 * 4kb = 102400kb.

8. database administration server (DAS)

It is a background process used for remote graphical management.

In Linux and UNIX, you need to create a das user. The db2adminserver variable contains the user value.

The command is as follows:

Db2admin start starts the DAS.
Db2admin stop stops the DAS.
Dascrt creates the DAS in Linux and UNIX.
Dasdrop drops the DAS in Linux and UNIX.
Db2admin create creates the DAS in windows.
Db2admin drop drops the DAS in windows.
Get admin CFG displays the DAS admin configuration file.
Update admin CFG updates the DAS admin configuration file.
Reset admin CFG resets the DAS admin configuration file to its default values.

9. Use db2governor for record

The command db2govd can be used to record almost all behaviors and events. This is an advanced management command and is not described yet ~

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

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.