REM############################################################################ REM REM Copyright (c) 2002, 2003, Oracle Corporation. All rights reserved. REM REM REM PRODUCT REM Oracle Enterprise Manager REM REM THIS FILE IS MACHINE GENERATED. DO NOT EDIT! REM REM JOB TYPE SQL FOR JOB TYPE: DBUnconfig REM REM############################################################################# SET DEFINE OFF SET SQLPREFIX OFF BEGIN BEGIN DECLARE l_job_type_name MGMT_JOB_TYPE_INFO.job_type%TYPE; l_job_type_id MGMT_JOB_TYPE_INFO.job_type_id%TYPE; l_major_version MGMT_JOB_TYPE_INFO.major_version%TYPE; l_minor_version1 MGMT_JOB_TYPE_INFO.minor_version1%TYPE; l_minor_version2 MGMT_JOB_TYPE_INFO.minor_version2%TYPE; BEGIN l_job_type_name:= 'DBUnconfig'; BEGIN MGMT_JOB_ENGINE.fix_flatten_steps(TRUE); MGMT_JOB_ENGINE.get_max_versions(l_job_type_name, l_major_version, l_minor_version1, l_minor_version2, l_job_type_id); l_minor_version2 := l_minor_version2+1; EXCEPTION WHEN OTHERS THEN IF SQLCODE=MGMT_GLOBAL.INVALID_JOB_TYPE_ERR THEN l_major_version := 1; l_minor_version1 := 0; l_minor_version2 := 1; ELSE RAISE; END IF; END; -- CHECK TO VALIDATE REFERENCED COMMANDS/NESTED JOB TYPES BEGIN DECLARE l_commands SMP_EMD_STRING_ARRAY := SMP_EMD_STRING_ARRAY(); l_nested_jobtypes SMP_EMD_STRING_ARRAY := SMP_EMD_STRING_ARRAY(); BEGIN l_commands.trim(l_commands.count); l_commands.extend(3); l_commands(1) := 'remoteOp'; l_commands(2) := 'reloadTargetProperties'; l_commands(3) := 'putFile'; MGMT_JOB_ENGINE.validate_job_type(l_job_type_name, l_commands, l_nested_jobtypes ); END; END; -- JOBTYPE ENTRY INSERT INTO MGMT_JOB_TYPE_INFO(job_type, version, major_version, minor_version1, minor_version2, job_type_category, all_target_types, agent_bound, single_target, suspend_on_nocreds, default_target_type, restartable, editable, suspendable, trusted,job_type_nlsid,job_type_default,create_text_nlsid,create_text_default,delete_text_nlsid,delete_text_default) VALUES ( l_job_type_name, '1.0', l_major_version, l_minor_version1, l_minor_version2, 0, 0, 0, 0, 0, null, 1, 0, 0, -1, null, null, null, null, null, null) RETURNING job_type_id INTO l_job_type_id; -- ENTRIES FOR STEPSET main INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'main', 2, null, null, -1, null, -1, null, null, null, null, null, 1, null, 'runSQL', null, 1, 0, 0, 0, null, null, -1 ); -- PARAMINFO ENTRIES FOR STEP sqlFile -- PARAM SOURCE: source type user BEGIN DECLARE l_param_names MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN l_param_names.trim(l_param_names.count); l_param_names.extend(8); l_param_names(1) := 'host_username'; l_param_names(2) := 'host_password'; l_param_names(3) := 'db_user'; l_param_names(4) := 'db_password'; l_param_names(5) := 'db_role'; l_param_names(6) := 'put_sql_file'; l_param_names(7) := 'src_filename'; l_param_names(8) := 'dest_filename'; INSERT INTO MGMT_JOB_PARAM_SOURCE(job_type_id, apply_at_submission, apply_on_retry, step_name, step_type, source_type, source_index, source_data, override_user, required, encrypted, parameter_names) VALUES ( l_job_type_id, 1, 0, 'sqlFile', 3, 'user', 1, null, 0, 1, 0, l_param_names ); END; END; -- PARAM SOURCE: source type properties BEGIN DECLARE l_param_names MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN l_param_names.trim(l_param_names.count); l_param_names.extend(2); l_param_names(1) := 'p_oracle_home'; l_param_names(2) := 'p_oracle_sid'; INSERT INTO MGMT_JOB_PARAM_SOURCE(job_type_id, apply_at_submission, apply_on_retry, step_name, step_type, source_type, source_index, source_data, override_user, required, encrypted, parameter_names) VALUES ( l_job_type_id, 1, 0, 'sqlFile', 3, 'properties', 2, ' ', 1, 0, 0, l_param_names ); END; END; -- PROPERTIES PARAM SOURCE DETAILS BEGIN DECLARE l_prop_columns MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); l_target_names MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); l_target_types MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN l_prop_columns.trim(l_prop_columns.count); l_prop_columns.extend(2); l_prop_columns(1) := 'OracleHome'; l_prop_columns(2) := 'SID'; INSERT INTO MGMT_JOB_PROP_PARAMS(source_id, property_names, property_names_param, target_names, target_types, target_names_param, target_types_param) SELECT source_id, l_prop_columns, null, null, null, 'job_target_names', 'job_target_types' FROM MGMT_JOB_PARAM_SOURCE WHERE job_type_id=l_job_type_id AND source_index=2; END; END; -- PARAM SOURCE: source type user BEGIN DECLARE l_param_names MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN l_param_names.trim(l_param_names.count); l_param_names.extend(2); l_param_names(1) := 'host_password'; l_param_names(2) := 'db_password'; INSERT INTO MGMT_JOB_PARAM_SOURCE(job_type_id, apply_at_submission, apply_on_retry, step_name, step_type, source_type, source_index, source_data, override_user, required, encrypted, parameter_names) VALUES ( l_job_type_id, 1, 0, 'sqlFile', 3, 'user', 3, null, 0, 0, 1, l_param_names ); END; END; -- ENTRIES FOR STEPSET sqlFile INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'sqlFile', 3, null, null, 1, 'main', 2, 'put_sql_file', null, null, null, null, 1, 'main', null, null, 1, 0, 0, 0, null, null, -1 ); -- ENTRIES FOR STEP putSqlFile INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'putSqlFile', 1, null, null, 3, 'sqlFile', 3, null, null, 'true', null, null, 0, 'sqlFile', null, 'putFile', 1, 0, 0, 0, null, null, -1 ); -- STEP PARAMETERS FOR STEP putSqlFile BEGIN DECLARE l_vector_values MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'putSqlFile', 'sourceType', 1, 0, 'file', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'putSqlFile', 'targetName', 1, 0, '%job_target_names%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'putSqlFile', 'targetType', 1, 0, '%job_target_types%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'putSqlFile', 'username', 1, 0, '%host_username%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'putSqlFile', 'password', 1, 0, '%host_password%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'putSqlFile', 'sourceFile', 1, 0, '%src_filename%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'putSqlFile', 'destFile', 1, 0, '%dest_filename%', null, null ); END; END; -- ENTRIES FOR STEPSET runSQL INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'runSQL', 3, null, null, 2, 'sqlFile', 3, 'put_sql_file', null, null, null, null, 1, 'main', null, null, 1, 0, 0, 0, null, null, -1 ); -- ENTRIES FOR STEP runUnconfigSql INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'runUnconfigSql', 1, null, null, 3, 'runSQL', 3, null, null, 'true', null, null, 0, 'runSQL', null, 'remoteOp', 1, 0, 0, 0, null, null, -1 ); -- STEP PARAMETERS FOR STEP runUnconfigSql BEGIN DECLARE l_vector_values MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSql', 'remoteCommand', 1, 0, '%perlbin%/perl', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSql', 'input', 1, 0, ' require "$ENV{EMDROOT}/sysman/admin/scripts/db/db_common.pl"; my $oracle_home = ''%p_oracle_home%[1]''; my $oracle_sid = ''%p_oracle_sid%[1]''; my $operation = ''UNCONFIG''; my $db_user = ''%db_user%''; my $db_role = ''%db_role%''; my $db_password = ''%db_password%''; my $dbm_password = ''%dbm_password%''; my $drop_sql = "$ENV{EMDROOT}/sysman/admin/scripts/db/config/drop.sql"; my $connect_string; if($db_role =~ /SYSDBA/i) { $connect_string = "\"$db_user/$db_password as $db_role\""; } else { $connect_string = "\"$db_user/$db_password\""; } my $dest_filename = ''%dest_filename%''; my $sqlcmd = $dest_filename." $connect_string $drop_sql"; &set_env_var($oracle_home, $oracle_sid, "FALSE"); my $SQLPID = open(SQL, "|$ENV{ORACLE_HOME}/bin/sqlplus /nolog"); if(!$SQLPID) { print_error("ERROR: could not run SQLPLUS\n"); exit (1); } print SQL "\' || CHR(ASCII('@')) || '$sqlcmd\n"; print SQL "exit\n"; close(SQL); exit 0; ', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSql', 'targetName', 1, 0, '%job_target_names%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSql', 'targetType', 1, 0, '%job_target_types%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSql', 'username', 1, 0, '%host_username%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSql', 'password', 1, 0, '%host_password%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSql', 'executeSynchronous', 1, 0, 'false', null, null ); END; END; -- ENTRIES FOR STEP runUnconfigSQL INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'runUnconfigSQL', 1, null, null, 3, 'runSQL', 3, null, null, 'false', null, null, 0, 'runSQL', null, 'remoteOp', 1, 0, 0, 0, null, null, -1 ); -- STEP PARAMETERS FOR STEP runUnconfigSQL BEGIN DECLARE l_vector_values MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSQL', 'remoteCommand', 1, 0, '%perlbin%/perl', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSQL', 'input', 1, 0, ' require "$ENV{EMDROOT}/sysman/admin/scripts/db/config/dbconfigure.pl"; $oracle_home = ''%p_oracle_home%[1]''; $oracle_sid = ''%p_oracle_sid%[1]''; $operation = ''UNCONFIG''; $db_user = ''%db_user%''; $db_role = ''%db_role%''; $db_password = ''%db_password%''; &do_configure; ', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSQL', 'targetName', 1, 0, '%job_target_names%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSQL', 'targetType', 1, 0, '%job_target_types%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSQL', 'username', 1, 0, '%host_username%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSQL', 'password', 1, 0, '%host_password%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'runUnconfigSQL', 'executeSynchronous', 1, 0, 'false', null, null ); END; END; -- ENTRIES FOR STEPSET cleanup INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'cleanup', 3, null, null, 7, 'runSQL', 3, 'put_sql_file', null, null, null, null, 1, 'main', null, null, 1, 0, 0, 0, null, null, -1 ); -- ENTRIES FOR STEP removeSqlFile INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'removeSqlFile', 1, null, null, 3, 'cleanup', 3, null, null, 'true', null, null, 0, 'cleanup', null, 'remoteOp', 1, 0, 0, 0, null, null, -1 ); -- STEP PARAMETERS FOR STEP removeSqlFile BEGIN DECLARE l_vector_values MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'removeSqlFile', 'remoteCommand', 1, 0, '%perlbin%/perl', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'removeSqlFile', 'input', 1, 0, ' require "$ENV{EMDROOT}/sysman/admin/scripts/db/db_common.pl"; my $dest_filename = ''%dest_filename%''; removeDir(getDirname($dest_filename)); exit 0; ', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'removeSqlFile', 'targetName', 1, 0, '%job_target_names%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'removeSqlFile', 'targetType', 1, 0, '%job_target_types%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'removeSqlFile', 'username', 1, 0, '%host_username%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'removeSqlFile', 'password', 1, 0, '%host_password%', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'removeSqlFile', 'executeSynchronous', 1, 0, 'false', null, null ); END; END; -- ENTRIES FOR STEP ReloadState INSERT INTO mgmt_job_execplan(job_type_id, step_name, step_type, nested_job_type, nested_job_target_type, incoming_edge_type, origin_step_name, origin_step_type, switch_var_name, switch_var_index, switch_case_val, iterate_param, iterate_param_filter, num_children, stepset_name, stepset_status, command_name, restart_mode, all_params, all_targets, halt_on_failure,step_nlsid ,step_default,trusted) VALUES ( l_job_type_id, 'ReloadState', 1, null, null, 2, 'cleanup', 3, null, null, null, null, null, 0, 'main', null, 'reloadTargetProperties', 1, 0, 0, 0, null, null, -1 ); -- STEP PARAMETERS FOR STEP ReloadState BEGIN DECLARE l_vector_values MGMT_JOB_VECTOR_PARAMS := MGMT_JOB_VECTOR_PARAMS(); BEGIN INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'ReloadState', 'targetName', 1, 0, '%job_target_names%[1]', null, null ); INSERT INTO MGMT_JOB_STEP_PARAMS(job_type_id, step_name, param_name, parameter_type, encrypted, scalar_value, vector_value, value_of) VALUES ( l_job_type_id, 'ReloadState', 'targetType', 1, 0, '%job_target_types%[1]', null, null ); END; END; -- Ensure that all existing scheduled executions use the new jobtype version MGMT_JOB_ENGINE.reschedule_on_new_jobtype_ver(l_job_type_id); -- Patch NLS information for backward-compatibility MGMT_JOB_ENGINE.update_job_type_nls_info(l_job_type_id, l_job_type_name); END; END; MGMT_JOB_ENGINE.fix_flatten_steps(FALSE); EXCEPTION WHEN OTHERS THEN MGMT_JOB_ENGINE.fix_flatten_steps(FALSE); RAISE; END; / COMMIT; SET DEFINE ON SET SQLPREFIX ON