Posts

Showing posts from July, 2013

Export in Pl/Sql via DBMS_DATAPUMP

Image
CREATE OR REPLACE PACKAGE maintenance AS    PROCEDURE export_myschema;    PROCEDURE stop_job (job_name VARCHAR2, schema_name VARCHAR2);    PROCEDURE stop_all_jobs;    PROCEDURE import_schema (file_name VARCHAR2); END maintenance; /  CREATE OR REPLACE PACKAGE BODY maintenance AS    PROCEDURE export_myschema    AS       handle        NUMBER;       file_name     VARCHAR2 (200);       log_name      VARCHAR2 (200);       JOBNAME       VARCHAR2 (200);       file_prefix   VARCHAR2 (30);       dir_name      VARCHAR2 (4000);       l_fexists BOOLEAN;       l_file_length PLS_INTEGER;       l_block_size BINARY_INTEGER;    BEGIN       dir_name := 'EXPORT_DIR';       file_prefix := 'myschema_prod_data_';       file_name :=          file_prefix || MOD (TO_NUMBER (TO_CHAR (SYSDATE, 'D')), 2) -- toggle 0 or 1                                                                    || '.dmp';       log_name :=             file_prefix