1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
DECLARE
num_export NUMBER;
chr_liste_tables VARCHAR2(1000);
chr_traces VARCHAR2(1000);
BEGIN
chr_liste_tables := '(''T_PAYS'')';
chr_traces := 'DBMS_DATAPUMP.open';
num_export := DBMS_DATAPUMP.open (operation=>'EXPORT', job_mode=>'TABLE', job_name=>'EXPORT_EXTRACTIONS');
DBMS_OUTPUT.PUT_LINE ( chr_traces );
-- Description du fichier dump
chr_traces := 'DBMS_DATAPUMP.add_file(dmp)';
DBMS_DATAPUMP.add_file ( handle=>num_export, filename=>'export_extractions.dmp', directory=>'REP_TEST', filetype=>DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE );
DBMS_OUTPUT.PUT_LINE ( chr_traces );
-- Description du fichier log
chr_traces := 'DBMS_DATAPUMP.add_file(log)';
DBMS_DATAPUMP.add_file ( handle=>num_export, filename=>'export_extractions.log', directory=>'REP_TEST', filetype=> DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE );
DBMS_OUTPUT.PUT_LINE ( chr_traces );
-- description des tables a exporter
chr_traces := 'DBMS_DATAPUMP.metadata_filter(liste_tables)';
DBMS_DATAPUMP.metadata_filter ( handle=>num_export, name=>'NAME_LIST', value=>chr_liste_tables );
DBMS_OUTPUT.PUT_LINE ( chr_traces );
-- lancement du job
chr_traces := 'DBMS_DATAPUMP.start_job ';
DBMS_DATAPUMP.start_job ( handle=>num_export );
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'ERREUR : ' || chr_traces );
DBMS_OUTPUT.PUT_LINE ( SQLERRM || ' (' || SQLCODE || ')') ;
END;
/ |
Partager