home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 26: Security / pc_actual_seguridad.iso / Scanner / SecureScanNX / data1.cab / upgrade_DB / upgrade / upgradeCleanBugNewBase-TransfertData.sql < prev    next >
Encoding:
Text File  |  2001-11-16  |  11.7 KB  |  267 lines

  1. insert into dba.WKS select * from nst_wks ;
  2. insert into dba.TC_GLOSSARY select * from nst_glossary_entry;
  3. insert into dba.GLOSSARY select glo_id, glo_name, glo_desc, glo_sta, flag from nst_glossary;
  4.  
  5. insert into dba.PARAMETER
  6. select a.acc_id, b.par_id,b.par_clstype,NULL,b.par_name,b.par_desc,b.par_info,b.par_type,NULL,
  7. c.pav_dfltvalue,c.pav_minval,c.pav_maxval,c.pav_value
  8. from nst_tc a, nst_parameter b, nst_paramvalue c
  9. where a.tca_id=b.par_objid and c.pav_objid=b.par_objid and b.par_id*=c.par_id and c.con_id=5 and b.par_clstype=8;
  10.  
  11. insert into dba.PARAMETER
  12. select b.par_objid, b.par_id,b.par_clstype,NULL,b.par_name,b.par_desc,b.par_info,b.par_type,NULL,
  13. c.pav_dfltvalue,c.pav_minval,c.pav_maxval,c.pav_value
  14. from nst_parameter b, nst_paramvalue c
  15. where c.pav_objid=b.par_objid and b.par_id*=c.par_id and c.con_id=5 and b.par_clstype not in (8);
  16.  
  17. update dba.PARAMETER set ClsType='UNDEFINED' where ClsType_id=0;
  18. update dba.PARAMETER set ClsType='SESSION' where ClsType_id=1;
  19. update dba.PARAMETER set ClsType='PERIMETER' where ClsType_id=2;
  20. update dba.PARAMETER set ClsType='POLICY' where ClsType_id=3;
  21. update dba.PARAMETER set ClsType='JOB' where ClsType_id=4;
  22. update dba.PARAMETER set ClsType='HOST' where ClsType_id=5;
  23. update dba.PARAMETER set ClsType='PROBE' where ClsType_id=6;
  24. update dba.PARAMETER set ClsType='WKSERVICE' where ClsType_id=7;
  25. update dba.PARAMETER set ClsType='TESTCASE' where ClsType_id=8;
  26. update dba.PARAMETER set ClsType='GENERAL' where ClsType_id=9;
  27. update dba.PARAMETER set ClsType='HELPERLIB' where ClsType_id=10;
  28. update dba.PARAMETER set ClsType='OPAQUE' where ClsType_id=11;
  29. update dba.PARAMETER set ClsType='PROPERTY' where ClsType_id=12;
  30. update dba.PARAMETER set ClsType='PARAMETER' where ClsType_id=13;
  31. update dba.PARAMETER set ClsType='SERVICE' where ClsType_id=14;
  32. update dba.PARAMETER set ClsType='TESTRESULT' where ClsType_id=15;
  33. update dba.PARAMETER set ClsType='HOSTFOUND' where ClsType_id=16;
  34. update dba.PARAMETER set ClsType='EXTINFO' where ClsType_id=17;
  35. update dba.PARAMETER set ClsType='LASTVALUE' where ClsType_id=18;
  36.  
  37.  
  38. update dba.PARAMETER set Type='STRING' where Type_id=1;
  39. update dba.PARAMETER set Type='INTEGER' where Type_id=2;
  40.  
  41. insert into dba.TCRESULT
  42. select  a.tcr_id,b.acc_id,a.srv_id,a.crt_id,c.crt_name,
  43. a.tcr_dt_begin,a.tcr_dt_end,a.hos_hostid,a.job_id
  44. from nst_tcresult a, nst_tc b, nst_result_code c
  45. where a.tca_id=b.tca_id and a.crt_id=c.crt_id;
  46.  
  47. insert into dba.SERVICE 
  48. select * from nst_service;
  49.  
  50. insert into dba.JOB_RANGE
  51. select * from nst_jobrange;
  52.  
  53. insert into dba.RANGE
  54. select * from nst_range;
  55.  
  56. insert into dba.INTERNAL_INDEX
  57. select * from nst_index;
  58.  
  59. insert into dba.HOST
  60. select * from  nst_host;
  61.  
  62. insert into dba.PERIMETER
  63. select * from nst_perimeter;
  64.  
  65. insert into dba.POLICY
  66. select * from nst_policy;
  67.  
  68. insert into dba.JOB
  69. select * from nst_job;
  70.  
  71. insert into dba.JOB_HOST
  72. select a.job_id, a.hos_hostid,a.joh_host_type,a.joh_host_probe,b.hst_id,b.hst_name
  73. from nst_jobhost a, nst_hoststatus b
  74. where a.joh_host_status=b.hst_id;
  75.  
  76. insert into dba.SESSION
  77. select ses_id,pol_polid,per_perid,ses_desc,ses_type,ses_crdate,ses_lastdate,
  78. ses_lastjobid, ses_scactive,ses_scjobtime,ses_scdaysom,ses_scdaysow,ses_scflags,
  79. ses_scargs,ses_predefined
  80. from nst_session;
  81.  
  82. insert into dba.POLICYDESC
  83. select pol_polid, pol_type, pol_value1, pol_include
  84. from nst_policydesc;
  85.  
  86. insert into dba.PROP_VALUE
  87. select a.pro_propid,a.prv_classe,NULL,a.prv_objid,a.prv_value,NULL
  88. from nst_propvalue a
  89. where ses_id in 
  90. (select max(ses_id) from nst_propvalue);
  91.  
  92. insert into dba.PROP_VALUE select 8,3,NULL,1,'1','1' 
  93. where not exists (select * from dba.PROP_VALUE where Pro_id=8 and ClsType_id=3 and Obj_id=1);
  94. insert into dba.PROP_VALUE select 8,3,NULL,2,'1','1'
  95. where not exists (select * from dba.PROP_VALUE where Pro_id=8 and ClsType_id=3 and Obj_id=2);
  96. insert into dba.PROP_VALUE select 8,3,NULL,3,'1','1'
  97. where not exists (select * from dba.PROP_VALUE where Pro_id=8 and ClsType_id=3 and Obj_id=3);
  98. insert into dba.PROP_VALUE select 9,3,NULL,1,'1023','1023'
  99. where not exists (select * from dba.PROP_VALUE where Pro_id=9 and ClsType_id=3 and Obj_id=1);
  100. insert into dba.PROP_VALUE select 9,3,NULL,2,'1023','1023'
  101. where not exists (select * from dba.PROP_VALUE where Pro_id=9 and ClsType_id=3 and Obj_id=2);
  102. insert into dba.PROP_VALUE select 9,3,NULL,3,'65535','65535'
  103. where not exists (select * from dba.PROP_VALUE where Pro_id=9 and ClsType_id=3 and Obj_id=3);
  104. insert into dba.PROP_VALUE select 16,3,NULL,1,'1','1'
  105. where not exists (select * from dba.PROP_VALUE where Pro_id=16 and ClsType_id=3 and Obj_id=1);
  106. insert into dba.PROP_VALUE select 16,3,NULL,2,'1','1'
  107. where not exists (select * from dba.PROP_VALUE where Pro_id=16 and ClsType_id=3 and Obj_id=2);
  108. insert into dba.PROP_VALUE select 16,3,NULL,3,'1','1'
  109. where not exists (select * from dba.PROP_VALUE where Pro_id=16 and ClsType_id=3 and Obj_id=3);
  110. insert into dba.PROP_VALUE select 17,3,NULL,1,'1023','1023'
  111. where not exists (select * from dba.PROP_VALUE where Pro_id=17 and ClsType_id=3 and Obj_id=1);
  112. insert into dba.PROP_VALUE select 17,3,NULL,2,'1023','1023'
  113. where not exists (select * from dba.PROP_VALUE where Pro_id=17 and ClsType_id=3 and Obj_id=2);
  114. insert into dba.PROP_VALUE select 17,3,NULL,3,'1023','1023'
  115. where not exists (select * from dba.PROP_VALUE where Pro_id=17 and ClsType_id=3 and Obj_id=3);
  116.  
  117. update dba.PROP_VALUE set DfltValue='1' where Pro_id=8 and ClsType_id=3 and Obj_id=1;
  118. update dba.PROP_VALUE set DfltValue='1' where Pro_id=8 and ClsType_id=3 and Obj_id=2;
  119. update dba.PROP_VALUE set DfltValue='1' where Pro_id=8 and ClsType_id=3 and Obj_id=3;
  120. update dba.PROP_VALUE set DfltValue='1023' where Pro_id=9 and ClsType_id=3 and Obj_id=1;
  121. update dba.PROP_VALUE set DfltValue='1023' where Pro_id=9 and ClsType_id=3 and Obj_id=2;
  122. update dba.PROP_VALUE set DfltValue='65535' where Pro_id=9 and ClsType_id=3 and Obj_id=3;
  123. update dba.PROP_VALUE set DfltValue='1' where Pro_id=16 and ClsType_id=3 and Obj_id=1;
  124. update dba.PROP_VALUE set DfltValue='1' where Pro_id=16 and ClsType_id=3 and Obj_id=2;
  125. update dba.PROP_VALUE set DfltValue='1' where Pro_id=16 and ClsType_id=3 and Obj_id=3;
  126. update dba.PROP_VALUE set DfltValue='1023' where Pro_id=17 and ClsType_id=3 and Obj_id=1;
  127. update dba.PROP_VALUE set DfltValue='1023' where Pro_id=17 and ClsType_id=3 and Obj_id=2;
  128. update dba.PROP_VALUE set DfltValue='1023' where Pro_id=17 and ClsType_id=3 and Obj_id=3;
  129.  
  130.  
  131. update dba.PROP_VALUE set ClsType='UNDEFINED' where ClsType_id=0;
  132. update dba.PROP_VALUE set ClsType='SESSION' where ClsType_id=1;
  133. update dba.PROP_VALUE set ClsType='PERIMETER' where ClsType_id=2;
  134. update dba.PROP_VALUE set ClsType='POLICY' where ClsType_id=3;
  135. update dba.PROP_VALUE set ClsType='JOB' where ClsType_id=4;
  136. update dba.PROP_VALUE set ClsType='HOST' where ClsType_id=5;
  137. update dba.PROP_VALUE set ClsType='PROBE' where ClsType_id=6;
  138. update dba.PROP_VALUE set ClsType='WKSERVICE' where ClsType_id=7;
  139. update dba.PROP_VALUE set ClsType='TESTCASE' where ClsType_id=8;
  140. update dba.PROP_VALUE set ClsType='GENERAL' where ClsType_id=9;
  141. update dba.PROP_VALUE set ClsType='HELPERLIB' where ClsType_id=10;
  142. update dba.PROP_VALUE set ClsType='OPAQUE' where ClsType_id=11;
  143. update dba.PROP_VALUE set ClsType='PROPERTY' where ClsType_id=12;
  144. update dba.PROP_VALUE set ClsType='PROP_VALUE' where ClsType_id=13;
  145. update dba.PROP_VALUE set ClsType='SERVICE' where ClsType_id=14;
  146. update dba.PROP_VALUE set ClsType='TESTRESULT' where ClsType_id=15;
  147. update dba.PROP_VALUE set ClsType='HOSTFOUND' where ClsType_id=16;
  148. update dba.PROP_VALUE set ClsType='EXTINFO' where ClsType_id=17;
  149. update dba.PROP_VALUE set ClsType='LASTVALUE' where ClsType_id=18;
  150.  
  151. insert into dba.PROPERTY
  152. select a.pro_propid,a.pro_clstype,NULL,a.pro_name,a.pro_type,a.pro_flags,a.pro_desc,a.pro_dfltvalue,a.pro_minval,a.pro_maxval
  153. from nst_property a;
  154.  
  155. update dba.PROPERTY set ClsType='UNDEFINED' where ClsType_id=0;
  156. update dba.PROPERTY set ClsType='SESSION' where ClsType_id=1;
  157. update dba.PROPERTY set ClsType='PERIMETER' where ClsType_id=2;
  158. update dba.PROPERTY set ClsType='POLICY' where ClsType_id=3;
  159. update dba.PROPERTY set ClsType='JOB' where ClsType_id=4;
  160. update dba.PROPERTY set ClsType='HOST' where ClsType_id=5;
  161. update dba.PROPERTY set ClsType='PROBE' where ClsType_id=6;
  162. update dba.PROPERTY set ClsType='WKSERVICE' where ClsType_id=7;
  163. update dba.PROPERTY set ClsType='TESTCASE' where ClsType_id=8;
  164. update dba.PROPERTY set ClsType='GENERAL' where ClsType_id=9;
  165. update dba.PROPERTY set ClsType='HELPERLIB' where ClsType_id=10;
  166. update dba.PROPERTY set ClsType='OPAQUE' where ClsType_id=11;
  167. update dba.PROPERTY set ClsType='PROPERTY' where ClsType_id=12;
  168. update dba.PROPERTY set ClsType='PROP_VALUE' where ClsType_id=13;
  169. update dba.PROPERTY set ClsType='SERVICE' where ClsType_id=14;
  170. update dba.PROPERTY set ClsType='TESTRESULT' where ClsType_id=15;
  171. update dba.PROPERTY set ClsType='HOSTFOUND' where ClsType_id=16;
  172. update dba.PROPERTY set ClsType='EXTINFO' where ClsType_id=17;
  173. update dba.PROPERTY set ClsType='LASTVALUE' where ClsType_id=18;
  174.  
  175. create procedure "dba".extinfotrans
  176. as
  177. begin
  178.   declare @tcr_id integer
  179.   declare @tcr_idold integer
  180.   declare @tcr_name varchar(25555)
  181.   declare @ext_id integer
  182.   declare @tmp integer
  183.   declare @stmp varchar(25555)
  184.   select @tmp=0
  185.   select @stmp='tre'
  186.   /* select tcr_id,ext_line from nst_extinfos order by tcr_id asc,ext_id asc*/
  187.   begin
  188.     declare cCur dynamic scroll cursor for select tcr_id,ext_line,ext_id from dba.nst_extinfos order by tcr_id asc,ext_id asc
  189.     open cCur
  190.     select @tcr_id=0
  191.     select @tcr_idold=0
  192.     select @ext_id=0
  193.     while @tcr_id>-1
  194.       begin
  195.         /* select @stmp=@stmp+'0000'*/
  196.         select @tcr_id=-1
  197.         fetch next cCur into @tcr_id,@tcr_name,
  198.           @ext_id
  199.         if @tcr_id>-1
  200.           if @tcr_id=@tcr_idold
  201.             select @stmp=@stmp+'\x0D\x0A'+@tcr_name
  202.           else
  203.             begin
  204.               if @tcr_idold>0 /* pas la premiere fois alors on fait l'insert*/
  205.                 insert into dba.TCRESULT_INFO values(@tcr_idold,1,3,null,null,@stmp)
  206.               select @tcr_idold=@tcr_id
  207.               select @stmp=@tcr_name
  208.             end
  209.          else
  210.            begin
  211.                if @tcr_idold>0 /* pas la premiere fois alors on fait l'insert*/
  212.                 insert into dba.TCRESULT_INFO values(@tcr_idold,1,3,null,null,@stmp)
  213.            end
  214.       /*  select @stmp*/
  215.       end
  216.    /* select 'fin:'+@stmp*/
  217.     close cCur
  218.   end
  219. end;
  220.  
  221. CALL "DBA"."extinfotrans"(  );
  222.  
  223. drop procedure "dba".extinfotrans;
  224.  
  225. insert into dba.TESTCASE 
  226. select 
  227.     a.acc_id,
  228.     a.tca_id,
  229.     a.prt_id,
  230.     a.prt_id,
  231.     a.tca_name,
  232.     a.tca_desc,
  233.     a.tca_copyright,
  234.     a.tca_dtPub,
  235.     a.tca_test_method           ,
  236.     NULL ,
  237.     NULL        ,
  238.     f.fol_name,
  239.     b.fol_id               ,
  240.     b.cpa_high_level_desc        ,
  241.     b.cpa_nat_follow_up                             ,
  242.     b.cpa_risk_desc,
  243.     a.lev_id                         ,
  244.     c.lev_desc,
  245.     g.ref_desc,
  246.     b.imp_id                        ,
  247.     e.imp_desc,
  248.     a.tca_active ,
  249.     a.tca_flags  ,
  250.     a.sta_network_type + 2*a.sta_firewall_type + 4*a.sta_system_type + 16*a.sta_database_type,              
  251.     a.sta_keywords                    ,
  252.     a.sta_cve                                     ,
  253.     a.sta_chain                ,
  254.     600,
  255.     a.mod_id 
  256. from dba.nst_tc a, dba.nst_contextual_part b, dba.nst_level c, dba.nst_impact e, 
  257. dba.nst_followup_urgency f,dba.nst_reference g, dba.nst_tc_ref h
  258. where a.acc_id=b.acc_id and b.con_id=5 and a.lev_id*=c.lev_id and b.imp_id*=e.imp_id and b.fol_id*=f.fol_id and a.acc_id*=h.acc_id and h.ref_id*=g.ref_id
  259. order by a.acc_id;
  260.  
  261.  
  262. insert into dba.SOLUTION
  263. select a.acc_id, b.sol_desc, 0, 'UNDEFINED' 
  264. from dba.nst_cp_sol a, dba.nst_solution b  
  265. where  a.sol_id=b.sol_id
  266. order by a.acc_id asc;
  267.