Oracle create partition Table __oracle

Source: Internet
Author: User
-----Create a table space
Create tablespace mytablespace_1 datafile ' c:/oracle/product/10.1.0/oradata/mydata/mytablespace1.dbf '
 size 100m Extent management Local uniform size 256K
 
  Create tablespace mytablespace_2 datafile ' c:/oracle/product/10.1.0/ ORADATA/MYDATA/MYTABLESPACE2.DBF '
 size 100m extent management local uniform size 256K
 
   Create tablespace Mytablespace_3 datafile ' c:/oracle/product/10.1.0/oradata/mydata/mytablespace3.dbf '
 size 100m extent management Local Uniform size 256k</span>

-----Create partitions
CREATE TABLE MyTest
 (
        ID number,
        name NVARCHAR2) partition by
 range (ID)
 (
  Partition T1 values less than (MB) tablespace mytablespace_1, partition
  T2 values less than (1000) tablespace myTable space_2,
  partition T3 values less than (MaxValue) tablespace mytablespace_3)-----Setup table can modify
ALTER TABLE MYTEST2 Enable Row movement;</span>



-----Insert data into a partitioned table

INSERT into MyTest values (' f1111 ');
  INSERT into MyTest values (' f1112 ');
  INSERT into MyTest values (M, ' f1112 ');
  INSERT into MyTest values (' f1112 ');
  INSERT into MyTest values (1001, ' f1112 ');
  Commit;</span>



------Query Partition Table
  SELECT * FROM MyTest
 
  select * MyTest partition (T1);
  SELECT * from MyTest partition (T2);
  SELECT * from MyTest partition (T3);</span>



------Deletes a table partition, while data from some table partitions will also be deleted
  ALTER TABLE myTest DROP PARTITION T3; </span>


------Inserts a table partition that must be inserted at the maximum table partition
  ALTER TABLE MyTest add partition T3 values less than (10000) tablespace mytablespace_3;</span>


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.