Home  >  Article  >  Database  >  How to delete partition data in Oracle

How to delete partition data in Oracle

青灯夜游
青灯夜游Original
2022-03-16 17:24:2414851browse

How to delete partition data in oracle: 1. Use the "alter table table name DROP PARTITION name of the partition in the table;" statement to delete; 2. Use "alter table table name TRUNCATE PARTITION name of the partition in the table;" ” statement to delete.

How to delete partition data in Oracle

The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.

Oracle In actual business production environments, we often encounter that as the business volume gradually increases, the number of data rows in the table increases, and Oracle's impact on the management and performance of the table also increases.

The time for querying the data in the table and backing up the table will be greatly increased, and under certain circumstances, it will take more time to restore the data in the table as the amount of data increases. time.

At this time, Oracle database provides a partitioning mechanism, which divides the rows in a table into several parts. Can reduce management and performance issues of big data scales. The mechanism that uses this partitioning method to divide table data is called table partitioning, and each partition is called a partition table.

oracle delete partition data

Method 1: Delete partition by deleting partition

Delete partition , the data is also automatically deleted. Syntax:

alter table 表名 DROP PARTITION 表中分区的名称;

After deleting the partitions and data in the table, the indexes will become invalid. It is recommended to delete all indexes in the table after deleting the partitions, and then re-establish the indexes.

Method 2: Clear data

Syntax:

alter table 表名 TRUNCATE PARTITION 表中分区的名称;

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to delete partition data in Oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn