Oracle Datapump via PL/SQL with Parallelism

I like the stuff we can do with the PL/SQL datapump package:

Don’t forget to change the html versions of “less than” and “greater than” back to the correct characters.

PROCEDURE        p_simple_export_full
    IS
        /*


            Purpose: Perform an full database export

            MODIFICATION HISTORY
            Person      Date        Comments
            ---------   ------      -------------------------------------------
            dcox        2/4/2013    Initial Build

        */
        v_handle NUMBER; -- job handle
        v_logfile_name VARCHAR2(200) := 'expdp_plsql_' || TO_CHAR(SYSDATE, 'YYYY_MMDD_HH24MI') || '.log'; -- logfile name
        v_dumpfile_name VARCHAR2(200) := 'expdp_plsql_' || TO_CHAR(SYSDATE, 'YYYY_MMDD_HH24MI') || '.dmp'; -- logfile name
        v_default_dir VARCHAR(30) := 'DATA_PUMP_DIR'; -- directory
        v_degree INTEGER := 1; -- degree of parallelism
    BEGIN
        -- Open the job
        v_handle :=
            DBMS_DATAPUMP.open(operation => 'EXPORT'
                              ,job_mode => 'FULL'
                              ,job_name => 'FULLEXPJOB'
                              ,version => 'COMPATIBLE');
        -- Set the degree
        DBMS_DATAPUMP.set_parallel(handle => v_handle, degree => v_degree);

        -- Add a logfile
        DBMS_DATAPUMP.add_file(handle => v_handle
                              ,filename => v_logfile_name
                              ,directory => v_default_dir
                              ,filetype => DBMS_DATAPUMP.ku$_file_type_log_file);

        -- Add a datafile
        DBMS_DATAPUMP.add_file(handle => v_handle
                              ,filename => 'dp' || '_%U_' || v_dumpfile_name
                              ,directory => v_default_dir
                              ,filetype => DBMS_DATAPUMP.ku$_file_type_dump_file);

        -- Dbms_DataPump.Set_Parameter(handle => hand,
        --                               name => 'ESTIMATE',
        --                              value => 'STATISTICS');

        -- Start the job
        DBMS_DATAPUMP.start_job(v_handle);
    END p_simple_export_full;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s