...
Code Block | ||
---|---|---|
| ||
DECLARE
num_N_JOB_ID NUMBER := -101;
--
ch_Invalidate SS_PARVALUES.C_FLAG_VALUE%TYPE;
ch_StaleOnly SS_PARVALUES.C_FLAG_VALUE%TYPE;
num_AnalyzePercent SS_PARVALUES.N_VALUE%TYPE;
BEGIN
DBMS_STATS.SET_GLOBAL_PREFS('NO_INVALIDATE', 'FALSE');
-- Сохранение текущих параметров
num_AnalyzePercent := SS_PARS_PKG_S.GET_N_VALUE_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_AnalyzePercent',
num_N_JOB_ID => num_N_JOB_ID);
ch_StaleOnly := SS_PARS_PKG_S.GET_C_FLAG_VALUE_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_StaleOnly',
num_N_JOB_ID => num_N_JOB_ID);
ch_Invalidate := SS_PARS_PKG_S.GET_C_FLAG_VALUE_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_InvalidateCursors',
num_N_JOB_ID => num_N_JOB_ID);
-- Установка нужных параметров
SS_PARS_PKG.SS_PARVALUES_PUT(
num_N_PAR_ID => SS_PARS_PKG_S.GET_PAR_ID_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_AnalyzePercent',
num_N_JOB_ID => num_N_JOB_ID),
num_N_SUBJECT_ID => NULL,
num_N_APPLICATION_ID => NULL,
num_N_VALUE => 100,
num_N_JOB_ID => num_N_JOB_ID);
SS_PARS_PKG.SS_PARVALUES_PUT(
num_N_PAR_ID => SS_PARS_PKG_S.GET_PAR_ID_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_StaleOnly',
num_N_JOB_ID => num_N_JOB_ID),
num_N_SUBJECT_ID => NULL,
num_N_APPLICATION_ID => NULL,
ch_C_FLAG_VALUE => 'N',
num_N_JOB_ID => num_N_JOB_ID);
SS_PARS_PKG.SS_PARVALUES_PUT(
num_N_PAR_ID => SS_PARS_PKG_S.GET_PAR_ID_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_InvalidateCursors',
num_N_JOB_ID => num_N_JOB_ID),
num_N_SUBJECT_ID => NULL,
num_N_APPLICATION_ID => NULL,
ch_C_FLAG_VALUE => 'Y',
num_N_JOB_ID => num_N_JOB_ID);
COMMIT;
-- Подготовка к выполнению задания вручную
SS_JOBS_PKG.MANUAL_START_JOB(num_N_JOB_ID);
-- Выполнение задания в текущей сессии
SS_JOBS_PKG.RUN_JOB(
num_N_JOB_ID => num_N_JOB_ID,
ch_C_REASON => 'M');
DBMS_STATS.SET_GLOBAL_PREFS('NO_INVALIDATE', 'DBMS_STATS.AUTO_INVALIDATE');
-- Возврат сохраненных параметров
SS_PARS_PKG.SS_PARVALUES_PUT(
num_N_PAR_ID => SS_PARS_PKG_S.GET_PAR_ID_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_AnalyzePercent',
num_N_JOB_ID => num_N_JOB_ID),
num_N_SUBJECT_ID => NULL,
num_N_APPLICATION_ID => NULL,
num_N_VALUE => num_AnalyzePercent,
num_N_JOB_ID => num_N_JOB_ID);
SS_PARS_PKG.SS_PARVALUES_PUT(
num_N_PAR_ID => SS_PARS_PKG_S.GET_PAR_ID_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_StaleOnly',
num_N_JOB_ID => num_N_JOB_ID),
num_N_SUBJECT_ID => NULL,
num_N_APPLICATION_ID => NULL,
ch_C_FLAG_VALUE => ch_StaleOnly,
num_N_JOB_ID => num_N_JOB_ID);
SS_PARS_PKG.SS_PARVALUES_PUT(
num_N_PAR_ID => SS_PARS_PKG_S.GET_PAR_ID_BY_CODE(
vch_VC_CODE => 'PAR_JobAnalyzeSchema_InvalidateCursors',
num_N_JOB_ID => num_N_JOB_ID),
num_N_SUBJECT_ID => NULL,
num_N_APPLICATION_ID => NULL,
ch_C_FLAG_VALUE => ch_Invalidate,
num_N_JOB_ID => num_N_JOB_ID);
COMMIT;
END;
/ |