sysutils.sql 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. --
  2. --
  3. -- Licensed Materials - Property of IBM and/or HCL
  4. --
  5. -- IBM Informix Dynamic Server
  6. -- (c) Copyright IBM Corporation 1996, 2008 All rights reserved.
  7. -- (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved.
  8. --
  9. --
  10. --
  11. -- Title: sysutils.sql
  12. --
  13. -- Description: create system utilities (sysutils) database tables
  14. --
  15. --
  16. set lock mode to wait;
  17. create database sysutils with log;
  18. database sysutils exclusive;
  19. { onbar }
  20. { active OnLine servers }
  21. { The size of srv_name should be SVRNAME_LEN from asf.h }
  22. { The size of srv_node should = HOST_LEN from asf.h }
  23. { SVRNAME_LEN should equal IDENTSIZE and HOST_LEN should be 2 * IDENTSIZE }
  24. create table bar_server
  25. (
  26. srv_name char(128) not null, { server name }
  27. srv_node char(256) not null, { server node }
  28. primary key (srv_name)
  29. ) lock mode row;
  30. revoke all on bar_server from public;
  31. grant select on bar_server to public;
  32. grant all on bar_server to root, informix;
  33. { backup objects }
  34. { object names are unique within an OnLine server }
  35. { The size of obj_srv_name and obj_name should = IDENTSIZE from rdsmac.h. }
  36. { The size of obj_type should = BAR_MAX_TYPE_LEN in bar.h }
  37. { DOIT obj_srv_name should be a referential constraint of bar_server:srv_name, }
  38. { but we presently don't need it. Think about this more as high }
  39. { availability and replication develop }
  40. create table bar_object
  41. (
  42. obj_srv_name char(128) not null, { which server object is from }
  43. obj_oid serial not null, { object identifier }
  44. obj_name char(128) not null, { name of object }
  45. obj_type char(2) not null, { type of object }
  46. primary key (obj_oid)
  47. ) lock mode row;
  48. create unique index bar_obj_idx on bar_object(obj_srv_name, obj_name);
  49. revoke all on bar_object from public;
  50. grant select on bar_object to public;
  51. grant all on bar_object to root, informix;
  52. { backup or restore actions attempted against an object }
  53. create table bar_action
  54. (
  55. act_aid serial not null, { action identifier }
  56. act_oid integer not null references bar_object(obj_oid),
  57. { object identifier }
  58. act_type integer not null, { type of action }
  59. act_status integer default -1, { status of action }
  60. act_start datetime year to second default CURRENT year to second,
  61. { time action began }
  62. act_end datetime year to second default CURRENT year to second,
  63. { time action ended }
  64. primary key (act_oid, act_aid)
  65. ) lock mode row;
  66. create index bar_act_idx on bar_action(act_aid);
  67. revoke all on bar_action from public;
  68. grant select on bar_action to public;
  69. grant all on bar_action to root, informix;
  70. { successful backup actions }
  71. { The size of ins_sm_name should = IDENTSIZE from rsparam.h.}
  72. create table bar_instance
  73. (
  74. ins_aid integer not null, { action that created instance }
  75. ins_oid integer not null, { object identifier }
  76. ins_time integer not null, { global timestamp from server }
  77. rsam_time integer, { rsam timestamp from server }
  78. { null in SQL is -MAXINT which is a }
  79. { valid rsam timestamp, so this is }
  80. { nullable }
  81. seal_time integer not null, { time log file was sealed }
  82. prev_seal_time integer not null, { time previous log file was sealed }
  83. ins_level integer default 0 not null, { backup level }
  84. ins_copyid_hi integer not null, { high bytes of the copyid }
  85. ins_copyid_lo integer not null, { low bytes of the copyid }
  86. ins_req_aid integer not null, {aid of required BU for an incremental}
  87. ins_logstream integer not null, { logstream needed for restore }
  88. ins_first_log integer not null, { first log needed for restore }
  89. ins_chpt_log integer not null, { log with archive checkpoint }
  90. ins_last_log integer not null, { log from restore }
  91. ins_partial integer not null, { partial flag from salvage }
  92. ins_sm_id integer not null, { storage manager id }
  93. ins_sm_name char(128), { storage manager name }
  94. ins_verify integer default 0 not null, {verified? 0=F 1=T}
  95. ins_verify_date datetime year to second, { date of verification }
  96. ins_backup_order integer default 0 not null, {dbspaces: filled by sequence}
  97. primary key (ins_oid, ins_aid),
  98. foreign key (ins_oid, ins_aid) references bar_action(act_oid, act_aid)
  99. on delete cascade
  100. ) lock mode row;
  101. create index ins_aid_idx on bar_instance
  102. (ins_aid) using btree;
  103. create index bar_inst_idx on bar_instance
  104. (ins_req_aid) using btree;
  105. create index bar_inst_idx2 on bar_instance
  106. (ins_aid, ins_copyid_lo) using btree;
  107. revoke all on bar_instance from public;
  108. grant select on bar_instance to public;
  109. grant all on bar_instance to root, informix;
  110. create table bar_ordertab(dummy integer);
  111. insert into bar_ordertab values(1);
  112. create sequence bar_orderseq cycle;
  113. grant connect to public;
  114. grant dba to root, informix;
  115. close database;