Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What are the partitions types available in Oracle10g. How
it will do? Simple example?

Answer Posted / ramdeep garg

Partitioning option by Oracle version
Partitioning seems like something Oracle should have been
able to do since day one, but interestingly enough, Oracle8
was its introduction.

Oracle Version
Feature

8
Range

8i
Hash and Composite Range-Hash

9i
List

10g
Enhanced features, fast split, IOT, indexes


Partition operations were admittedly difficult (an
iLearning video even says so) in earlier versions, and this
difficulty – especially in maintenance operations - made
many users leery of implementing this feature.

Table partition options are straightforward, and five of
them are: range, list, hash, composite range-hash, and
composite range-list. Options for index-organized tables
include range, list and hash. Partitioned indexes don’t
seem to get nearly as much attention as partitioned tables,
and a lack of understanding how the index options differ
can lead to significant pitfalls.

Partitioned Indexes
You have three choices when it comes to indexes: local,
global partitioned, and global non-partitioned. A local
index maps one-to-one with the partitions of the table. A
global partitioned index can be based on a different key
and even have a different number of partitions. A global
non-partitioned index is essentially one big index on the
partitioned table. The diagram below illustrates the
differences (table partitions are the shaded boxes, indexes
are the curly braces).



Problem areas
Where do the pitfalls arise? Two seemingly simple
operations can blow away an index and leave your
partitioned table in a state of disrepair. There won’t be
any data loss, but if an application is dependent on having
an index, the loss of that index can bring a session to its
knees, that is, what was a .01 seconds lookup can now take
40 minutes. On an OLTP-type database, you’re dead in the
water.

The global non-partitioned (GNP) index is the index of
interest for the pitfall examples. Think of the GNP index
as a map of data, and you should, because that is exactly
what it is. What happens when a hole is punched in the
middle of the map? In this case, index “data” is lost, so
without knowing the complete structure of the index, Oracle
declares the index to be unusable, and there goes your
performance out the window. From personal experience,
rebuilding a 250 million plus records index took almost six
hours. A partition, and a very small one at that, needed to
be repopulated with data, and there were two choices to
clean out the questionable data: simply delete and commit,
or truncate the partition. The global index contained the
index for the primary key, and the operation to clear the
data blew the index, so to speak.

Truncate a partition
How do you truncate a table partition? Does “truncate table
X partition Y” work? Actually, the syntax involves “alter
table truncate partition.” The key part of the alter table
statement is to include two or three words (depending on
the type of table and index), and those words are “update
<global> indexes.”

Buried in the Administrator’s Guide, applying what is
stated in the sentence below means the difference between
something routine and something potentially expensive (loss
of up time, failure to meet an SLA, slow down on a
production line, and so on).

Unless you specify UPDATE INDEXES, any global indexes are
marked UNUSABLE and must be rebuilt.

Personally, I think this statement should be highlighted
much better than it currently is, or placed in an indented
note or warning/caution statement.

How can you wind up in a situation where a global non-
partitioned index is related to a partitioned table?
Actually, it is quite easy to create this situation.
Partition a table by one key or value, and then create an
index on another attribute. An example would be a partition
key based on a list (states, departments, subassemblies,
etc.) and then base the primary key on, say, a part number.
Recall that when creating a primary key (and what other
constraint?) you get an index for free. You now have a
global non-partitioned index on a partitioned table.

Splitting a partition
The same blown index problem can occur when splitting a
partition. At least here, the documentation does a better
job of pointing out what happens and how you can prevent it
from occurring in the first place.



This example splits a partition (what type of partitioning
is being used here?) and keeps global indexes intact.

alter table coupons
split partition p4_coupons values ('415')
into (partition p415, partition p4_coupons)
update global indexes;

Adding “update global indexes” to either operation
(truncation and splitting) makes all the difference in the
world.

Breaking an index
How do you know what type of index is being used? If you’re
using TOAD, a partitioned index sticks out because of an
icon. If you’re in SQL*Plus, then you have to be a bit more
clever to determine the partition type. Let’s take a look
at the SH sample schema via TOAD. Shown below are the
indexes for the SALES table.



The data is eligible to be contained in 28 partitions, and
the partition key is TIME_ID. Not all partitions have
records in them, and we’re going to create that situation
in one other partition by truncating it. To help illustrate
the global non-partitioned index example, we’ll create a
pseudo primary key based on a sequence, and then take
another look at the indexes.



Refresh the list of indexes in TOAD and now the free index
named PK_SALES_ID appears.



Let’s pick SALES_Q2_1998 as the guinea pig. You can copy
the data off into a backup table first if you want to have
the SH schema intact afterwards. The picture below shows
both steps – copying the data and truncating the partition.



Now that the partition named SALES_Q2_1998 has been
truncated, what is the state of our indexes? Refresh the
list of indexes in TOAD to see the result.



Red X’s in TOAD are symbols you generally do not want to
see, as they represent something that is broken or invalid.
To fix the index, we have to rebuild it. We can do that
through TOAD or via the command line (and TOAD will show
you the SQL syntax if so desired).





Again, refresh the list of indexes in TOAD and the
PK_SALES_ID index is now in a good state. Let’s truncate
another partition, but this time add the update indexes
clause. But first, just for grins, what happens if we
truncate an empty partition and do not use the update
indexes clause? Hopefully nothing happens as no index
information (because of its associated data) was lost, and
you can test the veracity of that statement for yourself.

SQL> create table sales_q3_1998 as
2 select * from sales partition (sales_q3_1998);

Table created.

SQL> alter table sales truncate partition sales_q3_1998
2 update global indexes;

Table truncated.

SQL> select object_name from user_objects
2 where status = 'INVALID'
3 and object_type = 'INDEX';

no rows selected

The results indicate that the partition was truncated and
that no indexes were marked as unusable (or have a status
of INVALID). The same types of examples using a SPLIT
operation are easily demonstrated using the same procedures
as what we did for the truncate partition operation.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are triggers and rules?

862


What do you understand by the terms entity, entity type, and entity set in dbms?

876


How do convert or display the date or time as string?

1011


What is database schema in dbms?

1056


What is service based database?

851


What is like operator for and what are wild cards?

854


Differentiate between nested loop, hash loop and merge join.

887


How do we select distinct values from a table?

888


Define identity and uniqueidentifier property of column?

1016


1. Tell me about your self? 2. Latest Project Introduction? 3. Difference between server jobs and parallel jobs? 4. Seq-Seq Explain its behavior and execution mode and which parallelism technique is used? 5. What is padding characters? 6. Seq-Seq, Seq-Copy-Seq which one is the best and efficient? 7. How many reject links do we have to a transformer? 8. How many reject links to join stage? 9. Difference between join and lookup? 10. How to design PX routine? 11. How can we call job in another job? 12. Difference between batch and sequencer? 13. Which Database is used? 14. What is change capture? Give briefing of that? 15. What is change Code? Explain? 16. How you call UNIX in Ds? 17. How do you call JCL in UNIX? 18. How do you pass the job status of one job to another job? Have designed any job sequencer? 19. How do you find a file in existed directory? 20. How can you call parallel jobs in transformer? 21. Execution of jobs in command line? 22. Tuning of sql queries? 23. What is orchestrating metadata? 24. What are junk dimension? 25. What are the third party tools you are used? 26. What are the system variables you have used?

1817


What is db context?

856


What is a database report?

851


What are the 3 types of relationships in a database?

852


What are the ways to controlling cursor behavior?

904


What is difference between database and file?

924