473,611 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Partition -2

debasisdas
8,127 Recognized Expert Expert
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 3779

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

Similar topics

41
3528
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 pairs, each pair indicates the sameness of the two indexes. Returns a partitioned list of same indexes.
1
5679
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 a problem with recreating the SliceValue. The value is a time dimension and should equate to ... and instead it is these same values, but instead of being seperated by periods it has some sort of non-displayable character (maybe a newline)...
30
6073
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 typedefed as typedef long off_t; I wanted to know what advantage do we get by typedefs ? Why we did not declare
4
6076
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. So if I enter in data like the following in my part_table:
1
4952
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 inter-partition and intra-partition? Is inter-partition database partition...?
3
4341
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 values less than (50001), 3 partition p2_si values less than (100001),
0
12965
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 statistics and if the cost-based Approach is used , then statistics should be gernerated for all tables, clusters, and all types of indexes accessed by SQL statements. If the size and data distribution of your tables change frequently, then...
0
3415
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
3626
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 giving us the option to detach old partitions. For example: CREATE TABLE orders(id INT, shipdate DATE, …) PARTITION BY RANGE(shipdate) ( PARTITION m12y05 STARTING MINVALUE,
0
8149
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8097
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8596
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8411
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7038
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4042
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2546
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.