473,320 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,320 developers and data experts.

Using Partition -2

debasisdas
8,127 Expert 4TB
SAMPLE CODE TO CREATE SUB PARTITIONS
=======================================
RANGE-HASH-9i
-------------------------
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE SUBPART
  2. (
  3. ID NUMBER(10) PRIMARY KEY,
  4. NAME VARCHAR2(20)
  5. )
  6. PARTITION BY RANGE(ID)
  7. SUBPARTITION BY HASH(NAME)
  8. SUBPARTITIONS 3
  9. (
  10. PARTITION P1 VALUES LESS THAN(10),
  11. PARTITION P2 VALUES LESS THAN(20),
  12. PARTITION P3 VALUES LESS THAN(MAXVALUE)
  13. );
  14.  
in this case external partiton is by RANGE
and the internal (sub) partiton is by HASH

In the above example it creates 3 sub-partitions with in each partitons.


SAMPLE CODE TO CREATE SUB PARTITIONS
=======================================
RANGE-LIST-as per 10g
------------------------------------
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE RL
  2. (
  3. ID NUMBER(10) PRIMARY KEY,
  4. NAME VARCHAR2(20)
  5. )
  6. PARTITION BY RANGE(ID)
  7. SUBPARTITION BY LIST(NAME)
  8. (
  9. PARTITION P1 VALUES LESS THAN(10)
  10. (
  11. SUBPARTITION PP1 VALUES ('A','B'),
  12. SUBPARTITION PP2 VALUES ('C','D')
  13. ),
  14. PARTITION P2 VALUES LESS THAN(20)
  15. (
  16. SUBPARTITION PP3 VALUES ('A','B'),
  17. SUBPARTITION PP4 VALUES ('C','D')
  18. )
  19. )
  20.  

Try this code only in release 10.

In this case the main partition is by RANGE and the sub-partition is by LIST

Spliting Existing Partition
-------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Alter Table <t.n.> Split Partition P1 At (10) Into 
  2. (partition P3,partition P4);
  3.  

Merging Existing Partitions
-------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Alter Table <t.n.>
  2. Merge Partitions P1,p2 Into Partition P3;
  3.  
------------------
Exchanging Partitions
-------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Alter Table <t.n.>
  2. Exchange Partition P1 With Table<t.n.>including/excluding Indexes With/without Validation
  3.  
restrictions For Partitioned Table
================================
1.partitions Can Be Merged Or Splitted Only To Same Type.

2.partition Can't Be Added To A Non-partitioned Table.

3.if A Partition Is Dropped It Will Be Dropped Along With All Its Records.

4.the Last Existing Partition Can't Be Removed From A Partitioned Table. For That Drop The Table Itself.

5.if Maxvalue Is Specified In The Last Partition At The Time Of Table Creation, Another Partition Can't Be Added To The Table Having Range More That The Last Existing Partition.

6.if A Table Is Created By Copying The Structure Of The Table,the Partitions Of The Source Table Will Not Be Copied To The New Table.
May 28 '07 #1
0 3756

Sign in to post your reply or Sign up for a free account.

Similar topics

41
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
1
by: Mark Dengler | last post by:
I am trying to write a C# backend program that will handle the database maintenance that I would otherwise have to do via Microsoft's Analysis Services front end GUI Wizards. Currently I am having...
30
by: junky_fellow | last post by:
I was looking at the source code of linux or open BSD. What I found that lots of typedefs were used. For example, consider the offset in a file. It was declared as off_t offset; and off_t is...
4
by: eavery | last post by:
I can't seem to find a way to do the following: create table part_table ( col1 int, col2 datetime ) on psX (datename(week,col2)) I want to partition based on the week number of a date field....
1
by: Laurence | last post by:
Hi folks, As I konw: database partition (aka data partition?), the database can span multiple machines; table partition, the data within a table can seperate by certain condition. How about...
3
by: nbajrach | last post by:
how to partition on a table if table already exits without any partition. This is what i tried but gave me error SQL> alter table sip add partition by range(si_id) 2 partition p1_si...
0
by: Vinod Sadanandan | last post by:
Table Partition Performance analysis ============================================ Collection of Statistics for Cost-Based Optimization/DBMS_STATS vs. ANALYZE The cost-based approach relies on...
0
debasisdas
by: debasisdas | last post by:
USING PARTITION =================== PARTITION BY RANGE-as per Oracle 8 -------------------------------------- CREATE TABLE RANGEPART ( ID NUMBER(2) PRIMARY KEY, NAME VARCHAR2(20) )
3
by: Justin | last post by:
What is the syntax to overlap partitions? Lets assume I want a year split amount 4 months (3 partitions for a year) and later adding an additional set of partitions for every 6 months. Plus...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.