05.11.2015 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

634<br />

CHAPTER 14 ■ PARALLEL EXECUTION<br />

■Note The PARALLEL clause may also be used on the CREATE TABLE statement itself. Right after the<br />

REJECT LIMIT UNLIMITED, the keyword PARALLEL could have been added. I used the ALTER statement<br />

just to draw attention to the fact that the external table is, in fact, parallel enabled.<br />

Extent Trimming with UNIFORM vs. AUTOALLOCATE Locally-Managed Tablespaces<br />

That’s all we need to do to set up the load component. Now, we would like to investigate how<br />

space is managed in a locally-managed tablespace (LMT) that uses UNIFORM extent sizes, compared<br />

to how space is managed in an LMT that AUTOALLOCATEs extents. In this case, we’ll use<br />

100MB extents. First we create LMT_UNIFORM, which uses uniform extent sizes:<br />

ops$tkyte@ORA10GR1> create tablespace lmt_uniform<br />

2 datafile '/u03/ora10gr1/lmt_uniform.dbf' size 1048640K reuse<br />

3 autoextend on next 100m<br />

4 extent management local<br />

5 uniform size 100m;<br />

Tablespace created.<br />

Next, we create LMT_AUTO, which uses AUTOALLOCATE to determine extent sizes:<br />

ops$tkyte@ORA10GR1> create tablespace lmt_auto<br />

2 datafile '/u03/ora10gr1/lmt_auto.dbf' size 1048640K reuse<br />

3 autoextend on next 100m<br />

4 extent management local<br />

5 autoallocate;<br />

Tablespace created.<br />

Each tablespace started with a 1GB data file (plus 64KB used by LMTs to manage the storage;<br />

it would be 128KB extra instead of 64KB if we were to use a 32KB blocksize). We permit<br />

these data files to autoextend 100MB at a time. We are going to load this file:<br />

$ ls -lag big_table.dat<br />

-rw-rw-r-- 1 tkyte 1067107251 Jul 11 13:46 big_table.dat<br />

which is a 10,000,000-record file. It was created using the big_table.sql script found in the<br />

“Setting Up” section at the beginning of this book <strong>and</strong> then unloaded using the flat.sql script<br />

available at http://asktom.oracle.com/~tkyte/flat/index.html. Next, we do a parallel direct<br />

path load of this file into each tablespace:<br />

ops$tkyte@ORA10GR1> create table uniform_test<br />

2 parallel<br />

3 tablespace lmt_uniform<br />

4 as<br />

5 select * from big_table_et;<br />

Table created.<br />

ops$tkyte@ORA10GR1> create table autoallocate_test<br />

2 parallel

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

Saved successfully!

Ooh no, something went wrong!