Adil
Adil

Reputation: 111

If I alter a table to add a partition will I lose data in Oracle SQL?

I am not sure about altering a table to create a new partition as I am afraid I will lose data. If a table in an Oracle SQL DB is already partitioned but I am adding a new partition, will the existing data in the table be deleted?

Upvotes: 3

Views: 480

Answers (2)

CompEng
CompEng

Reputation: 7376

No you dont lose the data

You can create list partition and expand it on default partition

for example if your partion is date:

alter table your_table split partition PDEFAULT values(TO_DATE('20161206','yyyymmdd')) into ( partition P20161206,partition PDEFAULT)

Upvotes: 1

David Aldridge
David Aldridge

Reputation: 52336

The only ALTER TABLE partitioning commands that can destroy data are DROP and TRUNCATE.

The EXCHANGE partition command can move data from a table partition to a different table, and vice-versa.

ADD, MOVE, COALESCE, RENAME, SPLIT, and MERGE do not change the table's data, although COALESCE, SPLIT, and MERGE can change the partition or subpartition in which data is stored.

Upvotes: 1

Related Questions