Tips for DB2 data deletion

Source: Internet
Author: User

DB2 data deletion is one of our most common operations. The following describes how to delete data in DB2. If you are interested in data deletion in DB2, take a look.

Delete

When you use the delete table command to DELETE data in the entire TABLE, this operation deletes the TABLE records one by one and records them in the active transaction logs. When the data volume in the table is large, if the transaction log of the activity is not large enough, the transaction log is full and the log is rolled back.

Even if the transaction log of the activity is large enough, it takes a lot of time to delete a table with a large amount of data. This problem can be solved by importing an empty file as a data file) and replacing the REPLACE table. For example

Import from/dev/null of del replace into target table name

In this way, transaction logs only record this command and immediately release the occupied space, instead of scanning records one by one like deleting commands, this is similar to dropping the table and then creating a table that is identical but has no data.

For a table that belongs to the DMS tablespace, the DELETE command scans records one by one, and the occupied record space is still marked as used by the table without immediately releasing the space, you must use the REORG command to release the remaining space. Use list tablespace show detail to compare the remaining space in the TABLESPACE after the two commands are executed.

Using the LOAD command and the REPLACE parameter can achieve the effect similar to the IMPORT command and the REPLACE, but because the LOAD itself does not remember the log, for recoverable databases, after LOAD is complete, we recommend that you perform online backup immediately. In contrast, the IMPORT command and REPLACE operations are simpler.

DB2 event monitoring command

Implementation Process of batch execution of DB2 SQL scripts

DB2 Online Export Method

Common db2 stored procedure statements

Usage of the DB2 create server statement

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.