MaksymBilenko / docker-oracle-12c

:whale: Docker image with Oracle Database 12c on board
Apache License 2.0
686 stars 289 forks source link

Supports to DBMS_DATAPUMP #167

Open jeterson opened 1 year ago

jeterson commented 1 year ago

I want to use import dump using DBMS_DATAPUMP but it looks like doesn't support for this.

Error in container when try execute docker-entrypoint-initdb.d

ERROR at line 2:

ORA-06550: line 2, column 3:

PLS-00221: 'OPEN' is not a procedure or is undefined

ORA-06550: line 2, column 3:

PL/SQL: Statement ignored

ORA-06550: line 4, column 3:

PLS-00307: too many declarations of 'METADATA_FILTER' match this call

ORA-06550: line 4, column 3:

PL/SQL: Statement ignored

ORA-06550: line 5, column 3:

PLS-00307: too many declarations of 'SET_PARAMETER' match this call

ORA-06550: line 5, column 3:

PL/SQL: Statement ignored

ORA-06550: line 6, column 3:

PLS-00307: too many declarations of 'SET_PARAMETER' match this call

ORA-06550: line 6, column 3:

PL/SQL: Statement ignored

ORA-06550: line 8, column 60:

PLS-00363: expression 'COMPLETED' cannot be used as an assignment target

ORA-06550: line 8, column 3:

PL/SQL: Statement ignored

ORA-06550: line 9, column 17:

PLS-00302: component 'CLOSE' must be declared

ORA-06550: line 9, column 3:

PL/SQL: Statement ignored

And Here is the code for datapump

-- Comandos SQL de inicialização do banco de dados (se necessário)

-- Importar o dump usando o impdp
CREATE OR REPLACE DIRECTORY DATA_PUMP_DIR AS '/import';

-- Executar o impdp
BEGIN
  DBMS_DATAPUMP.OPEN (operation => 'IMPORT', job_mode => 'FULL', job_name => 'data_import_job', version => 'COMPATIBLE');
  DBMS_DATAPUMP.ADD_FILE (handle => 'data_import_file', filename => 'data.dmp', directory => 'DATA_PUMP_DIR', filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
  DBMS_DATAPUMP.METADATA_FILTER (handle => 'data_import_filter', name => 'SCHEMA_EXPR', value => 'IN (''DEVELOPMENT'')');
  DBMS_DATAPUMP.SET_PARAMETER (handle => 'data_import_job', name => 'INCLUDE_METADATA', value => 1);
  DBMS_DATAPUMP.SET_PARAMETER (handle => 'data_import_job', name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
  DBMS_DATAPUMP.START_JOB (handle => 'data_import_job', skip_current => 0, abort_step => 0);
  DBMS_DATAPUMP.WAIT_FOR_JOB (handle => 'data_import_job', job_state => 'COMPLETED');
  DBMS_DATAPUMP.CLOSE (handle => 'data_import_job');
END;
/