05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 13 ■ PARTITIONING 599<br />

implementation that provides for full data availability, even during the partition operations.<br />

In that manner, we can measure the same operations using the different techniques <strong>and</strong> compare<br />

them. Our expected outcome will be that the first approach will consume fewer database<br />

resources <strong>and</strong>, therefore, perform “faster” but will incur a measurable period of “downtime.”<br />

The second approach, while consuming more resources <strong>and</strong> perhaps taking longer overall,<br />

will not incur downtime. As far as the end users are concerned, their ability to work never<br />

ceased. They might have been processing a bit slower (since we were competing with them<br />

for resources), but they were still processing, <strong>and</strong> they never stopped.<br />

So, if we take the earlier example, but also create an empty FY_2005 table like FY_2004, <strong>and</strong><br />

a full FY_2007 table like FY_2006, we can measure the differences between the index rebuild<br />

approaches, starting first with the “less available approach”:<br />

exec runStats_pkg.rs_start;<br />

alter table partitioned exchange partition fy_2004<br />

with table fy_2004 including indexes without validation;<br />

alter table partitioned drop partition fy_2004;<br />

alter table partitioned add partition fy_2006<br />

values less than ( to_date('01-jan-2007','dd-mon-yyyy') );<br />

alter table partitioned exchange partition fy_2006<br />

with table fy_2006 including indexes without validation;<br />

alter index partitioned_idx_global rebuild;<br />

exec runStats_pkg.rs_middle;<br />

Here is the highly available UPDATE GLOBAL INDEXES approach:<br />

alter table partitioned exchange partition fy_2005<br />

with table fy_2005 including indexes without validation<br />

update global indexes;<br />

alter table partitioned drop partition fy_2005<br />

update global indexes;<br />

alter table partitioned add partition fy_2007<br />

values less than ( to_date('01-jan-2008','dd-mon-yyyy') );<br />

alter table partitioned exchange partition fy_2007<br />

with table fy_2007 including indexes without validation<br />

update global indexes;<br />

exec runStats_pkg.rs_stop;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!