Pergunta

We are developing a large project using Oracle 11g R2. Our database is consist of more than 170 tables, with lots of partition-by-references (an Oracle 11 feature).

There are times that we want to port our database to another database, so we create a dump file using data-pump, when exporting data everything goes fine, but we can not import it to another database.

When importing proper tables import normally but non of partition by reference tables are imported.

When creating partition by reference tables, the foreign key (which partition is based on) shall be created in create table statement, but it seems the data-pump creates all foreign keys at the end of script.

I can not believe that Oracle people forgot to upgrade data-pump in Oracle 11g. Has anybody know how to solve this problem?

Update 1: These are the import and script scripts we use:

Export:

declare
    h1   NUMBER;
begin
    h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'EXPORT000185', version => 'COMPATIBLE'); 
    dbms_datapump.set_parallel(handle => h1, degree => 1); 
    dbms_datapump.add_file(handle => h1, filename => '910202.LOG', directory => 'DATA_PUMP_DIR', filetype => 3); 
    dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0); 
    dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''PAYESH_ACCOUNTING'',''PAYESH_CORE'',''PAYESH_CRM'',''PAYESH_LIFE'',''PAYESH_SECURITY'')'); 
     dbms_datapump.add_file(handle => h1, filename => '910202_db4.DMP', directory => 'DATA_PUMP_DIR', filetype => 1); 
    dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1); 
    dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC'); 
    dbms_datapump.set_parameter(handle => h1, name => 'ESTIMATE', value => 'BLOCKS'); 
    dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0); 
    dbms_datapump.detach(handle => h1); 
end;

Import:

declare
    h1   NUMBER;
begin
    h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'SCHEMA', job_name => 'IMPORT000189', version => 'COMPATIBLE'); 
    dbms_datapump.set_parallel(handle => h1, degree => 1); 
    dbms_datapump.add_file(handle => h1, filename => '910228.LOG', directory => 'DATA_PUMP_DIR', filetype => 3); 
    dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0); 
    dbms_datapump.add_file(handle => h1, filename => '910128.DMP', directory => 'DATA_PUMP_DIR', filetype => 1); 
    dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''PAYESH_ACCOUNTING'',''PAYESH_CORE'',''PAYESH_CRM'',''PAYESH_LIFE'',''PAYESH_SECURITY'')'); 
    dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1); 
    dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC'); 
    dbms_datapump.set_parameter(handle => h1, name => 'SKIP_UNUSABLE_INDEXES', value => 0); 
    dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0); 
    dbms_datapump.detach(handle => h1); 
end;

Update 2: We figured out that the problem only exists on partitions on foreign keys that are cross-schema.

So the question already exists, is there any way to export/import tables with cross-schema partition by schemas all together?

Foi útil?

Solução

I was able to reproduce your issue. When I used the command line IMPDB it gave me a more useful error message:

ORA-39083: Object type TABLE:"SCHEMA2"."CHILD_TABLE" failed to create with error:
ORA-00942: table or view does not exist

If you look those up on My Oracle Support you'll find Bug 8477142. The issue was supposedly fixed in 11.2.0.2.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top