22: --
23: BEGIN
24: --
25:
26: hr_dm_utility.message('ROUT','entry:hr_dm_upload.spawn_slave', 5);
27:
28: -- set up local data
29: l_application := 'PER';
30: l_program := 'DATAPUMP';
48: p_phase_item_id => p_phase_item_id);
49:
50:
51: COMMIT;
52: hr_dm_utility.message('INFO','Slave request ID#' || l_request_id, 15);
53: IF (l_request_id = 0) THEN
54: l_fatal_error_message := 'Unable to start slave process';
55: hr_dm_master.report_error(p_current_phase, p_migration_id, l_fatal_error_message, 'P');
56: RAISE e_fatal_error;
56: RAISE e_fatal_error;
57: END IF;
58:
59:
60: hr_dm_utility.message('INFO','Spawned datapump as slave process', 15);
61: hr_dm_utility.message('SUMM','Spawned datapump as slave process', 20);
62: hr_dm_utility.message('ROUT','exit:hr_dm_upload.spawn_slave', 25);
63: hr_dm_utility.message('PARA','(none)', 30);
64:
57: END IF;
58:
59:
60: hr_dm_utility.message('INFO','Spawned datapump as slave process', 15);
61: hr_dm_utility.message('SUMM','Spawned datapump as slave process', 20);
62: hr_dm_utility.message('ROUT','exit:hr_dm_upload.spawn_slave', 25);
63: hr_dm_utility.message('PARA','(none)', 30);
64:
65:
58:
59:
60: hr_dm_utility.message('INFO','Spawned datapump as slave process', 15);
61: hr_dm_utility.message('SUMM','Spawned datapump as slave process', 20);
62: hr_dm_utility.message('ROUT','exit:hr_dm_upload.spawn_slave', 25);
63: hr_dm_utility.message('PARA','(none)', 30);
64:
65:
66: -- error handling
59:
60: hr_dm_utility.message('INFO','Spawned datapump as slave process', 15);
61: hr_dm_utility.message('SUMM','Spawned datapump as slave process', 20);
62: hr_dm_utility.message('ROUT','exit:hr_dm_upload.spawn_slave', 25);
63: hr_dm_utility.message('PARA','(none)', 30);
64:
65:
66: -- error handling
67: EXCEPTION
65:
66: -- error handling
67: EXCEPTION
68: WHEN e_fatal_error THEN
69: hr_dm_utility.error(SQLCODE,'hr_dm_upload.spawn_slave',l_fatal_error_message,'R');
70: hr_dm_master.report_error(p_current_phase, p_migration_id,
71: 'Error in hr_dm_upload.spawn_slave', 'P');
72: RAISE;
73: WHEN OTHERS THEN
70: hr_dm_master.report_error(p_current_phase, p_migration_id,
71: 'Error in hr_dm_upload.spawn_slave', 'P');
72: RAISE;
73: WHEN OTHERS THEN
74: hr_dm_utility.error(SQLCODE,'hr_dm_upload.spawn_slave','(none)','R');
75: hr_dm_master.report_error(p_current_phase, p_migration_id,
76: 'Untrapped error in hr_dm_upload.spawn_slave', 'P');
77: RAISE;
78: --
194: --
195:
196: -- initialize messaging (only for concurrent processing)
197: IF (p_concurrent_process = 'Y') THEN
198: hr_dm_utility.message_init;
199: END IF;
200:
201: hr_dm_utility.message('ROUT','entry:hr_dm_upload.main', 5);
202: hr_dm_utility.message('PARA','(p_migration_id - ' || p_migration_id ||
197: IF (p_concurrent_process = 'Y') THEN
198: hr_dm_utility.message_init;
199: END IF;
200:
201: hr_dm_utility.message('ROUT','entry:hr_dm_upload.main', 5);
202: hr_dm_utility.message('PARA','(p_migration_id - ' || p_migration_id ||
203: ')(p_last_migration_date - ' || p_last_migration_date ||
204: ')', 10);
205:
198: hr_dm_utility.message_init;
199: END IF;
200:
201: hr_dm_utility.message('ROUT','entry:hr_dm_upload.main', 5);
202: hr_dm_utility.message('PARA','(p_migration_id - ' || p_migration_id ||
203: ')(p_last_migration_date - ' || p_last_migration_date ||
204: ')', 10);
205:
206:
212: ,val => 'N'
213: );
214:
215: -- get the current phase_id
216: l_phase_id := hr_dm_utility.get_phase_id('UP', p_migration_id);
217:
218:
219: -- see if this is the first run? (l_request_data = NULL or '?')
220: -- or
220: -- or
221: -- is it a restart after a slave has finished? (l_request_data = paused phase item code)
222:
223: l_request_data := fnd_conc_global.request_data;
224: hr_dm_utility.message('INFO','l_request_data ' || l_request_data, 11);
225:
226: --
227: -- l_request_data will be 'null' when the upload process is invoked by the
228: -- concurrent manager. It then spawns the data pump and pauses until the datapump
289: RAISE e_fatal_error;
290: END IF;
291: CLOSE csr_dp_batch_status;
292:
293: hr_dm_utility.message('INFO','Data Pump batch status ' || l_status, 12);
294:
295: -- if l_status = 'C', it means the group has been uploaded successfully.
296: -- - update the group status to complete in phase_items.
297: -- - check the status of the child process so as if any has erred then
302: -- succesfully.
303:
304: IF l_status = 'C' then
305: -- update status to completed
306: hr_dm_utility.update_phase_items(p_new_status => 'C',
307: p_id => l_phase_item_id);
308:
309: -- check if any data pump child process failed by checking status of
310: -- all the data pump process status.
312: FOR csr_failed_dp_child_proc_rec in csr_failed_dp_child_proc (l_request_id)
313: LOOP
314:
315: -- write into log file about the failed child processes.
316: hr_dm_utility.message('INFO','Warning :- Failed Data Pump process ' ||
317: 'request_id =' || TO_CHAR(l_request_id), 13);
318: END LOOP;
319:
320: ELSE
329:
330:
331: -- get status of UP phase, is phase completed?
332: -- if null returned, then assume it is NS.
333: l_current_phase_status := NVL(hr_dm_utility.get_phase_status('UP', p_migration_id), 'NS');
334:
335: -- if status is error, then raise an exception
336: IF (l_current_phase_status = 'E') THEN
337: l_slave_error_message := 'Current phase in error - slave exiting';
354: IF (csr_get_pi%FOUND) THEN
355:
356: close csr_get_pi;
357: -- update status to started
358: hr_dm_utility.update_phase_items(p_new_status => 'S',
359: p_id => l_phase_item_id);
360:
361: -- send info on current table to logfile
362: hr_dm_utility.message('INFO','Processing batch- ' || l_batch_id , 13);
358: hr_dm_utility.update_phase_items(p_new_status => 'S',
359: p_id => l_phase_item_id);
360:
361: -- send info on current table to logfile
362: hr_dm_utility.message('INFO','Processing batch- ' || l_batch_id , 13);
363:
364:
365: -- call code to trigger data pump to upload the data.
366:
391: errbuf := 'Slave Controller is paused.';
392: END IF;
393:
394:
395: hr_dm_utility.message('INFO','UP - main controller', 15);
396: hr_dm_utility.message('SUMM','UP - main controller', 20);
397: hr_dm_utility.message('ROUT','exit:hr_dm_upload.main', 25);
398: hr_dm_utility.message('PARA','(retcode - ' || retcode ||
399: ')(errbuf - ' || errbuf || ')', 30);
392: END IF;
393:
394:
395: hr_dm_utility.message('INFO','UP - main controller', 15);
396: hr_dm_utility.message('SUMM','UP - main controller', 20);
397: hr_dm_utility.message('ROUT','exit:hr_dm_upload.main', 25);
398: hr_dm_utility.message('PARA','(retcode - ' || retcode ||
399: ')(errbuf - ' || errbuf || ')', 30);
400:
393:
394:
395: hr_dm_utility.message('INFO','UP - main controller', 15);
396: hr_dm_utility.message('SUMM','UP - main controller', 20);
397: hr_dm_utility.message('ROUT','exit:hr_dm_upload.main', 25);
398: hr_dm_utility.message('PARA','(retcode - ' || retcode ||
399: ')(errbuf - ' || errbuf || ')', 30);
400:
401: -- error handling
394:
395: hr_dm_utility.message('INFO','UP - main controller', 15);
396: hr_dm_utility.message('SUMM','UP - main controller', 20);
397: hr_dm_utility.message('ROUT','exit:hr_dm_upload.main', 25);
398: hr_dm_utility.message('PARA','(retcode - ' || retcode ||
399: ')(errbuf - ' || errbuf || ')', 30);
400:
401: -- error handling
402: EXCEPTION
402: EXCEPTION
403: WHEN e_fatal_error THEN
404: retcode := 2;
405: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
406: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main',l_fatal_error_message,'R');
407: hr_dm_utility.update_phase_items(p_new_status => 'E',
408: p_id => l_phase_item_id);
409: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
410: WHEN e_slave_error THEN
403: WHEN e_fatal_error THEN
404: retcode := 2;
405: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
406: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main',l_fatal_error_message,'R');
407: hr_dm_utility.update_phase_items(p_new_status => 'E',
408: p_id => l_phase_item_id);
409: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
410: WHEN e_slave_error THEN
411: retcode := 0;
405: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
406: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main',l_fatal_error_message,'R');
407: hr_dm_utility.update_phase_items(p_new_status => 'E',
408: p_id => l_phase_item_id);
409: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
410: WHEN e_slave_error THEN
411: retcode := 0;
412: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
413: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main',l_fatal_error_message,'R');
409: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
410: WHEN e_slave_error THEN
411: retcode := 0;
412: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
413: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main',l_fatal_error_message,'R');
414: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
415: WHEN OTHERS THEN
416: retcode := 2;
417: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
410: WHEN e_slave_error THEN
411: retcode := 0;
412: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
413: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main',l_fatal_error_message,'R');
414: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
415: WHEN OTHERS THEN
416: retcode := 2;
417: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
418: -- update status to error
415: WHEN OTHERS THEN
416: retcode := 2;
417: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
418: -- update status to error
419: hr_dm_utility.update_phase_items(p_new_status => 'E',
420: p_id => l_phase_item_id);
421: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
422:
423: --
417: errbuf := 'An error occurred during the migration - examine logfiles for detailed reports.';
418: -- update status to error
419: hr_dm_utility.update_phase_items(p_new_status => 'E',
420: p_id => l_phase_item_id);
421: hr_dm_utility.error(SQLCODE,'hr_dm_upload.main','(none)','R');
422:
423: --
424: END main;
425: --
455: --
456: BEGIN
457: --
458:
459: hr_dm_utility.message('ROUT','entry:hr_dm_upload.set_globals', 5);
460: hr_dm_utility.message('PARA','(none)', 10);
461:
462: -- Set the variable so as to disable the trigger on the table.
463: hr_general.g_data_migrator_mode := 'Y';
456: BEGIN
457: --
458:
459: hr_dm_utility.message('ROUT','entry:hr_dm_upload.set_globals', 5);
460: hr_dm_utility.message('PARA','(none)', 10);
461:
462: -- Set the variable so as to disable the trigger on the table.
463: hr_general.g_data_migrator_mode := 'Y';
464:
482: END IF;
483:
484:
485:
486: hr_dm_utility.message('INFO','UP - main controller', 15);
487: hr_dm_utility.message('SUMM','UP - main controller', 20);
488: hr_dm_utility.message('ROUT','exit:hr_dm_upload.set_globals', 25);
489: hr_dm_utility.message('PARA','(1 - 1)', 30);
490:
483:
484:
485:
486: hr_dm_utility.message('INFO','UP - main controller', 15);
487: hr_dm_utility.message('SUMM','UP - main controller', 20);
488: hr_dm_utility.message('ROUT','exit:hr_dm_upload.set_globals', 25);
489: hr_dm_utility.message('PARA','(1 - 1)', 30);
490:
491:
484:
485:
486: hr_dm_utility.message('INFO','UP - main controller', 15);
487: hr_dm_utility.message('SUMM','UP - main controller', 20);
488: hr_dm_utility.message('ROUT','exit:hr_dm_upload.set_globals', 25);
489: hr_dm_utility.message('PARA','(1 - 1)', 30);
490:
491:
492: RETURN(1);
485:
486: hr_dm_utility.message('INFO','UP - main controller', 15);
487: hr_dm_utility.message('SUMM','UP - main controller', 20);
488: hr_dm_utility.message('ROUT','exit:hr_dm_upload.set_globals', 25);
489: hr_dm_utility.message('PARA','(1 - 1)', 30);
490:
491:
492: RETURN(1);
493:
492: RETURN(1);
493:
494: EXCEPTION
495: WHEN e_fatal_error THEN
496: hr_dm_utility.error(SQLCODE,'hr_dm_upload.set_globals',
497: l_fatal_error_message,'R');
498:
499: WHEN OTHERS THEN
500: hr_dm_utility.error(SQLCODE,'hr_dm_upload.set_globals','(none)','R');
496: hr_dm_utility.error(SQLCODE,'hr_dm_upload.set_globals',
497: l_fatal_error_message,'R');
498:
499: WHEN OTHERS THEN
500: hr_dm_utility.error(SQLCODE,'hr_dm_upload.set_globals','(none)','R');
501: RAISE;
502:
503: --
504: END set_globals;