TS_COLLECT_PRD.sql 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. --/
  2. CREATE PROCEDURE TS_COLLECT_PRD( TYPE in varchar2)
  3. AS
  4. -- add by dufs 2017-05-05
  5. -- 综合区域保障场景 数据处理
  6. -- 调用方式 211.4服务器上crontab 任务
  7. -- #=========================== 综合区域保障场景数据接入 =========================================================
  8. -- 3,18,33,48 * * * * . $HOME/.profile; cd /backup/ts_collect; ./ts_city_info_15_Run.sh >/dev/null 2>&1
  9. -- #=========================== 综合区域保障场景数据接入 =========================================================
  10. v_createtime date;
  11. v_table varchar2(64);
  12. v_sql varchar2(2000);
  13. v_logInfo varchar2(500);
  14. begin
  15. case when TYPE='CITY'
  16. then
  17. select max(createtime) into v_createtime from ts_city_info_15_tp ;
  18. if v_createtime is null
  19. then
  20. return;
  21. end if;
  22. -- insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_city_info_15)','开始执行');
  23. --15分钟地市业务聚合表
  24. insert /* + append */ into ts_city_info_15 (createtime,cityid,city,at,ast,at_name,ast_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  25. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  26. select createtime,cityid,m.enum_value,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  27. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  28. from ts_city_info_15_tp t
  29. left join ts_enum m on t.cityid=m.enum_key and m.enum_type='地市'
  30. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类' ;
  31. --where not exists (select 1 from ts_city_info_15 a1 where a1.createtime=t.createtime and a1.cityid=t.cityid and a1.at=t.at and a1.ast=t.ast);
  32. commit;
  33. -- insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_city_info_15)','执行结束');
  34. -- commit;
  35. TS_CITY_COUNT_PRD('AST');
  36. -- insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_CITY_COUNT_PRD - AST )','执行结束');
  37. -- commit;
  38. TS_CITY_COUNT_PRD('AT');
  39. -- insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_CITY_COUNT_PRD - AT )','执行结束');
  40. -- commit;
  41. /* 将以下表汇聚的时间、表名、数量等记录到ts_dataimport_record中,用于前台展示使用
  42. ts_city_info_15
  43. ts_prov_info_15
  44. ts_city_apptype_info_15
  45. ts_prov_apptype_info_15
  46. */
  47. for cur_cell in (select relatetable from ts_enum_table_relation where basetable ='ts_city_info_15_tp'
  48. )loop
  49. v_table:=cur_cell.relatetable;
  50. v_sql:='insert into ts_dataimport_record(createtime,table_name,cnt) select * from (select :x1 as createtime,:x2 as table_name,count(*) as cnt from '||v_table||' t where createtime=:x1 ) t1 where not exists (select 1 from ts_dataimport_record t2 where t1.createtime=t2.createtime and t2.table_name=:x2)';
  51. execute immediate v_sql using v_createtime,v_table,v_createtime,v_table;
  52. commit;
  53. -- DBms_output.put_line(v_table||'----'||v_createtime||'-----'||v_sql);
  54. end loop;
  55. -- insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(ts_dataimport_record - ts_city_info_15_tp )','执行结束');
  56. -- commit;
  57. TS_ALARM_PRD_NEW('PROV_ACC_SUCC');
  58. -- add by dufs 2018-5-29
  59. -- 省、地市业务大类、业务小类指标的业务访问成功率、下载流量、速率异常告警(较上周去掉最高、最低后平均值下降30%)
  60. TS_ALARM_PRD_NEW('PROV_AT_APP_SUCC');
  61. TS_ALARM_PRD_NEW('PROV_AT_APP_DL');
  62. TS_ALARM_PRD_NEW('PROV_AT_APP_RATE');
  63. TS_ALARM_PRD_NEW('PROV_AST_APP_SUCC');
  64. TS_ALARM_PRD_NEW('PROV_AST_APP_DL');
  65. TS_ALARM_PRD_NEW('PROV_AST_APP_RATE');
  66. TS_ALARM_PRD_NEW('CITY_AT_APP_SUCC');
  67. TS_ALARM_PRD_NEW('CITY_AT_APP_DL');
  68. TS_ALARM_PRD_NEW('CITY_AT_APP_RATE');
  69. TS_ALARM_PRD_NEW('CITY_AST_APP_SUCC');
  70. TS_ALARM_PRD_NEW('CITY_AST_APP_DL');
  71. TS_ALARM_PRD_NEW('CITY_AST_APP_RATE');
  72. when TYPE='CELL_PART'
  73. then
  74. -- 有多个数据文件,分文件处理数据,导入tp表中,关联小区和场景后写入ts_cell_info_15
  75. insert into ts_cell_info_15_tp (createtime,eci,cell_id,cell_name,at,ast,at_name,ast_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  76. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  77. select createtime,t.eci,r.objectid,r.objectname,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  78. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  79. from ts_cell_info_15_tp_tp t
  80. left join rm_eutrancell_eci r on t.eci=r.eci
  81. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类'
  82. where exists (select 1 from rm_senareane_space_mv a where r.objectid=a.object_id and a.sen_type_id='ST0012')
  83. ;
  84. commit;
  85. /*
  86. union
  87. -- 2017-10-26 增加居民区小区数据,为汇聚区县级居民区指标准备
  88. select createtime,t.eci,r.objectid,r.objectname,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  89. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  90. from ts_cell_info_15_tp_tp t
  91. left join rm_eutrancell_eci r on t.eci=r.eci
  92. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类'
  93. where exists (select 1 from rm_eutrancell eu where eu.objectid=r.objectid and eu.scencetype in ('低层居民区','别墅群','高层居民区','城中村'))
  94. ;
  95. commit;
  96. */
  97. insert /* + append */ into ts_cell_info_15 (createtime,eci,cell_id,cell_name,at,ast,at_name,ast_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  98. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  99. select createtime,t.eci,r.objectid,r.objectname,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  100. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  101. from ts_cell_info_15_tp_tp t
  102. left join rm_eutrancell_eci r on t.eci=r.eci
  103. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类'
  104. where exists (select 1 from rm_senareane_space_mv a where r.objectid=a.object_id and a.sen_type_id='ST0012')
  105. ;
  106. commit;
  107. /*
  108. -- 有多个数据文件,分文件处理数据,导入tp表中,关联小区和场景后写入ts_cell_info_15
  109. insert into ts_cell_info_15 (createtime,eci,cell_id,cell_name,at,ast,at_name,ast_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  110. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  111. select createtime,t.eci,r.objectid,r.objectname,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  112. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  113. from ts_cell_info_15_tp_tp t
  114. join rm_eutrancell_eci_n r on t.eci=r.eci
  115. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类'
  116. where exists (select 1 from rm_senareane_space_mv a where r.objectid=a.object_id and a.sen_type_id='ST0012')
  117. or r.scencetype in ('低层居民区','别墅群','高层居民区','城中村')
  118. union
  119. -- 2017-10-26 增加居民区小区数据,为汇聚区县级居民区指标准备
  120. select createtime,t.eci,r.objectid,r.objectname,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  121. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  122. from ts_cell_info_15_tp_tp t
  123. left join rm_eutrancell_eci r on t.eci=r.eci
  124. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类'
  125. where exists (select 1 from rm_eutrancell eu where eu.objectid=r.objectid and eu.scencetype in ('低层居民区','别墅群','高层居民区','城中村'))
  126. ;
  127. */
  128. commit;
  129. when TYPE='CELL'
  130. then
  131. select max(createtime) into v_createtime from ts_cell_info_15_tp;
  132. if v_createtime is null
  133. then
  134. return;
  135. end if;
  136. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_info_15 )_3_1','开始执行');
  137. --15分钟小区业务大小类
  138. /*
  139. insert into ts_cell_info_15 (createtime,eci,cell_id,cell_name,at,ast,at_name,ast_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2)
  140. select createtime,t.eci,r.objectid,r.objectname,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2
  141. from ts_cell_info_15_tp t
  142. left join rm_eutrancell_eci r on t.eci=r.eci
  143. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类' ;
  144. -- where not exists (select 1 from ts_cell_info_15 a1 where a1.createtime=t.createtime and a1.eci=t.eci and a1.at=t.at and a1.ast=t.ast) ;
  145. */
  146. -- dufs 2018-1-24 这个有时候要执行将近5分钟, 改成在CELL_PART里分批写入的方式,30多秒
  147. --insert into ts_cell_info_15 select * from ts_cell_info_15_tp;
  148. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_info_15 )_3_2','执行结束');
  149. commit;
  150. TS_AREA_COUNT_PRD('AST');
  151. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_AREA_COUNT_PRD - AST )_3_3','执行结束');
  152. commit;
  153. TS_SEN_COUNT_PRD('AST');
  154. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_SEN_COUNT_PRD - AST )_3_4','执行结束');
  155. commit;
  156. --指定业务小类,按区县汇聚数据
  157. TS_COUNTY_COUNT_PRD('AST');
  158. /*将以下表汇聚的时间、表名、数量等记录到ts_dataimport_record中,用于前台展示使用
  159. ts_area_count
  160. ts_sen_count
  161. */
  162. for cur_cell in (select relatetable from ts_enum_table_relation where basetable ='ts_cell_info_15_tp'
  163. )loop
  164. v_table:=cur_cell.relatetable;
  165. v_sql:='insert into ts_dataimport_record(createtime,table_name,cnt) select * from (select :x1 as createtime,:x2 as table_name,count(*) as cnt from '||v_table||' t where createtime=:x1 ) t1 where not exists (select 1 from ts_dataimport_record t2 where t1.createtime=t2.createtime and t2.table_name=:x2)';
  166. execute immediate v_sql using v_createtime,v_table,v_createtime,v_table;
  167. commit;
  168. -- DBms_output.put_line(v_table||'----'||v_createtime||'-----'||v_sql);
  169. end loop;
  170. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(ts_dataimport_record - ts_cell_info_15_tp )_3_5','执行结束');
  171. commit;
  172. when TYPE='CELL_DZG'
  173. then
  174. -- 业务大类”其中“,业务小类”大掌柜“,每小时1份数据,需要自动复制生成每15分钟1份数据
  175. select max(createtime) into v_createtime from ts_cell_info_15_tp_dzg;
  176. if v_createtime is null
  177. then
  178. return;
  179. end if;
  180. execute immediate 'truncate table ts_cell_info_15_dzg';
  181. insert /* + append */ into ts_cell_info_15_dzg (createtime,eci,cell_id,cell_name,at,ast,at_name,ast_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  182. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  183. select t_day,t.eci,r.objectid,r.objectname,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  184. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  185. from ts_cell_info_15_tp_dzg t
  186. left join (select v_createtime + (level-1 ) / 96 t_day from dual connect by level <= 4) a on 1=1
  187. left join rm_eutrancell_eci r on t.eci=r.eci
  188. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类'
  189. where exists (select 1 from rm_senareane_space_mv a where r.objectid=a.object_id and a.sen_type_id='ST0012');
  190. commit;
  191. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_info_15_dzg )','执行结束');
  192. commit;
  193. TS_AREA_COUNT_PRD('DZG');
  194. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_AREA_COUNT_PRD - DZG )','执行结束');
  195. commit;
  196. TS_SEN_COUNT_PRD('DZG');
  197. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_SEN_COUNT_PRD - DZG )','执行结束');
  198. commit;
  199. when TYPE='CELL_APPTYPE_PART'
  200. then
  201. -- 有多个数据文件,分文件处理数据,导入tp表中,关联小区和场景后写入ts_cell_apptype_info_15
  202. insert into ts_cell_apptype_info_15_tp (createtime,eci,cell_id,cell_name,at,at_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  203. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  204. select createtime,t.eci,r.objectid,r.objectname,at,m1.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  205. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  206. from ts_cell_apptype_info_15_tp_tp t
  207. left join rm_eutrancell_eci r on t.eci=r.eci
  208. left join ts_enum m1 on t.at=m1.enum_key and m1.enum_type='业务大类'
  209. where exists (select 1 from rm_senareane_space_mv a where r.objectid=a.object_id and a.sen_type_id='ST0012');
  210. commit;
  211. when TYPE='CELL_APPTYPE'
  212. then
  213. select max(createtime) into v_createtime from ts_cell_apptype_info_15_tp;
  214. if v_createtime is null
  215. then
  216. return;
  217. end if;
  218. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_apptype_info_15 )_1_1','开始执行');
  219. commit;
  220. --15分钟小区业务大类
  221. --2017-5-28 只保留与场景相关的小区数据
  222. /*
  223. insert into ts_cell_apptype_info_15 (createtime,eci,cell_id,cell_name,at,at_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  224. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  225. select createtime,t.eci,r.objectid,r.objectname,at,m1.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2,
  226. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  227. from ts_cell_apptype_info_15_tp t
  228. left join rm_eutrancell_eci r on t.eci=r.eci
  229. left join ts_enum m1 on t.at=m1.enum_key and m1.enum_type='业务大类'
  230. where exists (select 1 from tscene_sre sre join tscene_sba sba on sre.be_id=sba.area_id and sba.sen_type_id='ST0012' join tscene_areainfo area on sba.area_id=area.area_id where sre.object_id=r.objectid);
  231. commit;
  232. */
  233. insert /* + append */ into ts_cell_apptype_info_15 select * from ts_cell_apptype_info_15_tp;
  234. commit;
  235. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_apptype_info_15 )_1_2','执行结束');
  236. commit;
  237. TS_AREA_COUNT_PRD('AT');
  238. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_AREA_COUNT_PRD - AT )_1_3','执行结束');
  239. commit;
  240. TS_SEN_COUNT_PRD('AT');
  241. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_SEN_COUNT_PRD - AT )_1_4','执行结束');
  242. commit;
  243. --小区业务大类指标预警生成
  244. TS_RULE_WARN_PRD('CELL_AT');
  245. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_RULE_WARN_PRD - CELL_AT )_1_5','执行结束');
  246. commit;
  247. --区域业务大类指标预警生成
  248. TS_RULE_WARN_PRD('AREA_AT');
  249. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_RULE_WARN_PRD - AREA_AT )_1_6','执行结束');
  250. commit;
  251. /*将以下表汇聚的时间、表名、数量等记录到ts_dataimport_record中,用于前台展示使用
  252. ts_area_apptype_count
  253. ts_sen_apptype_count
  254. */
  255. for cur_cell in (select relatetable from ts_enum_table_relation where basetable ='ts_cell_apptype_info_15_tp'
  256. )loop
  257. v_table:=cur_cell.relatetable;
  258. v_sql:='insert into ts_dataimport_record(createtime,table_name,cnt) select * from (select :x1 as createtime,:x2 as table_name,count(*) as cnt from '||v_table||' t where createtime=:x1 ) t1 where not exists (select 1 from ts_dataimport_record t2 where t1.createtime=t2.createtime and t2.table_name=:x2)';
  259. execute immediate v_sql using v_createtime,v_table,v_createtime,v_table;
  260. commit;
  261. -- DBms_output.put_line(v_table||'----'||v_createtime||'-----'||v_sql);
  262. end loop;
  263. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(ts_dataimport_record - ts_cell_apptype_info_15 )_1_7','执行结束');
  264. commit;
  265. -- 基于小区预警生成衍生告警
  266. -- TS_ALARM_PRD();
  267. --TS_ALARM_PRD_NEW('AREA'); --被5包规则替换
  268. --insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_ALARM_PRD(AREA) )_1_8','执行结束');
  269. --TS_ALARM_PRD_NEW('CITY'); --被5包规则替换
  270. --insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_ALARM_PRD(CITY) )_1_9','执行结束');
  271. --TS_ALARM_PRD_NEW('CELL'); --被5包规则替换
  272. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_ALARM_PRD(CELL) )_1_10','执行结束');
  273. TS_ALARM_PRD_NEW('CELL_5PKG');
  274. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(TS_ALARM_PRD(CELL_5PKG) )_1_11','执行结束');
  275. --add by dufs-2018-2-8 这个要在TS_ALARM_PRD_NEW('CELL_5PKG')的基础上执行
  276. -- 小区5包区域累计达到1/3
  277. TS_ALARM_PRD_NEW('CELL_AREA_5PKG');
  278. -- 小区5包地市累计达200次或1/10小区
  279. TS_ALARM_PRD_NEW('CELL_CITY_5PKG');
  280. -- 小区5包当天累计达到20次
  281. TS_ALARM_PRD_NEW('CELL_5PKG_TOTAL');
  282. -- 处理时判断了ts_dataimport_record表里有最近的ts_cell_common_info_15更新记录,所有要放到下面来
  283. TS_ALARM_PRD_NEW('CELL_OVERFLOW');
  284. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_ALARM_PRD_NEW - CELL_OVERFLOW )_2_11','执行结束');
  285. commit;
  286. -- 记录更新时间
  287. v_table:='ts_alarm';
  288. v_sql:='insert into ts_dataimport_record(createtime,table_name,cnt) select * from (select :x1 as createtime,:x2 as table_name,count(*) as cnt from '||v_table||' t where createtime=:x1 ) t1 where not exists (select 1 from ts_dataimport_record t2 where t1.createtime=t2.createtime and t1.table_name=t2.table_name)';
  289. execute immediate v_sql using v_createtime,v_table,v_createtime;
  290. commit;
  291. when TYPE='CELL_COMMON'
  292. then
  293. select max(createtime) into v_createtime from ts_cell_common_info_15_tp;
  294. if v_createtime is null
  295. then
  296. return;
  297. end if;
  298. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_common_info_15_tp )_2_1','开始执行');
  299. commit;
  300. --15分钟小区通用指标
  301. insert /* + append */ into ts_cell_common_info_15 (createtime,eci,cell_id,cell_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,delta_ty_dl,delta_ty_rate,
  302. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500)
  303. select createtime,t.eci,r.objectid,r.objectname,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,delta_ty_dl,delta_ty_rate,
  304. common_ul,common_dl,common_al,http_traffic_dl,http_traffic_dl_010,http_traffic_dl_1050,http_traffic_dl_50100,http_traffic_dl_100500,http_traffic_dl_500,http_dura_dl,http_dura_dl_010,http_dura_dl_1050,http_dura_dl_50100,http_dura_dl_100500,http_dura_dl_500,http_xdrc,http_xdrc_010,http_xdrc_1050,http_xdrc_50100,http_xdrc_100500,http_xdrc_500,http_dl_rate,http_dl_rate_010,http_dl_rate_1050,http_dl_rate_50100,http_dl_rate_100500,http_dl_rate_500,delta_http_traffic_dl,delta_http_traffic_dl_010,delta_http_traffic_dl_1050,delta_http_traffic_dl_50100,delta_http_traffic_dl_100500,delta_http_traffic_dl_500,delta_http_dl_rate,delta_http_dl_rate_010,delta_http_dl_rate_1050,delta_http_dl_rate_50100,delta_http_dl_rate_100500,delta_http_dl_rate_500,http_traffic_ul,http_traffic_ul_010,http_traffic_ul_1050,http_traffic_ul_50100,http_traffic_ul_100500,http_traffic_ul_500,http_dura_ul,http_dura_ul_010,http_dura_ul_1050,http_dura_ul_50100,http_dura_ul_100500,http_dura_ul_500,http_ul_rate,http_ul_rate_010,http_ul_rate_1050,http_ul_rate_50100,http_ul_rate_100500,http_ul_rate_500,delta_http_traffic_ul,delta_http_traffic_ul_010,delta_http_traffic_ul_1050,delta_http_traffic_ul_50100,delta_http_traffic_ul_100500,delta_http_traffic_ul_500,delta_http_ul_rate,delta_http_ul_rate_010,delta_http_ul_rate_1050,delta_http_ul_rate_50100,delta_http_ul_rate_100500,delta_http_ul_rate_500
  305. from ts_cell_common_info_15_tp t
  306. left join rm_eutrancell_eci r on t.eci=r.eci
  307. where exists (select 1 from rm_senareane_space_mv a where r.objectid=a.object_id and a.sen_type_id='ST0012')
  308. or exists (select 1 from ts_cell_vip v where r.eci=v.eci)
  309. or exists (select 1 from rm_enodeb b join rm_eutrancell r1 on r1.enodebid=b.objectid where r.objectid=r1.objectid and b.isvvipbts=1)
  310. ;
  311. commit;
  312. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_common_info_15_tp )_2_2','执行结束');
  313. commit;
  314. -- 先汇地市级别的,然后把场景外的小区从tp表中删掉,提高后续基于该表的操作效率。
  315. TS_CITY_COUNT_PRD('COMMON');
  316. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_CITY_COUNT_PRD - COMMON )_2_3','执行结束');
  317. commit;
  318. /*
  319. delete from ts_cell_common_info_15_tp t
  320. where not exists (select 1 from tscene_sre sre join tscene_sba sba on sre.be_id=sba.area_id and sba.sen_type_id='ST0012' join tscene_areainfo area on sba.area_id=area.area_id join rm_eutrancell_eci r1 on sre.object_id=r1.objectid
  321. where r1.eci=t.eci);
  322. commit;
  323. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( delete from ts_cell_common_info_15_tp t not exists)_2_4','执行结束');
  324. */
  325. TS_AREA_COUNT_PRD('COMMON');
  326. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_AREA_COUNT_PRD - COMMON )_2_5','执行结束');
  327. commit;
  328. TS_SEN_COUNT_PRD('COMMON');
  329. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_SEN_COUNT_PRD - COMMON )_2_6','执行结束');
  330. commit;
  331. --小区通用指标预警生成
  332. TS_RULE_WARN_PRD('CELL_COMMON');
  333. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_RULE_WARN_PRD - CELL_COMMON )_2_7','执行结束');
  334. commit;
  335. -- add by dufs 2017-11-9 只针对双十一保障期间,生成居民区小区的通用预警
  336. if (sysdate >=to_date('2017-11-09','yyyy-mm-dd') and sysdate<to_date('2017-11-12','yyyy-mm-dd'))
  337. then
  338. TS_RULE_WARN_PRD('CELL_COMMON_JMQ');
  339. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_RULE_WARN_PRD - CELL_COMMON_JMQ )_2_8','执行结束');
  340. commit;
  341. end if;
  342. --区域通用指标预警生成
  343. TS_RULE_WARN_PRD('AREA_COMMON');
  344. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( TS_RULE_WARN_PRD - AREA_COMMON )_2_9','执行结束');
  345. commit;
  346. /*将以下表汇聚的时间、表名、数量等记录到ts_dataimport_record中,用于前台展示使用
  347. ts_area_common_count
  348. ts_sen_common_count
  349. */
  350. for cur_cell in (select relatetable from ts_enum_table_relation where basetable ='ts_cell_common_info_15_tp'
  351. )loop
  352. v_table:=cur_cell.relatetable;
  353. v_sql:='insert into ts_dataimport_record(createtime,table_name,cnt) select * from (select :x1 as createtime,:x2 as table_name,count(*) as cnt from '||v_table||' t where createtime=:x1 ) t1 where not exists (select 1 from ts_dataimport_record t2 where t1.createtime=t2.createtime and t2.table_name=:x2)';
  354. execute immediate v_sql using v_createtime,v_table,v_createtime,v_table;
  355. commit;
  356. -- DBms_output.put_line(v_table||'----'||v_createtime||'-----'||v_sql);
  357. end loop;
  358. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(ts_dataimport_record - ts_cell_common_info_15_tp )_2_10','执行结束');
  359. commit;
  360. -- 下面的操作,要判断ts_dataimport_record表里最新记录的ts_cell_common_info_15表的信息,所以放在需要放到最后
  361. -- 通用业务HTTP访问成功率低于一级门限 VVIP小区
  362. TS_ALARM_PRD_NEW('CELL_APP_SUCC');
  363. -- 通用业务HTTP平均下载速率低于一级门限 VVIP小区
  364. TS_ALARM_PRD_NEW('CELL_HTTP_DL_RATE');
  365. -- 通用区县大面积低流量告警
  366. TS_ALARM_PRD_NEW('CELL_COUNTY_FLOW_LOW');
  367. -- 通用地市大面积低流量告警
  368. TS_ALARM_PRD_NEW('CELL_CITY_FLOW_LOW');
  369. -- 按地市、场景汇聚每小时汇聚的用户数
  370. when TYPE='cityScene'
  371. then
  372. select max(createtime) into v_createtime from ts_cityscene_usercount_tp;
  373. if v_createtime is null
  374. then
  375. return;
  376. end if;
  377. insert /* + append */ into ts_cityscene_usercount (createtime,cityid,city,sen_id,sen_name,user_count,granularity,object_type)
  378. select t.createtime,t.cityid,m.enum_value,t.sen_id,s.sen_name,user_count,granularity,
  379. case when t.cityid=0 and t.sen_id='8888' then '省'
  380. when t.cityid=0 and t.sen_id is not null and t.sen_id!='8888' then '省+场景'
  381. when t.cityid!=0 and t.sen_id='8888' then '地市'
  382. when t.cityid!=0 and t.sen_id is not null and t.sen_id!='8888' then '地市+场景'
  383. end object_type
  384. from ts_cityscene_usercount_tp t
  385. left join ts_enum m on t.cityid=m.enum_key and m.enum_type='地市'
  386. left join tscene_seninfo s on s.sen_id=t.sen_id
  387. ;
  388. commit;
  389. -- 按地市、场景、区域汇聚每小时汇聚的用户数
  390. when TYPE='sceneArea'
  391. then
  392. select max(createtime) into v_createtime from ts_scenearea_usercount_tp;
  393. if v_createtime is null
  394. then
  395. return;
  396. end if;
  397. insert /* + append */ into ts_scenearea_usercount (createtime,cityid,city,sen_id,sen_name,area_id,area_name,user_count,granularity)
  398. select t.createtime,t.cityid,m.enum_value,t.sen_id,s.sen_name,t.area_id,a.area_name,user_count,granularity
  399. from ts_scenearea_usercount_tp t
  400. left join ts_enum m on t.cityid=m.enum_key and m.enum_type='地市'
  401. left join tscene_seninfo s on s.sen_id=t.sen_id
  402. left join tscene_areainfo a on a.area_id=t.area_id
  403. ;
  404. commit;
  405. -- 每日小区告警接入
  406. when TYPE='CELL_ALARM'
  407. then
  408. select max(createtime) into v_createtime from ts_cell_alarm_tp;
  409. if v_createtime is null
  410. then
  411. return;
  412. end if;
  413. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_alarm_tp )','开始执行');
  414. commit;
  415. insert into ts_cell_alarm (createtime,city,eci,cell_name,cell_id,at,ast,at_name,ast_name,alarm_count,is_alarm,alarm_title,alarm_rule,alarm_level,alarm_info,statnum)
  416. select t.createtime,r.regionname,t.eci,t.cell_name,r.objectid,t.at,t.ast,t.at_name,t.ast_name,t.alarm_count,t.is_alarm,t.alarm_title,t.alarm_rule,t.alarm_level,t.alarm_info,statnum
  417. from ts_cell_alarm_tp t
  418. left join rm_eutrancell_eci r on t.eci=r.eci ;
  419. commit;
  420. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_cell_alarm_tp )','执行结束');
  421. commit;
  422. -- 每日小区清除告警接入
  423. when TYPE='CELL_CLEAR'
  424. then
  425. select max(createtime) into v_createtime from ts_cell_clear_tp;
  426. if v_createtime is null
  427. then
  428. return;
  429. end if;
  430. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( update by ts_cell_clear_tp )','开始执行');
  431. commit;
  432. --根据ECI和at_code和alarm_title,匹配7天以内的告警信息,将匹配上的告警的是否清除(is_clear)信息更新为1
  433. update ts_cell_alarm t set is_clear=0,clear_time=(select max(createtime) from ts_cell_clear_tp c where t.eci=c.eci and t.at=c.at and t.alarm_title=c.alarm_title)
  434. where t.createtime>=trunc(v_createtime)-7 and t.createtime<trunc(v_createtime)
  435. and exists (select 1 from ts_cell_clear_tp c where t.eci=c.eci and t.at=c.at and t.alarm_title=c.alarm_title);
  436. commit;
  437. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( update by ts_cell_clear_tp )','执行结束');
  438. commit;
  439. -- 每日区域告警接入
  440. when TYPE='AREA_ALARM'
  441. then
  442. select max(createtime) into v_createtime from ts_area_alarm_tp;
  443. if v_createtime is null
  444. then
  445. return;
  446. end if;
  447. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_area_alarm_tp )','开始执行');
  448. commit;
  449. insert into ts_area_alarm (createtime,city,eci,cell_name,cell_id,area_id,area_name,at,ast,at_name,ast_name,alarm_count,is_alarm,alarm_title,alarm_rule,alarm_level,alarm_info)
  450. select t.createtime,r.regionname,t.eci,t.cell_name,r.objectid,t.area_id,t.area_name,t.at,t.ast,t.at_name,t.ast_name,t.alarm_count,t.is_alarm,t.alarm_title,t.alarm_rule,t.alarm_level,t.alarm_info
  451. from ts_area_alarm_tp t
  452. left join rm_eutrancell_eci r on t.eci=r.eci ;
  453. commit;
  454. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_area_alarm_tp )','执行结束');
  455. commit;
  456. -- 每日区域清除告警接入
  457. when TYPE='AREA_CLEAR'
  458. then
  459. select max(createtime) into v_createtime from ts_area_clear_tp;
  460. if v_createtime is null
  461. then
  462. return;
  463. end if;
  464. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( update by ts_area_clear_tp )','开始执行');
  465. commit;
  466. --根据ECI和at_code和alarm_title,匹配7天以内的告警信息,将匹配上的告警的是否清除(is_clear)信息更新为1
  467. update ts_area_alarm t set is_clear=0,clear_time=(select max(createtime) from ts_area_clear_tp c where t.eci=c.eci and t.at=c.at and t.alarm_title=c.alarm_title)
  468. where t.createtime>=trunc(v_createtime)-7 and t.createtime<trunc(v_createtime)
  469. and exists (select 1 from ts_area_clear_tp c where t.eci=c.eci and t.at=c.at and t.alarm_title=c.alarm_title);
  470. commit;
  471. insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( update by ts_area_clear_tp )','执行结束');
  472. commit;
  473. when TYPE='COUNTY'
  474. then
  475. select max(createtime) into v_createtime from ts_county_info_15_tp ;
  476. if v_createtime is null
  477. then
  478. return;
  479. end if;
  480. --15分钟区县业务聚合表
  481. insert /* + append */ into ts_county_info_15 (createtime,countyid,county,at,ast,at_name,ast_name,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2)
  482. select createtime,countyid,m.enum_value,at,ast,m2.relate_enum_value,m2.enum_value,app_accept,app_attemp,app_succ,total_ul,total_dl,total_al,total_duration,total_rate,ty_dl,ty_duration,ty_rate,user_count,http_pg_accept,http_pg_attemp,http_pg_succ,tra_pg,tra_pg_duration,tra_pg_rate,http_im_accept,http_im_attemp,http_im_succ,tra_im_ul,tra_im_dl,tra_im_duration,tra_im_rate_up,tra_im_rate_down,http_vd_accept,http_vd_attemp,http_vd_succ,tra_vd,tra_vd_duration,tra_vd_rate,http_ad_accept,http_ad_attemp,http_ad_succ,tra_ad,tra_ad_duration,tra_ad_rate,delta_tra1,delta_rate1,delta_tra2,delta_rate2
  483. from ts_county_info_15_tp t
  484. left join ts_enum m on t.countyid=m.enum_key and m.enum_type='区县'
  485. left join ts_enum m2 on t.ast=m2.enum_key and t.at=m2.relate_enum_key and m2.enum_type='业务小类' ;
  486. --where not exists (select 1 from ts_county_info_15 a1 where a1.createtime=t.createtime and a1.countyid=t.countyid and a1.at=t.at and a1.ast=t.ast);
  487. commit;
  488. -- insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD( insert into ts_county_info_15)','执行结束');
  489. -- commit;
  490. /* 将以下表汇聚的时间、表名、数量等记录到ts_dataimport_record中,用于前台展示使用
  491. ts_county_info_15
  492. */
  493. for cur_cell in (select relatetable from ts_enum_table_relation where basetable ='ts_county_info_15_tp'
  494. )loop
  495. v_table:=cur_cell.relatetable;
  496. v_sql:='insert into ts_dataimport_record(createtime,table_name,cnt) select * from (select :x1 as createtime,:x2 as table_name,count(*) as cnt from '||v_table||' t where createtime=:x1 ) t1 where not exists (select 1 from ts_dataimport_record t2 where t1.createtime=t2.createtime and t2.table_name=:x2)';
  497. execute immediate v_sql using v_createtime,v_table,v_createtime,v_table;
  498. commit;
  499. -- DBms_output.put_line(v_table||'----'||v_createtime||'-----'||v_sql);
  500. end loop;
  501. -- insert into procedures_exec_record_pf (prd,what)values('TS_COLLECT_PRD(ts_dataimport_record - ts_city_info_15_tp )','执行结束');
  502. -- commit;
  503. -- add by dufs 2018-6-28 诺西每周增量提供的vip小区数据,确认不考虑vip小区减少的情况
  504. when TYPE='CELL_VIP'
  505. then
  506. merge into ts_cell_vip t
  507. using (select eci,cgi,eci_name,traffic_al from (select eci,cgi,eci_name,traffic_al,row_number() over(partition by c.cgi order by traffic_al desc) rn from ts_cell_vip_tp c) where rn=1) tp on (t.cgi=tp.cgi)
  508. when matched then update set t.eci=tp.eci,t.eci_name=tp.eci_name,t.traffic_al=tp.traffic_al
  509. when not matched then insert (eci,cgi,eci_name,traffic_al) values(tp.eci,tp.cgi,tp.eci_name,tp.traffic_al);
  510. commit;
  511. delete from ts_cell_vip where rowid in (select rowid from (select rowid,row_number() over(partition by c.eci order by traffic_al desc) rn from ts_cell_vip c) where rn>1);
  512. commit;
  513. end case;
  514. exception when others then
  515. v_logInfo := sqlerrm;
  516. v_logInfo := substr(v_logInfo, 0, 1999);
  517. execute immediate 'insert into prd_exec_log(prd,what,logtype,loginfo) values (:x1,:x2,:x3,:x4)'
  518. using 'TS_COLLECT_PRD','TS_COLLECT_PRD('||TYPE||')','ERROR',v_loginfo;
  519. commit;
  520. end;
  521. /