Oracle Partitioning table Learning and application

Source: Internet
Author: User
Tags create index
Oracle-CREATE TABLE (creating a partition Table)
CREATE TABLE Bill_monthfee_zero
(
SERV_ID number is not NULL,
Billing_cycle_month Number (6) is not NULL,
Date_type number (1),
ACC_NBR VARCHAR2 (80)
)
Partition by range (Billing_cycle_month)
(partition p_200407 values less than (200407)
Tablespace Ts_ziken
Storage (initial 100k next 100k minextents 1 maxextents Unlimited pctincrease 0),
Partition p_200408 values less than (200408)
Tablespace Ts_ziken
Storage (initial 100k next 100k minextents 1 maxextents unlimited pctincrease 0))
;
Create INDEX idx_bill_monthfee_zero_idx01 on Bill_monthfee_zero (billing_cycle_month)
Tablespace Ts_ziken_idx
Storage (initial 100k next 100k minextents 1 maxextents unlimited pctincrease 0) nologging;
Grant all on Bill_monthfee_zero to Dxsq_dev; --Increase the partition Table ALTER TABLE Bill_monthfee_zero add Partition p_200409
Values less than (200409) tablespace Ts_ziken;
--Delete a partition
ALTER TABLE PART_TBL drop Partition part_tbl_08; --divides a partition into two partitions
ALTER TABLE Bill_monthfee_zero split Partition p_200409 at (200409)
Into (Partition p_200409_1 tablespace Ts_ziken,
Partition p_200409_2 tablespace ts_ziken_idx); --Merge partitions
ALTER TABLE Bill_monthfee_zero
MERGE partitions p_200408, p_200409 into PARTITION p_all--rename partition ALTER TABLE Bill_monthfee_zero rename PARTITION p_200408 t o p_fee_200408--Change the partition table space ALTER TABLE Bill_monthfee_zero move Partition p_200409
Tablespace ts_ziken_01 nologging--Querying specific partitions
Select COUNT (*) from Bill_monthfee_zero partition (p_200407); --Add data
INSERT INTO Bill_monthfee_zero SELECT * Bill_monthfee_zero partition (p_200407)--Export of partitioned tables userid=dxsq/ teledoone@jndxsq154
buffer=102400
tables=bill_monthfee:p_200401,
File=e:\exp_para\exp_dxsq_tables.dmp
Log=e:\exp_para\exp_dxsq_tables.log Tip: Delete a field in a table: ALTER TABLE Bill_monthfee_zero set unused column date_type; Add a field: Alter TABLE Bill_monthfee_zero add date_type number (1);

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.