DB2 Common Commands and techniques

Source: Internet
Author: User
Tags db2 empty

Here will tell you a few dbase:db2 common commands and skills, hope that through these commands and skills, can simplify everyone's work, improve efficiency.

1.DB2 inside the string connection can be "| |" This is connected

2. How to quickly delete a large number of data tables (test is a database table)

The most commonly used statement: Delete from Test, but it is inefficient and takes too long because the database log is logged when data is deleted.

Import from/dev/null of Del Replace into test//emptied first, then imports data (because the imported file is empty, which is equivalent to emptying the table data), this deletion is faster

ALTER table test Activate not logged initially with EMPTY table; Deletes the data in the table without logging, which is the fastest

3. Import, export data, supported files have ixf,del files

DB2 import data from a table into a file in the//db2 of "Export to Filename.del of del select * FROM tablename"

DB2 "Import from Filename.del to del INSERT INTO TableName"//db2 the data in the file into the table

Check if the table already exists in 4.DB2

SELECT * from "SYSIBM". " Systables "where lower (name) = ' Afa_maintransdtl '

5. Deal with DB2 lock table problem:

DB2 "Connect to AFA"

DB2 "Get snapshot to Locks on instance name"

DB2 "Terminate"

Then look at the relevant information, locate the locked table, and execute the following statement:

DB2 "Force application (application handle) Note: Application handle corresponds to an integer

6. When the stored procedure is created on the server:

You should specify a specific newline character for the stored procedure, and then execute the following statement:

db2-td@-VF Filename.sql (where @ is the line feed specified in the stored procedure)

7. See if the index works

Runstats on table AFA.YJ_JYWTK with distribution and detailed indexes all;

8. Intercepting database snapshots:

DB2 "Connect to Instance name"

DB2 ' Update monitor switches using lock on ' bufferpool on ' uow on ' table on ' statement on '

DB2 "Get snapshot to all" instance name

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.