We help IT Professionals succeed at work.

schedule expdp

msimons4
msimons4 asked
on

Will this work?

BEGIN
  SYS.DBMS_SCHEDULER.DROP_JOB
    (job_name  => 'export_backup');
END;
/

BEGIN
  SYS.DBMS_SCHEDULER.CREATE_JOB
    (
       job_name        => 'export_backup'
      ,start_date      => TO_TIMESTAMP_TZ('2011/11/02 02:00:00.000000 US/Eastern', 'yyyy/mm/dd hh24:mi:ss.ff tzr')
      ,repeat_interval => 'FREQ=DAILY;'
      ,end_date        => NULL
      ,job_class       => 'DEFAULT_JOB_CLASS'
      ,job_type        => 'PLSQL_BLOCK'
      ,job_action      => 'begin expdp system/password@database full=y directory=directory_name schemas=amcs_owner dumpfile=dumpfile_name.dmp logfile=logfile_name.log end;'
      ,enabled         => TRUE
      ,comments        => 'datapump export'
    );
End;

/
Comment
Watch Question

Author

Commented:
Don't want to include schema in a full

BEGIN
  SYS.DBMS_SCHEDULER.DROP_JOB
    (job_name  => 'export_backup');
END;
/

BEGIN
  SYS.DBMS_SCHEDULER.CREATE_JOB
    (
       job_name        => 'export_backup'
      ,start_date      => TO_TIMESTAMP_TZ('2011/11/02 02:00:00.000000 US/Eastern', 'yyyy/mm/dd hh24:mi:ss.ff tzr')
      ,repeat_interval => 'FREQ=DAILY;'
      ,end_date        => NULL
      ,job_class       => 'DEFAULT_JOB_CLASS'
      ,job_type        => 'PLSQL_BLOCK'
      ,job_action      => 'begin expdp system/password@database full=y directory=directory_name dumpfile=dumpfile_name.dmp logfile=logfile_name.log end;'
      ,enabled         => TRUE
      ,comments        => 'datapump export'
    );
End;

/
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
>>Will this work?

Do you not have a development database where you can experiment with things like this?

>>'FREQ=DAILY;'

Why are you wanting to drop and create a job that is supposed to run daily?   You normally create it once and let it run.

>>'begin expdp system

expdp is an OS command not a PL/SQL command so, NO this will not work.

Look up the executable option for expdp in the online docs.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.