Friday, April 20, 2012

Oracle Job Scheduler for Rename Export dump file / OS files

UTL_FILE.FRENAME ( location  IN VARCHAR2,
   filename  IN VARCHAR2,
   dest_dir  IN VARCHAR2,
   dest_file IN VARCHAR2,
   overwrite IN BOOLEAN DEFAULT FALSE);


select * from dba_directories;

EXEC UTL_FILE.FRENAME ('EXPORT_AUTO','exp1213.DMP','EXPORT_AUTO','exp1213'||'_'||TO_CHAR(SYSDATE,'DDMMYYYY')||'.DMP');

------------------------

BEGIN
  DBMS_SCHEDULER.create_job (
    job_name        => 'RENAMEexp',
    job_type        => 'PLSQL_BLOCK',
    job_action      => 'BEGIN UTL_FILE.FRENAME (''EXPORT_AUTO'',''exp1213.DMP'',''EXPORT_AUTO'',''exp1213''||''_''||TO_CHAR(SYSDATE,''DDMMYYYY'')||''.DMP''); END;',
    start_date      => '01-APR-12 01.00.00 PM ASIA/CALCUTTA',
    repeat_interval => 'freq=DAILY',
    end_date        => NULL,
    enabled         => TRUE,
    comments        => 'JOB to rename dump file');
END;
/

exec dbms_scheduler.run_job('renameexp');

No comments:

Post a Comment

Followers