Tags

, , , , , ,

SELECT trim(instance_name), trim(host_name) INTO v_db_name, v_hostname FROM v$instance;

v_dp_handle := DBMS_DATAPUMP.open(
    operation   => 'EXPORT',
    job_mode    => 'FULL',
    remote_link => NULL,
    job_name    => v_job_name,
    version     => 'COMPATIBLE',
    compression => DBMS_DATAPUMP.ku$_compress_metadata
);

— Parallelism
DBMS_DATAPUMP.SET_PARALLEL(
handle => v_dp_handle,
degree => 4 );

— Setting Flashback time
SELECT TIMESTAMP_TO_SCN( TO_TIMESTAMP( TO_CHAR( SYSDATE, ‘DD.MM.YYYY HH24:MI’) ))
INTO v_scn_number FROM DUAL;

DBMS_DATAPUMP.SET_PARAMETER(
handle => v_dp_handle,
name => ‘FLASHBACK_SCN’,
value => v_scn_number );

DBMS_DATAPUMP.add_file(
handle => v_dp_handle,
filename => v_file_name||’.dmp’,
directory => v_directory );

DBMS_DATAPUMP.add_file(
handle => v_dp_handle,
filename => v_file_name||’.log’,
directory => v_directory,
filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);

–Table exclude list
DBMS_DATAPUMP.metadata_filter(
handle => v_dp_handle,
name => ‘NAME_EXPR’,
value => q’|NOT IN
(‘xxxxx’,
‘yyyyy’)|’,
object_path => ‘TABLE’

);

— Starting
DBMS_DATAPUMP.start_job(v_dp_handle);

Advertisements