Split command Split partition method

Source: Internet
Author: User
Tags split

Sql> Select partitioned from dba_tables where table_name= ' lytusage ';

PAR
---
YES


Sql> Select Partition_name,high_value from dba_tab_partitions where table_name= ' lytusage ';

Partition_name High_value
------------------------------ --------------------------------------------------------------------------------
lytusage_200401 to_date (' 2004-02-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200402 to_date (' 2004-03-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200403 to_date (' 2004-04-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200404 to_date (' 2004-05-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200405 to_date (' 2004-06-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200406 to_date (' 2004-07-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200407 to_date (' 2004-08-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200408 to_date (' 2004-09-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200409 to_date (' 2004-10-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200410 to_date (' 2004-11-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200411 to_date (' 2004-12-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200412 to_date (' 2005-01-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200501 to_date (' 2005-02-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200502 to_date (' 2005-03-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200503 to_date (' 2005-04-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200504 to_date (' 2005-05-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200505 to_date (' 2005-06-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200506 to_date (' 2005-07-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200507 to_date (' 2005-08-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200508 to_date (' 2005-09-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200509 to_date (' 2005-10-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200510 to_date (' 2005-11-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200511 to_date (' 2005-12-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200512 to_date (' 2006-01-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria

Selected rows.

Delete Partitions for January 2005 and February:
sql> ALTER TABLE lytusage drop partition lytusage_200501;

Table altered.

sql> ALTER TABLE lytusage drop partition lytusage_200502;

Table altered.

Sql> Select Partition_name,high_value,tablespace_name from dba_tab_partitions where table_name= ' LYTUSAGE ';

Partition_name High_value
------------------------------ --------------------------------------------------------------------------------
Tablespace_name
------------------------------

lytusage_200401 to_date (' 2004-02-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200402 to_date (' 2004-03-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200403 to_date (' 2004-04-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200404 to_date (' 2004-05-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200405 to_date (' 2004-06-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200406 to_date (' 2004-07-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200407 to_date (' 2004-08-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200408 to_date (' 2004-09-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200409 to_date (' 2004-10-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200410 to_date (' 2004-11-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200411 to_date (' 2004-12-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200412 to_date (' 2005-01-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200503 to_date (' 2005-04-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200504 to_date (' 2005-05-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200505 to_date (' 2005-06-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200506 to_date (' 2005-07-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200507 to_date (' 2005-08-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200508 to_date (' 2005-09-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200509 to_date (' 2005-10-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200510 to_date (' 2005-11-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200511 to_date (' 2005-12-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos

lytusage_200512 to_date (' 2006-01-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
Wacos


Rows selected.


sql> ALTER TABLE Lytusage
SPLIT PARTITION lytusage_200503 at (to_date (' 2005-03-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ')
Into (partition lytusage_200502 tablespace wacos,partition lytusage_200503 tablespace) UPDATE GLOBAL Wacos;

Table altered.

sql> ALTER TABLE Lytusage
SPLIT PARTITION lytusage_200502 at (to_date (' 2005-02-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ')
Into (partition lytusage_200501 tablespace wacos,partition lytusage_200502 tablespace) UPDATE GLOBAL Wacos;

Table altered.

Partition_name High_value
------------------------------ --------------------------------------------------------------------------------
lytusage_200412 to_date (' 2005-01-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200401 to_date (' 2004-02-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200402 to_date (' 2004-03-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200403 to_date (' 2004-04-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200404 to_date (' 2004-05-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200405 to_date (' 2004-06-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200406 to_date (' 2004-07-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200407 to_date (' 2004-08-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200408 to_date (' 2004-09-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200409 to_date (' 2004-10-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200410 to_date (' 2004-11-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200411 to_date (' 2004-12-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200503 to_date (' 2005-04-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200504 to_date (' 2005-05-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200505 to_date (' 2005-06-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200506 to_date (' 2005-07-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200507 to_date (' 2005-08-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200508 to_date (' 2005-09-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200509 to_date (' 2005-10-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200510 to_date (' 2005-11-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200511 to_date (' 2005-12-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200512 to_date (' 2006-01-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200501 to_date (' 2005-02-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria
lytusage_200502 to_date (' 2005-03-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS ', ' Nls_calendar=gregoria

Selected rows.

sql> ALTER TABLE lytusage drop partition lytusage_200511;

Table altered.

sql> ALTER TABLE lytusage drop partition lytusage_200512;

Table altered.

sql> ALTER TABLE lytusage ADD PARTITION lytusage_200511
VALUES less THAN (to_date (' 2005-12-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS '))
Tablespace Wacos
STORAGE (
INITIAL 1M
NEXT 10M
Minextents 1
Maxextents Unlimited
Pctincrease 0)
PCTFREE 5
pctused 95
nologging;

Table altered.

ALTER TABLE lytusage ADD PARTITION lytusage_200512
VALUES less THAN (to_date (' 2006-01-01 00:00:00 ', ' syyyy-mm-dd HH24:MI:SS '))
Tablespace Wacos
STORAGE (
INITIAL 1M
NEXT 10M
Minextents 1
Maxextents Unlimited
Pctincrease 0)
PCTFREE 5
pctused 95
nologging;

Table altered.



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.