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.

CHAPTER 3 ■ FILES 109<br />

of the required metadata (in the form of CREATE <strong>and</strong> ALTER statements), <strong>and</strong> optionally the data<br />

itself to re-create tables, schemas, or even entire databases. Import’s sole job in life is to read<br />

these DMP files, <strong>and</strong> execute the DDL statements <strong>and</strong> load any data it finds.<br />

DMP files are designed to be backward-compatible, meaning that newer releases can read<br />

older releases’ DMP files <strong>and</strong> process them successfully. I have heard of people exporting a<br />

version 5 database <strong>and</strong> successfully importing it into <strong>Oracle</strong> 10g (just as a test!). So Import can<br />

read older version DMP files <strong>and</strong> process the data therein. The converse, however, is most<br />

definitely not true: the Import process that comes with <strong>Oracle</strong>9i Release 1 cannot—will not—<br />

successfully read a DMP file created by <strong>Oracle</strong>9i Release 2 or <strong>Oracle</strong> 10g Release 1. For<br />

example, I exported a simple table from both <strong>Oracle</strong> 10g Release 1 <strong>and</strong> <strong>Oracle</strong>9i Release 2.<br />

Upon trying to use these DMP files in <strong>Oracle</strong>9i Release 1, I soon discovered <strong>Oracle</strong>9i Release 1<br />

import will not even attempt to process the <strong>Oracle</strong> 10g Release 1 DMP file:<br />

[tkyte@localhost tkyte]$ imp userid=/ full=y file=10g.dmp<br />

Import: Release 9.0.1.0.0 - Production on Sun Jan 2 21:08:56 2005<br />

(c) Copyright 2001 <strong>Oracle</strong> Corporation. All rights reserved.<br />

Connected to: <strong>Oracle</strong>9i Enterprise Edition Release 9.0.1.0.0 - Production<br />

With the Partitioning option<br />

JServer Release 9.0.1.0.0 - Production<br />

IMP-00010: not a valid export file, header failed verification<br />

IMP-00000: Import terminated unsuccessfully<br />

When processing the <strong>Oracle</strong>9i Release 2 file, things are not that much better:<br />

[tkyte@localhost tkyte]$ imp userid=/ full=y file=9ir2.dmp<br />

Import: Release 9.0.1.0.0 - Production on Sun Jan 2 21:08:42 2005<br />

(c) Copyright 2001 <strong>Oracle</strong> Corporation. All rights reserved.<br />

Connected to: <strong>Oracle</strong>9i Enterprise Edition Release 9.0.1.0.0 - Production<br />

With the Partitioning option<br />

JServer Release 9.0.1.0.0 - Production<br />

Export file created by EXPORT:V09.02.00 via conventional path<br />

import done in WE8ISO8859P1 character set <strong>and</strong> AL16UTF16 NCHAR character set<br />

. importing OPS$TKYTE's objects into OPS$TKYTE<br />

IMP-00017: following statement failed with ORACLE error 922:<br />

"CREATE TABLE "T" ("X" NUMBER(*,0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRA"<br />

"NS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "USE"<br />

"RS" LOGGING NOCOMPRESS"<br />

IMP-00003: ORACLE error 922 encountered<br />

ORA-00922: missing or invalid option<br />

Import terminated successfully with warnings.<br />

While 9i Release 1 tried to read the file, it could not process the DDL contained therein. In<br />

<strong>Oracle</strong>9i Release 2 a new feature, table compression, was added. Hence Export in that version<br />

started adding NOCOMPRESS or COMPRESS as a keyword to each <strong>and</strong> every CREATE TABLE statement.<br />

The DDL from <strong>Oracle</strong>9i Release 2 does not work in <strong>Oracle</strong>9i Release 1.<br />

If, however, I use the <strong>Oracle</strong>9i Release 1 Export tool against either <strong>Oracle</strong>9i Release 2 or<br />

<strong>Oracle</strong> 10g Release 1, I will get a valid DMP file that can be successfully imported into <strong>Oracle</strong>9i<br />

Release 1. So, the rule with DMP files is that they must be created by a version of Export that is

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

Saved successfully!

Ooh no, something went wrong!