Document Type | Technical Information
Category | Administration
Applicable Product Versions | 6FS07, 7FS02, 7FS02PS
Document Number | TADTI026
Overview
There are often cases where jobs need to be transferred to another system or account. This guide explains how to safely transfer jobs by restructuring the process into a script form.
Purpose of Securing Job Transfer Script
- In some older binary versions, jobs may be omitted from the export target when using tbexport.
- Regular backups are necessary to prepare for job deletions caused by operational mistakes or failures.
Method
Procedure
1. Create job_bak.sql.
$ vi job_bak.sql set pages 500; set lines 300; set feedback off; set heading off; set echo off; select 'DECLARE job_no number;'|| chr(10) || 'begin ' || chr(10) || ' dbms_job.submit (job_no,' || '''' || what||''',' || '''' || next_date || ''','|| '''' || interval || ''');' || chr(10) || ' end;' || chr(10) || '/' from dba_jobs; SELECT 'schema : '||B.USERNAME||'','DECLARE job_no number;'|| chr(10) || 'begin ' || chr(10) || ' dbms_job.submit (job_no,' || '''' || what||''',' || '''' || next_date || ''','|| '''' || interval || ''');' || chr(10) || ' end;' || chr(10) || '/' FROM dba_jobs a , dba_users b where a.SCHEMA_USER=b.USER_ID;
2. Create job_bak.sh.
$ vi job_bak.sh source /home/tibero/.bash_profile tbsql -s sys/tibero @/home/tibero/job_bak.sql << EOF quit EOF
3. Grant execution permission.
$ chmod +x job_bak*
4. Register in crontab.
$ crontab -e * * * * * sh /home/tibero/job_bak.sh >> /home/tibero/job_backup_$(date +%y%m%d%H%M).sql 2>&1
5. Check the results.