日期:2014-05-16 浏览次数:20483 次
-- Created on 2012/12/20 by ZHENGTIAN declare --服务模板ID srv_tp_id varchar2(256); --服务模板URI srv_tp_uri varchar2(256); --服务模板配置ID srv_tp_cfg_id varchar2(256); --服务模板配置URI srv_tp_cfg_uri varchar2(2000); --是否存在common标志位 common_flag integer; --是否存在pipeline标志位 pipeline_flag integer; --common和pipeline的初始化数据 common_init_data varchar2(4000) := '<common_config><start_cmd></start_cmd><stop_cmd></stop_cmd><forced_stop_cmd></forced_stop_cmd><check_cmd></check_cmd><restart_cmd></restart_cmd><ts_classpath></ts_classpath><log><file_prefix></file_prefix><level>debug</level><show_io_log>true</show_io_log><log4j-configuration><appender><class>DailyRollingFileAppender</class><name>dailyrollingfile</name><param><name>maxfilesize</name><value></value></param><param><name>datepattern</name><value>yyyy-MM-dd</value></param><param><name>intervalmin</name><value></value></param><param><name>maxbackupindex</name><value></value></param><param><name>flush_immediately</name><value>true</value></param><param><name>file</name><value>$LOGPATH/aierr/</value></param><layout><class>SimpleLayout</class></layout><param><name>max</name><value></value></param></appender><root><priority><value>trace</value></priority><appender-ref><ref>dailyrollingfile</ref></appender-ref></root></log4j-configuration><path>$LOGPATH/</path></log></common_config>'; pipeline_init_data varchar2(4000) := '<pipe_line><pipe_line_configs><sysinfo /></pipe_line_configs><pipe_line_id>1</pipe_line_id><pipe_line_name>ts</pipe_line_name><pipe_line_type>business</pipe_line_type></pipe_line>'; --服务模板查询条件 srv_tp_prefix varchar2(256) := '/config/cpf/bm_tp_service/data/'; --查询数据库中所有的服务模板的URI cursor cursor_srv_tp_sel is select t.uri from cfg_runtime_data t where t.uri like srv_tp_prefix || '%'; --服务模板配置查询条件 srv_tp_cfg_prefix varchar2(256) := '/config/cpf/bm_tp_service_cfg/data/'; srv_tp_cfg_sql varchar2(512); cursor_srv_tp_cfg_sel sys_refcursor; begin --循环结果集 for flow_tp in cursor_srv_tp_sel loop srv_tp_uri := flow_tp.uri; --dbms_output.put_line('uri:' || srv_tp_uri); srv_tp_id := substr(srv_tp_uri,length(srv_tp_prefix)+1,length(srv_tp_uri)); --dbms_output.put_line(srv_tp_id); --组装查询服务模板配置的sql srv_tp_cfg_sql := 'select t.uri from cfg_runtime_data t where t.uri like ''' || srv_tp_cfg_prefix || srv_tp_id || '%'''; --dbms_output.put_line(srv_tp_cfg_sql); --初始化标志位 common_flag := 0; pipeline_flag := 0; --查询服务模板配置 open cursor_srv_tp_cfg_sel for srv_tp_cfg_sql; loop fetch cursor_srv_tp_cfg_sel into srv_tp_cfg_uri; exit when cursor_srv_tp_cfg_sel%notfound; srv_tp_cfg_id := substr(srv_tp_cfg_uri,length(srv_tp_cfg_prefix)+length(srv_tp_id)+1,length(srv_tp_cfg_uri)); --dbms_output.put_line(srv_tp_cfg_id); if srv_tp_cfg_id = '_common_1' then common_flag := 1; end if; if srv_tp_cfg_id = '_pipeline_1' then pipeline_flag := 1; end if