home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a525 / 43.ddi / MIGRATE.BSQ < prev   
Encoding:
Text File  |  1993-01-15  |  145.0 KB  |  3,373 lines

  1. #
  2. # $Header: migrate.bsq 7001200.3 92/11/25 01:51:05 twang Generic<base> $
  3. #
  4. #  Copyright (c) 1991 by Oracle Corporation
  5. #    NAME
  6. #      migrate.bsq - script for the migration utility
  7. #    MODIFIED   (MM/DD/YY)
  8. #     Colello    01/15/93 - DESKTOP: add semicolons after some drop statements
  9. #     gpongrac   11/18/92 -  argument$ changes
  10. #     ajasuja    11/18/92 -  merge changes from branch 1.16.311.3
  11. #     gpongrac   11/13/92 -  change Rem to #
  12. #     gpongrac   11/11/92 -  change lengths of char cols in argument$
  13. #     gpongrac   11/10/92 -  add rows for new MAP table indexes to v7_objects
  14. #     gpongrac   11/10/92 -  i_argument is a New object, not a Modified one
  15. #     gpongrac   11/10/92 -  add argument$ table and sequence col to error$
  16. #     vraghuna   10/28/92 -  bug 130560 - move map tables into bsq
  17. #     ajasuja    09/23/92 -  unique index on audit$
  18. #     gpongrac   09/10/92 -  prevent any space operations after we populate seg$
  19. #     gpongrac   09/09/92 -  set maxexts to 99 in the V7 catalog, not the V6
  20. #     gpongrac   09/08/92 -  improve objauth$ delete performance; bug 127869
  21. #     gpongrac   09/08/92 -  fix update of pctincrease for rollbacks to not sort
  22. #     gpongrac   09/08/92 -  bug 127942 - set default tablespace for migrate
  23. #     gpongrac   09/04/92 -  add dual to v7_objects as an 'N' type;
  24. #                            create c_file#_block# first so it gets the big xtnt
  25. #     gpongrac   09/03/92 -  account for c_file#_block# twice as big
  26. #     gpongrac   08/25/92 -  offline ts migration bug; drop maint.v7_objects
  27. #     aho        08/24/92 -  use v7_objects table to swap sys & migrate
  28. #     aho        08/17/92 -  rewrite sys/migrate swap (bg 124183)
  29. #     alaursen   07/08/92 -  Move space computation
  30. #     aho        07/07/92 -  more syntax silliness!
  31. #     aho        07/06/92 -  fix syntax errors
  32. #     aho        06/29/92 -  drop junk from v6 and v5 before migration
  33. #                         -  (e.g. expvew, expvew5, catalog, catalog5, ulview)
  34. #     aho        06/24/92 -  add epeeler's changes for null constraints
  35. #                         -  update comments in col$ and cdef$
  36. #     aho        06/02/92 -  remove duplicate grants in objauth (#110680)
  37. #     aho        04/08/92 -  merge changes from branch 1.7.300.1
  38. #     aho        04/07/92 -  enable not null constraints (103146 & 103233)
  39. #     mmoore     02/19/92 -  add more privileges to the connect role
  40. #     alaursen   01/27/92 -  add in space checking
  41. #     alaursen   01/09/92 -  Fix PIDL types
  42. #     mmoore     12/13/91 -  new pidl tables,merge forward other changes
  43. #     aho        12/06/91 -  convert_nls()
  44. #     alaursen   10/23/91 -  Add grant to dual
  45. #     alaursen   10/16/91 -  Too many files under sys are moved to migrate
  46. #     alaursen   10/06/91 -  Fix version number in bootstrap
  47. #     alaursen   09/28/91 -  Creation
  48. #^ connect (maint, internal)
  49. grant connect, resource, dba to migrate identified by migrate;
  50. alter user migrate default tablespace system;
  51. drop table dual;
  52. drop public synonym dual;
  53. drop table v7_objects;
  54. #^ connect (migrate, migrate)
  55.  
  56. ##
  57. ## m_delete
  58. ##
  59.  
  60. drop table bootstrap$;
  61. drop cluster c_obj# including tables;
  62. drop cluster c_ts# including tables;
  63. drop cluster c_file#_block# including tables;
  64. drop cluster c_user# including tables;
  65. drop table undo$;
  66. drop table file$;
  67. drop table obj$;
  68. drop table con$;
  69. drop cluster c_cobj# including tables;
  70.  
  71. drop table syn$;
  72. drop table view$;
  73. drop table seq$;
  74. drop table procedure$;
  75. drop table argument$;
  76. drop table source$;
  77. drop table idl_ub1$;
  78. drop table idl_char$;
  79. drop table idl_ub2$;
  80. drop table idl_sb4$;
  81. drop table error$;
  82. drop table trigger$;
  83. drop table triggercol$;
  84. drop table objauth$;
  85. drop table sysauth$;
  86. drop table defrole$;
  87. drop table profile$;
  88. drop table profname$;
  89. drop table dependency$;
  90. drop table access$;
  91. drop table aud$;
  92. drop table lab$;
  93. drop table link$;
  94. drop table props$;
  95. drop table com$;
  96. drop table resource_cost$;
  97. drop sequence object_grant;
  98. drop sequence system_grant;
  99. drop sequence profnum$;
  100. drop table incexp;
  101. drop table incvid;
  102. drop table incfil;
  103. drop table "_default_auditing_options_";
  104. drop sequence audses$;
  105. drop table audit$;
  106. drop table pending_trans$;
  107. drop table pending_sessions$;
  108. drop table pending_sub_sessions$;
  109. drop cluster c_mlog# including tables;
  110. drop table snap$;
  111. drop cluster hist$ including tables;
  112. drop table dual;
  113. drop public synonym dual;
  114. drop sequence label_translation;
  115. drop table SYSTEM_PRIVILEGE_MAP;
  116. drop table TABLE_PRIVILEGE_MAP;
  117. drop table STMT_AUDIT_OPTION_MAP;
  118.  
  119. ##
  120. ## create v7_objects table to enumerate how to migrate the v6 data dictionary
  121. ##
  122. #
  123. # L : leave this object alone.  it should be migrated from v6 to v7 in
  124. #     sys' schema unchanged.
  125. # M : migrate the object.  we will create an equivalent v7 in migrate's
  126. #     schema and then swap.  (the object exists in v6 and v7)
  127. # N : new object that did not exist in v6.  we need to check to make sure
  128. #     that the v6 sys schema does not contain the an object with the same
  129. #     name; it will change into the new v7 object without warning.
  130. # O : overlap.  if a type 'N' object exists in the v6 sys schema then
  131. #     it is changed into an 'O'.
  132. # P : purge.  this is an v6 object that no longer exists in v7.  it will
  133. #     disappear during the migration
  134. #
  135.  
  136. #^ connect (maint, internal)
  137.  
  138. create table v7_objects
  139. (
  140.  type   char(1),
  141.  name   char(30),
  142.  v6obj# number                             /* used by space calculation */
  143. );
  144.  
  145. create index i_v7_objects on v7_objects(v6obj#);
  146.  
  147. insert into v7_objects values ('P', 'V7_OBJECTS', -1);
  148. insert into v7_objects values ('N', 'ACCESS$', -1);
  149. insert into v7_objects values ('N', 'ARGUMENT$', -1);
  150. insert into v7_objects values ('M', 'AUD$', -1);
  151. insert into v7_objects values ('N', 'AUDIT$', -1);
  152. insert into v7_objects values ('L', 'AUDSES$', -1);
  153. insert into v7_objects values ('N', 'BOOTSTRAP$', -1);
  154. insert into v7_objects values ('M', 'CCOL$', -1);
  155. insert into v7_objects values ('M', 'CDEF$', -1);
  156. insert into v7_objects values ('M', 'CLU$', -1);
  157. insert into v7_objects values ('M', 'COL$', -1);
  158. insert into v7_objects values ('P', 'COLAUTH$', -1);
  159. insert into v7_objects values ('P', 'COLUMN_GRANT', -1);
  160. insert into v7_objects values ('M', 'COM$', -1);
  161. insert into v7_objects values ('M', 'CON$', -1);
  162. insert into v7_objects values ('M', 'C_COBJ#', -1);
  163. insert into v7_objects values ('M', 'C_FILE#_BLOCK#', -1);
  164. insert into v7_objects values ('N', 'C_MLOG#', -1);
  165. insert into v7_objects values ('M', 'C_OBJ#', -1);
  166. insert into v7_objects values ('M', 'C_TS#', -1);
  167. insert into v7_objects values ('M', 'C_USER#', -1);
  168. insert into v7_objects values ('N', 'DEFROLE$', -1);
  169. insert into v7_objects values ('N', 'DEPENDENCY$', -1);
  170. insert into v7_objects values ('N', 'DUAL', -1);
  171. insert into v7_objects values ('N', 'ERROR$', -1);
  172. insert into v7_objects values ('M', 'FET$', -1);
  173. insert into v7_objects values ('M', 'FILE$', -1);
  174. insert into v7_objects values ('N', 'HIST$', -1);
  175. insert into v7_objects values ('N', 'HISTOGRAM$', -1);
  176. insert into v7_objects values ('M', 'ICOL$', -1);
  177. insert into v7_objects values ('N', 'IDL_CHAR$', -1);
  178. insert into v7_objects values ('N', 'IDL_SB4$', -1);
  179. insert into v7_objects values ('N', 'IDL_UB1$', -1);
  180. insert into v7_objects values ('N', 'IDL_UB2$', -1);
  181. insert into v7_objects values ('M', 'INCEXP', -1);
  182. insert into v7_objects values ('M', 'INCFIL', -1);
  183. insert into v7_objects values ('M', 'INCVID', -1);
  184. insert into v7_objects values ('M', 'IND$', -1);
  185. insert into v7_objects values ('M', 'I_AUD1', -1);
  186. insert into v7_objects values ('N', 'I_ARGUMENT1', -1);
  187. insert into v7_objects values ('N', 'I_AUDIT', -1);
  188. insert into v7_objects values ('M', 'I_CCOL1', -1);
  189. insert into v7_objects values ('M', 'I_CDEF1', -1);
  190. insert into v7_objects values ('M', 'I_CDEF2', -1);
  191. insert into v7_objects values ('N', 'I_CDEF3', -1);
  192. insert into v7_objects values ('M', 'I_COBJ#', -1);
  193. insert into v7_objects values ('M', 'I_COL1', -1);
  194. insert into v7_objects values ('M', 'I_COL2', -1);
  195. insert into v7_objects values ('P', 'I_COLAUTH1', -1);
  196. insert into v7_objects values ('P', 'I_COLAUTH2', -1);
  197. insert into v7_objects values ('P', 'I_COLAUTH3', -1);
  198. insert into v7_objects values ('M', 'I_COM1', -1);
  199. insert into v7_objects values ('M', 'I_CON1', -1);
  200. insert into v7_objects values ('M', 'I_CON2', -1);
  201. insert into v7_objects values ('N', 'I_DEFROLE1', -1);
  202. insert into v7_objects values ('N', 'I_DEPENDENCY1', -1);
  203. insert into v7_objects values ('N', 'I_DEPENDENCY2', -1);
  204. insert into v7_objects values ('N', 'I_ERROR1', -1);
  205. insert into v7_objects values ('M', 'I_FILE#_BLOCK#', -1);
  206. insert into v7_objects values ('M', 'I_FILE1', -1);
  207. insert into v7_objects values ('N', 'I_HIST$', -1);
  208. insert into v7_objects values ('M', 'I_ICOL1', -1);
  209. insert into v7_objects values ('N', 'I_IDL_CHAR1', -1);
  210. insert into v7_objects values ('N', 'I_IDL_SB41', -1);
  211. insert into v7_objects values ('N', 'I_IDL_UB11', -1);
  212. insert into v7_objects values ('N', 'I_IDL_UB21', -1);
  213. insert into v7_objects values ('M', 'I_INCEXP', -1);
  214. insert into v7_objects values ('M', 'I_IND1', -1);
  215. insert into v7_objects values ('M', 'I_LINK1', -1);
  216. insert into v7_objects values ('N', 'I_MLOG#', -1);
  217. insert into v7_objects values ('M', 'I_OBJ#', -1);
  218. insert into v7_objects values ('M', 'I_OBJ1', -1);
  219. insert into v7_objects values ('M', 'I_OBJ2', -1);
  220. insert into v7_objects values ('N', 'I_OBJAUTH1', -1);
  221. insert into v7_objects values ('N', 'I_OBJAUTH2', -1);
  222. insert into v7_objects values ('N', 'I_PENDING_TRANS1', -1);
  223. insert into v7_objects values ('N', 'I_PROCEDURE1', -1);
  224. insert into v7_objects values ('N', 'I_PROFILE', -1);
  225. insert into v7_objects values ('N', 'I_PROFNAME', -1);
  226. insert into v7_objects values ('M', 'I_SEQ1', -1);
  227. insert into v7_objects values ('N', 'I_SLOG1', -1);
  228. insert into v7_objects values ('N', 'I_SNAP1', -1);
  229. insert into v7_objects values ('N', 'I_SOURCE1', -1);
  230. insert into v7_objects values ('N', 'I_STMT_AUDIT_OPTION_MAP', -1);
  231. insert into v7_objects values ('M', 'I_SYN1', -1);
  232. insert into v7_objects values ('N', 'I_SYSAUTH1', -1);
  233. insert into v7_objects values ('N', 'I_SYSTEM_PRIVILEGE_MAP', -1);
  234. insert into v7_objects values ('M', 'I_TAB1', -1);
  235. insert into v7_objects values ('P', 'I_TABAUTH1', -1);
  236. insert into v7_objects values ('P', 'I_TABAUTH2', -1);
  237. insert into v7_objects values ('N', 'I_TABLE_PRIVILEGE_MAP', -1);
  238. insert into v7_objects values ('N', 'I_TRIGGER1', -1);
  239. insert into v7_objects values ('N', 'I_TRIGGER2', -1);
  240. insert into v7_objects values ('N', 'I_TRIGGERCOL1', -1);
  241. insert into v7_objects values ('M', 'I_TS#', -1);
  242. insert into v7_objects values ('M', 'I_UNDO1', -1);
  243. insert into v7_objects values ('M', 'I_USER#', -1);
  244. insert into v7_objects values ('M', 'I_USER1', -1);
  245. insert into v7_objects values ('M', 'I_VIEW1', -1);
  246. insert into v7_objects values ('P', 'I_XREF1', -1);
  247. insert into v7_objects values ('N', 'LAB$', -1);
  248. insert into v7_objects values ('N', 'LABEL_TRANSLATION', -1);
  249. insert into v7_objects values ('M', 'LINK$', -1);
  250. insert into v7_objects values ('N', 'MLOG$', -1);
  251. insert into v7_objects values ('M', 'OBJ$', -1);
  252. insert into v7_objects values ('N', 'OBJAUTH$', -1);
  253. insert into v7_objects values ('N', 'OBJECT_GRANT', -1);
  254. insert into v7_objects values ('N', 'PENDING_SESSIONS$', -1);
  255. insert into v7_objects values ('N', 'PENDING_SUB_SESSIONS$', -1);
  256. insert into v7_objects values ('N', 'PENDING_TRANS$', -1);
  257. insert into v7_objects values ('N', 'PROCEDURE$', -1);
  258. insert into v7_objects values ('N', 'PROFILE$', -1);
  259. insert into v7_objects values ('N', 'PROFNAME$', -1);
  260. insert into v7_objects values ('N', 'PROFNUM$', -1);
  261. insert into v7_objects values ('M', 'PROPS$', -1);
  262. insert into v7_objects values ('N', 'RESOURCE_COST$', -1);
  263. insert into v7_objects values ('M', 'SEG$', -1);
  264. insert into v7_objects values ('M', 'SEQ$', -1);
  265. insert into v7_objects values ('N', 'SLOG$', -1);
  266. insert into v7_objects values ('N', 'SNAP$', -1);
  267. insert into v7_objects values ('N', 'SOURCE$', -1);
  268. insert into v7_objects values ('N', 'STMT_AUDIT_OPTION_MAP', -1);
  269. insert into v7_objects values ('M', 'SYN$', -1);
  270. insert into v7_objects values ('N', 'SYSAUTH$', -1);
  271. insert into v7_objects values ('N', 'SYSTEM_GRANT', -1);
  272. insert into v7_objects values ('N', 'SYSTEM_PRIVILEGE_MAP', -1);
  273. insert into v7_objects values ('M', 'TAB$', -1);
  274. insert into v7_objects values ('P', 'TABAUTH$', -1);
  275. insert into v7_objects values ('P', 'TABLE_GRANT', -1);
  276. insert into v7_objects values ('N', 'TABLE_PRIVILEGE_MAP', -1);
  277. insert into v7_objects values ('N', 'TRIGGER$', -1);
  278. insert into v7_objects values ('N', 'TRIGGERCOL$', -1);
  279. insert into v7_objects values ('M', 'TS$', -1);
  280. insert into v7_objects values ('M', 'TSQ$', -1);
  281. insert into v7_objects values ('M', 'UET$', -1);
  282. insert into v7_objects values ('M', 'UNDO$', -1);
  283. insert into v7_objects values ('M', 'USER$', -1);
  284. insert into v7_objects values ('M', 'VIEW$', -1);
  285. insert into v7_objects values ('P', 'XREF$', -1);
  286. insert into v7_objects values ('L', '_NEXT_OBJECT', -1);
  287. insert into v7_objects values ('M', '_default_auditing_options_', -1);
  288. insert into v7_objects values ('P', '_system_auditing_options_', -1);
  289.  
  290. update v7_objects set type = 'O'
  291.    where type = 'N' and
  292.          name in (select name from obj$
  293.                   where owner# = (select user# from user$
  294.                                   where name = 'SYS'));
  295.  
  296. update v7_objects x set v6obj# =
  297.         (select obj# from obj$ y
  298.          where x.name = y.name
  299.           and  y.owner# =
  300.                 (select user# from user$ where name = 'SYS'))
  301.          where type <> 'N' and type <> 'P';
  302.  
  303. ##
  304. ## m_space
  305. ##
  306. ## is there enough space?
  307. ##
  308. #^ space_fb()
  309. #^ connect (migrate, migrate)
  310. #^ create_cluster_fb()
  311. #^ connect (maint,internal)
  312. #^ space_ts()
  313. #^ connect (migrate, migrate)
  314. #^ create_cluster_ts()
  315. #^ connect (maint, internal)
  316. #^ space_out()
  317.  
  318. ##
  319. ## m_catalog
  320. ##
  321. ## remove v6 and v5 views and catalogs
  322. ## don't remove the table dual!
  323. ##
  324.  
  325. #
  326. # expvew.sql
  327. #
  328. drop view exutab;
  329. drop view exutabi;
  330. drop view exutabc;
  331. drop view exutabu;
  332. drop view exucol;
  333. drop view exucolu;
  334. drop view exuico;
  335. drop view exuicou;
  336. drop view exuusr;
  337. drop view exuusru;
  338. drop view exugrn;
  339. drop view exugrnu;
  340. drop view exucgr;
  341. drop view exucgru;
  342. drop view exuind;
  343. drop view exuindu;
  344. drop view exuvew;
  345. drop view exuvewi;
  346. drop view exuvewc;
  347. drop view exuvewu;
  348. drop view exusyn;
  349. drop view exusyni;
  350. drop view exusync;
  351. drop view exusynu;
  352. drop view exucco;
  353. drop view exuccou;
  354. drop view exuclu;
  355. drop view exuclui;
  356. drop view exucluc;
  357. drop view exucluu;
  358. drop view exusto;
  359. drop view exustou;
  360. drop view exutbs;
  361. drop view exutsq;
  362. drop view exubsz;
  363. drop view exufil;
  364. drop view exulnk;
  365. drop view exulnku;
  366. drop view exursg;
  367. drop view exudel;
  368. drop view exuseq;
  369. drop view exusequ;
  370. drop view exucon;
  371. drop view exuconu;
  372. drop view exuref;
  373. drop view exurefu;
  374. drop view exurefic;
  375. drop view exurefi;
  376. drop view exurefc;
  377. drop view exuccl;
  378. drop view exucclu;
  379. drop view exucclo;
  380. drop view exurep;
  381. drop view exurepu;
  382. drop view exurepic;
  383. drop view exurepi;
  384. drop view exurepc;
  385. #
  386. # expvew5.sql
  387. #
  388. drop view tables;
  389. drop view columns;
  390. drop view extents;
  391. drop table tabauth;
  392. drop view views;
  393. drop table spaces;
  394. drop view indexes;
  395. drop view userauth;
  396. drop view partitions;
  397. drop view segquotas;
  398. drop view v4expuser;
  399. drop view v4expspace;
  400. drop view v4expindex;
  401. drop view v4exptab;
  402. drop view v4expclus;
  403. drop view v4exptabauth;
  404. drop view v4expextents;
  405. drop view v4expcol;
  406. drop view v4expsyn;
  407. drop view v4expview;
  408. #
  409. # catalog.sql
  410. #
  411. drop table AUDIT_ACTIONS;
  412. drop public synonym AUDIT_ACTIONS;
  413. drop view USER_AUDIT_TRAIL;
  414. drop public synonym USER_AUDIT_TRAIL;
  415. drop public synonym DBA_AUDIT_TRAIL;
  416. drop view USER_AUDIT_CONNECT;
  417. drop public synonym USER_AUDIT_CONNECT;
  418. drop public synonym DBA_AUDIT_CONNECT;
  419. drop view DBA_AUDIT_EXISTS;
  420. drop public synonym DBA_AUDIT_EXISTS;
  421. drop view USER_AUDIT_RESOURCE;
  422. drop public synonym USER_AUDIT_RESOURCE;
  423. drop public synonym DBA_AUDIT_RESOURCE;
  424. drop view DBA_AUDIT_DBA;
  425. drop public synonym DBA_AUDIT_DBA;
  426. drop view USER_CATALOG;
  427. drop public synonym USER_CATALOG;
  428. drop public synonym CAT;
  429. drop view ALL_CATALOG;
  430. drop public synonym ALL_CATALOG;
  431. drop view ACCESSIBLE_TABLES;
  432. drop public synonym ACCESSIBLE_TABLES;
  433. drop view DBA_CATALOG;
  434. drop view USER_CLUSTERS;
  435. drop public synonym USER_CLUSTERS;
  436. drop public synonym CLU;
  437. drop view DBA_CLUSTERS;
  438. drop view USER_CLU_COLUMNS;
  439. drop public synonym USER_CLU_COLUMNS;
  440. drop view DBA_CLU_COLUMNS;
  441. drop view USER_COL_COMMENTS;
  442. drop public synonym USER_COL_COMMENTS;
  443. drop view ALL_COL_COMMENTS;
  444. drop public synonym ALL_COL_COMMENTS;
  445. drop view DBA_COL_COMMENTS;
  446. drop view USER_COL_GRANTS;
  447. drop public synonym USER_COL_GRANTS;
  448. drop view COLUMN_PRIVILEGES;
  449. drop public synonym COLUMN_PRIVILEGES;
  450. drop public synonym ALL_COL_GRANTS;
  451. drop view DBA_COL_GRANTS;
  452. drop view USER_COL_GRANTS_MADE;
  453. drop public synonym USER_COL_GRANTS_MADE;
  454. drop view ALL_COL_GRANTS_MADE;
  455. drop public synonym ALL_COL_GRANTS_MADE;
  456. drop view USER_COL_GRANTS_RECD;
  457. drop public synonym USER_COL_GRANTS_RECD;
  458. drop view ALL_COL_GRANTS_RECD;
  459. drop public synonym ALL_COL_GRANTS_RECD;
  460. drop view USER_CROSS_REFS;
  461. drop public synonym USER_CROSS_REFS;
  462. drop view DBA_CROSS_REFS;
  463. drop view DBA_DATA_FILES;
  464. drop view USER_DB_LINKS;
  465. drop public synonym USER_DB_LINKS;
  466. drop view ALL_DB_LINKS;
  467. drop public synonym ALL_DB_LINKS;
  468. drop view DBA_DB_LINKS;
  469. drop view ALL_DEF_AUDIT_OPTS;
  470. drop public synonym ALL_DEF_AUDIT_OPTS;
  471. drop view DICTIONARY;
  472. drop public synonym DICTIONARY;
  473. drop public synonym DICT;
  474. drop view DICT_COLUMNS;
  475. drop public synonym DICT_COLUMNS;
  476. drop view DBA_EXP_OBJECTS;
  477. drop view DBA_EXP_VERSION;
  478. drop view DBA_EXP_FILES;
  479. drop view USER_FREE_SPACE;
  480. drop public synonym USER_FREE_SPACE;
  481. drop view DBA_FREE_SPACE;
  482. drop view USER_INDEXES;
  483. drop public synonym USER_INDEXES;
  484. drop public synonym IND;
  485. drop view ALL_INDEXES;
  486. drop public synonym ALL_INDEXES;
  487. drop view DBA_INDEXES;
  488. drop view USER_IND_COLUMNS;
  489. drop public synonym USER_IND_COLUMNS;
  490. drop view ALL_IND_COLUMNS;
  491. drop public synonym ALL_IND_COLUMNS;
  492. drop view DBA_IND_COLUMNS;
  493. drop view INDEX_STATS;
  494. drop public synonym INDEX_STATS;
  495. drop view INDEX_HISTOGRAM;
  496. drop public synonym INDEX_HISTOGRAM;
  497. drop view USER_OBJECTS;
  498. drop public synonym USER_OBJECTS;
  499. drop public synonym OBJ;
  500. drop view ALL_OBJECTS;
  501. drop public synonym ALL_OBJECTS;
  502. drop view DBA_OBJECTS;
  503. drop view DBA_ROLLBACK_SEGS;
  504. drop view SYS_OBJECTS;
  505. drop view USER_SEGMENTS;
  506. drop public synonym USER_SEGMENTS;
  507. drop view DBA_SEGMENTS;
  508. drop view USER_EXTENTS;
  509. drop public synonym USER_EXTENTS;
  510. drop view DBA_EXTENTS;
  511. drop view USER_SEQUENCES;
  512. drop public synonym USER_SEQUENCES;
  513. drop public synonym SEQ;
  514. drop view ALL_SEQUENCES;
  515. drop public synonym ALL_SEQUENCES;
  516. drop view DBA_SEQUENCES;
  517. drop view USER_SYNONYMS;
  518. drop public synonym SYN;
  519. drop public synonym USER_SYNONYMS;
  520. drop view ALL_SYNONYMS;
  521. drop public synonym ALL_SYNONYMS;
  522. drop view DBA_SYNONYMS;
  523. drop view DBA_SYS_AUDIT_OPTS;
  524. drop view USER_TABLES;
  525. drop public synonym USER_TABLES;
  526. drop public synonym TABS;
  527. drop view ALL_TABLES;
  528. drop public synonym ALL_TABLES;
  529. drop view DBA_TABLES;
  530. drop view USER_TABLESPACES;
  531. drop public synonym USER_TABLESPACES;
  532. drop view DBA_TABLESPACES;
  533. drop view USER_TAB_AUDIT_OPTS;
  534. drop public synonym USER_TAB_AUDIT_OPTS;
  535. drop view DBA_TAB_AUDIT_OPTS;
  536. drop view USER_TAB_COLUMNS;
  537. drop public synonym USER_TAB_COLUMNS;
  538. drop public synonym COLS;
  539. drop view ACCESSIBLE_COLUMNS;
  540. drop public synonym ACCESSIBLE_COLUMNS;
  541. drop public synonym ALL_TAB_COLUMNS;
  542. drop view DBA_TAB_COLUMNS;
  543. drop view USER_TAB_COMMENTS;
  544. drop public synonym USER_TAB_COMMENTS;
  545. drop view ALL_TAB_COMMENTS;
  546. drop public synonym ALL_TAB_COMMENTS;
  547. drop view DBA_TAB_COMMENTS;
  548. drop view USER_TAB_GRANTS;
  549. drop public synonym USER_TAB_GRANTS;
  550. drop view TABLE_PRIVILEGES;
  551. drop public synonym TABLE_PRIVILEGES;
  552. drop public synonym ALL_TAB_GRANTS;
  553. drop view DBA_TAB_GRANTS;
  554. drop view USER_TAB_GRANTS_MADE;
  555. drop public synonym USER_TAB_GRANTS_MADE;
  556. drop view ALL_TAB_GRANTS_MADE;
  557. drop public synonym ALL_TAB_GRANTS_MADE;
  558. drop view USER_TAB_GRANTS_RECD;
  559. drop public synonym USER_TAB_GRANTS_RECD;
  560. drop view ALL_TAB_GRANTS_RECD;
  561. drop public synonym ALL_TAB_GRANTS_RECD;
  562. drop view USER_TS_QUOTAS;
  563. drop public synonym USER_TS_QUOTAS;
  564. drop view DBA_TS_QUOTAS;
  565. drop view USER_USERS;
  566. drop public synonym USER_USERS;
  567. drop public synonym MYPRIVS;
  568. drop view ALL_USERS;
  569. drop public synonym ALL_USERS;
  570. drop view DBA_USERS;
  571. drop view USER_VIEWS;
  572. drop public synonym USER_VIEWS;
  573. drop view ALL_VIEWS;
  574. drop public synonym ALL_VIEWS;
  575. drop view DBA_VIEWS;
  576. drop view USER_CONSTRAINTS;
  577. drop public synonym USER_CONSTRAINTS;
  578. drop view ALL_CONSTRAINTS;
  579. drop public synonym ALL_CONSTRAINTS;
  580. drop view DBA_CONSTRAINTS;
  581. drop public synonym DBA_CONSTRAINTS;
  582. drop view USER_CONS_COLUMNS;
  583. drop public synonym USER_CONS_COLUMNS;
  584. drop view ALL_CONS_COLUMNS;
  585. drop public synonym ALL_CONS_COLUMNS;
  586. drop view DBA_CONS_COLUMNS;
  587. drop public synonym DBA_CONS_COLUMNS;
  588. drop view CONSTRAINT_DEFS;
  589. drop public synonym CONSTRAINT_DEFS;
  590. drop view CONSTRAINT_COLUMNS;
  591. drop public synonym CONSTRAINT_COLUMNS;
  592. drop view v_$waitstat;
  593. drop public synonym v$waitstat;
  594. drop view v_$process;
  595. drop public synonym v$process;
  596. drop view v_$bgprocess;
  597. drop public synonym v$bgprocess;
  598. drop view v_$session;
  599. drop public synonym v$session;
  600. drop view v_$transaction;
  601. drop public synonym v$transaction;
  602. drop view v_$latch;
  603. drop public synonym v$latch;
  604. drop view v_$latchname;
  605. drop public synonym v$latchname;
  606. drop view v_$latchholder;
  607. drop public synonym v$latchholder;
  608. drop view v_$resource;
  609. drop public synonym v$resource;
  610. drop view v_$_lock;
  611. drop public synonym v$_lock;
  612. drop view v_$lock;
  613. drop public synonym v$lock;
  614. drop view v_$sesstat;
  615. drop public synonym v$sesstat;
  616. drop view v_$sysstat;
  617. drop public synonym v$sysstat;
  618. drop view v_$statname;
  619. drop public synonym v$statname;
  620. drop view v_$access;
  621. drop public synonym v$access;
  622. drop view v_$dbfile;
  623. drop public synonym v$dbfile;
  624. drop view v_$filestat;
  625. drop public synonym v$filestat;
  626. drop view v_$logfile;
  627. drop public synonym v$logfile;
  628. drop view v_$rollname;
  629. drop public synonym v$rollname;
  630. drop view v_$rollstat;
  631. drop public synonym v$rollstat;
  632. drop view v_$sga;
  633. drop public synonym v$sga;
  634. drop view v_$parameter;
  635. drop public synonym v$parameter;
  636. drop view v_$rowcache;
  637. drop public synonym v$rowcache;
  638. drop view syscatalog_;
  639. drop view syscatalog;
  640. drop view catalog;
  641. drop view tab;
  642. drop view col;
  643. drop view syssegobj;
  644. drop view tabquotas;
  645. drop view sysfiles;
  646. drop view synonyms;
  647. drop view publicsyn;
  648. #
  649. # catalog5.sql
  650. #
  651. drop view systaballoc_;
  652. drop view systaballoc;
  653. drop view taballoc;
  654. drop view syssegobj;
  655. drop view sysstorage_;
  656. drop view sysstorage;
  657. drop view freespace;
  658. drop view storage;
  659. drop view sysextents_;
  660. drop view sysextents;
  661. drop view extents;
  662. drop view syscolumns_;
  663. drop view syscolumns;
  664. drop view columns;
  665. drop view syscatalog_;
  666. drop view syscatalog;
  667. drop view catalog;
  668. drop view sysindexes_;
  669. drop view sysindexes;
  670. drop view indexes;
  671. drop view clusters;
  672. drop view clustercolumns;
  673. drop view views;
  674. drop view sysviews;
  675. drop view systabauth;
  676. drop view syscolauth;
  677. drop view sysuserauth;
  678. drop view sysuserlist;
  679. drop view synonyms;
  680. drop view publicsyn;
  681. drop view privatesyn;
  682. drop view tab;
  683. drop view col;
  684. drop view tabquotas;
  685. drop view SYSTEM_AUDIT;
  686. drop view DEFAULT_AUDIT;
  687. drop view TABLE_AUDIT;
  688. drop table audit_actions;
  689. drop view audit_trail;
  690. drop view AUDIT_DBA;
  691. drop view AUDIT_EXISTS;
  692. drop view AUDIT_CONNECT;
  693. drop view SESSIONS;
  694. drop view AUDIT_ACCESS;
  695. drop view dblinks;
  696. drop view sysdblinks;
  697. drop view systabspaces;
  698. drop view tabspaces;
  699. drop view sysfiles;
  700. drop view systsquotas_;
  701. drop view systsquotas;
  702. drop view tsquotas;
  703. drop view sysrollbackseg;
  704. drop table dtab;
  705. #
  706. # ulview.sql
  707. #
  708. drop view LOADER_COL_INFO;
  709. drop public synonym LOADER_COL_INFO;
  710. drop view LOADER_TAB_INFO;
  711. drop public synonym LOADER_TAB_INFO;
  712. drop view LOADER_IND_INFO;
  713. drop public synonym LOADER_IND_INFO;
  714. drop view LOADER_INDCOL_INFO;
  715. drop public synonym LOADER_INDCOL_INFO;
  716. drop view LOADER_PARAM_INFO;
  717. drop public synonym LOADER_PARAM_INFO;
  718. drop view v_$loadcstat;
  719. drop public synonym v$loadcstat;
  720. drop view v_$loadtstat;
  721. drop public synonym v$loadtstat;
  722.  
  723. #^ connect (migrate, migrate)
  724.  
  725. #
  726. # m_sqlbsq
  727. #
  728.  
  729. create cluster c_obj# (obj# number)
  730.   pctfree 5 size 800                           /* don't waste too much space */
  731.   /* A table of 32 cols, 2 index, 2 col per index requires about 2K.
  732.    * A table of 10 cols, 2 index, 2 col per index requires about 750.
  733.    */
  734.   storage (initial 120K)              /* avoid space management during IOR I */
  735. /
  736. create index i_obj# on cluster c_obj#
  737. /
  738. create table tab$                                             /* table table */
  739. ( obj#          number not null,                            /* object number */
  740.   ts#           number not null,                        /* tablespace number */
  741.   file#         number not null,               /* segment header file number */
  742.   block#        number not null,              /* segment header block number */
  743.   clu#          number,      /* cluster object number, NULL if not clustered */
  744.   tab#          number,    /* table number in cluster, NULL if not clustered */
  745.   cols          number not null,                        /* number of columns */
  746.   clucols       number,/* number of clustered columns, NULL if not clustered */
  747.   pctfree$      number not null, /* minimum free space percentage in a block */
  748.   pctused$      number not null, /* minimum used space percentage in a block */
  749.   initrans      number not null,            /* initial number of transaction */
  750.   maxtrans      number not null,            /* maximum number of transaction */
  751.   modified      number not null,                               /* dirty bit: */
  752.                 /* 0 = unmodified since last backup, 1 = modified since then */
  753.   audit$        char("S_OPFL") not null,             /* auditing options */
  754.   rowcnt        number,                                    /* number of rows */
  755.   blkcnt        number,                                  /* number of blocks */
  756.   empcnt        number,                            /* number of empty blocks */
  757.   avgspc        number,                      /* average available free space */
  758.   chncnt        number,                            /* number of chained rows */
  759.   avgrln        number,                                /* average row length */
  760.   spare1        number,
  761.   spare2        number)
  762. cluster c_obj#(obj#)
  763. /
  764. create table clu$                                           /* cluster table */
  765. ( obj#          number not null,                            /* object number */
  766.   ts#           number not null,                        /* tablespace number */
  767.   file#         number not null,               /* segment header file number */
  768.   block#        number not null,              /* segment header block number */
  769.   cols          number not null,                        /* number of columns */
  770.   pctfree$      number not null, /* minimum free space percentage in a block */
  771.   pctused$      number not null, /* minimum used space percentage in a block */
  772.   initrans      number not null,            /* initial number of transaction */
  773.   maxtrans      number not null,            /* maximum number of transaction */
  774.   size$         number,
  775.        /* if b-tree, estimated number of bytes for each cluster key and rows */
  776.   hashfunc      char("M_IDEN"),        /* if hashed, function identifier */
  777.  
  778.   /* Some of the spare columns may give the initial # bytes in the hash table
  779.    * and the # hash keys per block.  These are user-specified parameters.
  780.    * For extendible hash tables, two columns might include the # bits
  781.    * currently be used in the hash function and the number of the next
  782.    * bucket to split.
  783.    * Some spare columns may be used for hash table statistics
  784.    * such as # distinct keys, # distinct values of first key column, and
  785.    * average # blocks per key.  Some spare columns  may give the number of
  786.    * the cluster table for which the cluster key is unique or indicate
  787.    * whether the cluster is normal or referential.
  788.    * We can encode multiple pieces of info in a single column.
  789.    */
  790.   hashkeys      number,                                    /* hash key count */
  791.   func          number, /* function: 0 (key is function), 1 (system default) */
  792.   extind        number,             /* extent index value of fixed hash area */
  793.   spare4        number,
  794.   spare5        number,
  795.   spare6        number,
  796.   spare7        number,
  797.   spare8        number,
  798.   spare9        number
  799. )
  800. cluster c_obj#(obj#)
  801. /
  802. create cluster c_user#(user# number)
  803.   size  315 /* cluster key ~ 20, sizeof(user$) ~ 170, 5 * sizeof(tsq$) ~ 125 */
  804. /
  805. create index i_user# on cluster c_user#
  806. /
  807. create table fet$                                       /* free extent table */
  808. ( ts#           number not null,        /* tablespace containing free extent */
  809.   file#         number not null,              /* file containing free extent */
  810.   block#        number not null,              /* starting dba of free extent */
  811.   length        number not null)          /* length in blocks of free extent */
  812. cluster c_ts#(ts#)
  813. /
  814. create table undo$                                     /* undo segment table */
  815. ( us#           number not null,                      /* undo segment number */
  816.   name          char("M_IDEN") not null,    /* name of this undo segment */
  817.   user#         number not null,      /* owner: 0 = SYS(PRIVATE), 1 = PUBLIC */
  818.   file#         number not null,               /* segment header file number */
  819.   block#        number not null,              /* segment header block number */
  820.   scnbas        number,           /* highest commit time in rollback segment */
  821.   scnwrp        number,              /* scnbas - scn base, scnwrp - scn wrap */
  822.   xactsqn       number,               /* highest transaction sequence number */
  823.   undosqn       number,                /* highest undo block sequence number */
  824.   inst#         number,    /* parallel server instance that owns the segment */
  825.   status$       number not null)              /* segment status (see KTS.H): */
  826.     /* 1 = INVALID, 2 = AVAILABLE, 3 = IN USE, 4 = OFFLINE 5 = NEED RECOVERY */
  827. /
  828. create table ts$                                         /* tablespace table */
  829. ( ts#           number not null,             /* tablespace identifier number */
  830.   name          char("M_IDEN") not null,           /* name of tablespace */
  831.   owner#        number not null,                      /* owner of tablespace */
  832.   online$       number not null,                      /* status (see KTT.H): */
  833.                                      /* 1 = ONLINE, 2 = OFFLINE, 3 = INVALID */
  834.   undofile#     number,  /* undo_off segment file number (status is OFFLINE) */
  835.   undoblock#    number,               /* undo_off segment header file number */
  836.   blocksize     number not null,                   /* size of block in bytes */
  837.   inc#          number not null,             /* incarnation number of extent */
  838.   scnwrp        number,     /* clean offline scn - zero if not offline clean */
  839.   scnbas        number,              /* scnbas - scn base, scnwrp - scn wrap */
  840.   dflminext     number not null,       /*  default minimum number of extents */
  841.   dflmaxext     number not null,        /* default maximum number of extents */
  842.   dflinit       number not null,              /* default initial extent size */
  843.   dflincr       number not null,                 /* default next extent size */
  844.   dflextpct     number not null)     /* default percent extent size increase */
  845. cluster c_ts#(ts#)
  846. /
  847. create table file$                                             /* file table */
  848. ( file#         number not null,                   /* file identifier number */
  849.   status$       number not null,                      /* status (see KTS.H): */
  850.                                                /* 1 = INVALID, 2 = AVAILABLE */
  851.   blocks        number not null,                   /* size of file in blocks */
  852.   ts#           number not null)                /* tablespace that owns file */
  853. /
  854. create table obj$                                            /* object table */
  855. ( obj#          number not null,                            /* object number */
  856.   owner#        number not null,                        /* owner user number */
  857.   name          char("M_IDEN") not null,                      /* object name */
  858.   namespace     number not null,         /* namespace of object (see KQD.H): */
  859.        /* 1 = TABLE/PROCEDURE, 2 = BODY, 3 = TRIGGER, 4 = INDEX, 5 = CLUSTER */
  860.   type          number not null,                 /* object type (see KQD.H): */
  861.   /* 1 = INDEX, 2 = TABLE, 3 = CLUSTER, 4 = VIEW, 5 = SYNONYM, 6 = SEQUENCE, */
  862.              /* 7 = PROCEDURE, 8 = FUNCTION, 9 = PACKAGE, 10 = NON-EXISTENT, */
  863.                                           /* 11 = PACKAGE BODY, 12 = TRIGGER */
  864.   ctime         date not null,                       /* object creation time */
  865.   mtime         date not null,                      /* DDL modification time */
  866.   stime         date not null,          /* specification timestamp (version) */
  867.   status        number not null,            /* status of object (see KQD.H): */
  868.                                      /* 1 = VALID/AUTHORIZED WITHOUT ERRORS, */
  869.                           /* 2 = VALID/AUTHORIZED WITH AUTHORIZATION ERRORS, */
  870.                             /* 3 = VALID/AUTHORIZED WITH COMPILATION ERRORS, */
  871.                          /* 4 = VALID/UNAUTHORIZED, 5 = INVALID/UNAUTHORIZED */
  872.   remoteowner   char("M_IDEN"), /* remote owner name (remote object) */
  873.   linkname      char("M_XDBI"))         /* link name (remote object) */
  874. /
  875. create table ind$                                             /* index table */
  876. ( obj#          number not null,                            /* object number */
  877.   ts#           number not null,                        /* tablespace number */
  878.   file#         number not null,               /* segment header file number */
  879.   block#        number not null,              /* segment header block number */
  880.   bo#           number not null,              /* object number of base table */
  881.   cols          number not null,                        /* number of columns */
  882.   pctfree$      number not null, /* minimum free space percentage in a block */
  883.   initrans      number not null,            /* initial number of transaction */
  884.   maxtrans      number not null,            /* maximum number of transaction */
  885.   compress$     number not null,       /* 0 = not compressed, 1 = compressed */
  886.   unique$       number not null,               /* 0 = not unique, 1 = unique */
  887.                                             /* future: 2 = ansi-style unique */
  888.   /* The following spare columns may be used for index statistics such
  889.    * as # btree levels, # btree leaf blocks, # distinct keys,
  890.    * # distinct values of first key column, average # leaf blocks per key,
  891.    * clustering info, and # blocks in index segment.
  892.    */
  893.   blevel        number,                                       /* btree level */
  894.   leafcnt       number,                                  /* # of leaf blocks */
  895.   distkey       number,                                   /* # distinct keys */
  896.   lblkkey       number,                          /* avg # of leaf blocks/key */
  897.   dblkkey       number,                          /* avg # of data blocks/key */
  898.   clufac        number,                                 /* clustering factor */
  899.   spare7        number,
  900.   spare8        number)
  901. cluster c_obj#(bo#)
  902. /
  903. create table icol$                                     /* index column table */
  904. ( obj#          number not null,                      /* index object number */
  905.   bo#           number not null,                       /* base object number */
  906.   col#          number not null,                            /* column number */
  907.   pos#          number not null,        /* column position number as created */
  908.   segcol#       number not null,                 /* column number in segment */
  909.   segcollength  number not null,             /* length of the segment column */
  910.   offset        number not null)                         /* offset of column */
  911. cluster c_obj#(bo#)
  912. /
  913. create table col$                                            /* column table */
  914. ( obj#          number not null,             /* object number of base object */
  915.   col#          number not null,                 /* column number as created */
  916.   segcol#       number not null,                 /* column number in segment */
  917.   segcollength  number not null,             /* length of the segment column */
  918.   offset        number not null,                         /* offset of column */
  919.   name          char("M_IDEN") not null,                   /* name of column */
  920.   type#         number  not null,                     /* data type of column */
  921.   length        number  not null,               /* length of column in bytes */
  922.   fixedstorage  number  not null,                /* 0 = not fixed, 1 = fixed */
  923.   precision     number,                                         /* precision */
  924.   scale         number,                                             /* scale */
  925.   null$         number not null,                     /* 0 = NULLs permitted, */
  926.                                                 /* > 0 = no NULLs permitted  */
  927.   distcnt       number,                              /* # of distinct values */
  928.   lowval        raw(32),/* lowest value of column (second lowest if default) */
  929.   hival         raw(32),
  930.                       /* highest value of column (second highest if default) */
  931.   deflength     number,              /* default value expression text length */
  932.   default$      long,                       /* default value expression text */
  933.   /* The spares may be used as the column's NLS character set,
  934.    * the number of distinct column values, and the column's domain.
  935.    */
  936.   spare2        number,
  937.   spare3        number)
  938. cluster c_obj#(obj#)
  939. /
  940. create table user$                                             /* user table */
  941. ( user#         number not null,                   /* user identifier number */
  942.   name          char("M_IDEN") not null,                     /* name of user */
  943.   type          number not null,                       /* 0 = role, 1 = user */
  944.   password      char("M_IDEN"),                /* encrypted password */
  945.   datats#       number not null, /* default tablespace for permanent objects */
  946.   tempts#       number not null,  /* default tablespace for temporary tables */
  947.   ctime         date not null,                 /* user account creation time */
  948.   ptime         date,                            /* password expiration time */
  949.   resource$     number not null,                        /* resource profile# */
  950.   audit$        char("S_OPFL"),                        /* user audit options */
  951.   defrole       number not null,                  /* default role indicator: */
  952.                /* 0 = no roles, 1 = all roles granted, 2 = roles in defrole$ */
  953.   spare1        number,                               /* reserved for future */
  954.   spare2        number)                               /* reserved for future */
  955. cluster c_user#(user#)
  956. /
  957. create table con$                                        /* constraint table */
  958. ( owner#        number not null,                        /* owner user number */
  959.   name          char("M_IDEN") not null,                  /* constraint name */
  960.   con#          number not null,                        /* constraint number */
  961.   spare1        number)
  962. /
  963. create cluster c_cobj# (obj# number)
  964.   pctfree 0 pctused 50
  965.   /* space for: update cdef$ set condition = 'col IS NOT NULL' at // */
  966.   size 300
  967.   storage (initial 50K)               /* avoid space management during IOR I */
  968. /
  969. create index i_cobj# on cluster c_cobj#
  970. /
  971. create table cdef$                            /* constraint definition table */
  972. ( con#          number not null,                        /* constraint number */
  973.   obj#          number not null,         /* object number of base table/view */
  974.   cols          number,                   /* number of columns in constraint */
  975.   type          number not null,                         /* constraint type: */
  976.                             /* 1 = table check, 2 = primary key, 3 = unique, */
  977.                                          /* 4 = referential, 5 = view check, */
  978.                                  /* 6 = special for replication logging hook */
  979.                /* 7 - table check constraint associated with column NOT NULL */
  980.   robj#         number,                 /* object number of referenced table */
  981.   rcon#         number,           /* constraint number of referenced columns */
  982.   rrules        char(3),             /* future: use this columns for pendant */
  983.   match         number,                /* referential constraint match type: */
  984.                                                  /* null = FULL, 1 = PARTIAL */
  985.         /* this column can also store information for other constraint types */
  986.   refact        number,                               /* referential action: */
  987.               /* null = RESTRICT, 1 = CASCADE, 2 = SET NULL, 3 = SET DEFAULT */
  988.   enabled        number,          /* is constraint enabled? NULL if disabled */
  989.   condlength    number,                 /* table check condition text length */
  990.   condition     long,                          /* table check condition text */
  991.   spare1        number)
  992. cluster c_cobj#(obj#)
  993. /
  994. create table ccol$                                /* constraint column table */
  995. ( con#          number not null,                        /* constraint number */
  996.   obj#          number not null,                       /* base object number */
  997.   col#          number not null,                            /* column number */
  998.   pos#          number,                 /* column position number as created */
  999.   spare1        number)
  1000. cluster c_cobj#(obj#)
  1001. /
  1002. create index i_tab1 on tab$(clu#)
  1003. /
  1004. create unique index i_undo1 on undo$(us#)
  1005. /
  1006. create unique index i_obj1 on obj$(obj#)
  1007. /
  1008. create unique index i_obj2 on obj$(owner#, name, namespace,
  1009. remoteowner, linkname)
  1010. /
  1011. create unique index i_ind1 on ind$(obj#)
  1012. /
  1013. create index i_icol1 on icol$(obj#)
  1014. /
  1015. create unique index i_file1 on file$(file#)
  1016. /
  1017. create unique index i_user1 on user$(name)
  1018. /
  1019. create unique index i_col1 on col$(obj#, name)
  1020.   storage (initial 30k)
  1021. /
  1022. create unique index i_col2 on col$(obj#, col#)
  1023.   storage (initial 30k)
  1024. /
  1025. create unique index i_con1 on con$(owner#, name)
  1026. /
  1027. create unique index i_con2 on con$(con#)
  1028. /
  1029. create unique index i_cdef1 on cdef$(con#)
  1030. /
  1031. create index i_cdef2 on cdef$(obj#)
  1032. /
  1033. create index i_cdef3 on cdef$(robj#)
  1034. /
  1035. create unique index i_ccol1 on ccol$(con#, col#)
  1036. /
  1037. create table bootstrap$
  1038. ( line#         number not null,                       /* statement order id */
  1039.   obj#          number not null,                            /* object number */
  1040.   sql_text      long not null)                                  /* statement */
  1041.   storage (initial 50K)            /* to avoid space management during IOR I */
  1042. //
  1043. create table tsq$                                  /* tablespace quota table */
  1044. ( ts#           number not null,                        /* tablespace number */
  1045.   user#         number not null,                              /* user number */
  1046.   grantor#      number not null,                               /* grantor id */
  1047.   blocks        number not null,         /* number of blocks charged to user */
  1048.   maxblocks     number,     /* user's maximum number of blocks, NULL if none */
  1049.   priv1         number not null,            /* reserved for future privilege */
  1050.   priv2         number not null,            /* reserved for future privilege */
  1051.   priv3         number not null)            /* reserved for future privilege */
  1052. cluster c_user# (user#)
  1053. /
  1054. create table syn$                                           /* synonym table */
  1055. ( obj#          number not null,                            /* object number */
  1056.   node          char("M_XDBI"),                    /* node of object */
  1057.   owner         char("M_IDEN"),                          /* object owner */
  1058.   name          char("M_IDEN") not null)                      /* object name */
  1059. /
  1060. create table view$                                             /* view table */
  1061. ( obj#          number not null,                            /* object number */
  1062.   audit$        char("S_OPFL") not null,                 /* auditing options */
  1063.   cols          number not null,                        /* number of columns */
  1064.   textlength    number,                               /* length of view text */
  1065.   text          long)                                           /* view text */
  1066. /
  1067. create table seq$
  1068. ( obj#          number not null,                            /* object number */
  1069.   increment$    number not null,            /* the sequence number increment */
  1070.   minvalue      number,                         /* minimum value of sequence */
  1071.   maxvalue      number,                         /* maximum value of sequence */
  1072.   cycle         number not null,                      /* 0 = FALSE, 1 = TRUE */
  1073.   order$        number not null,                      /* 0 = FALSE, 1 = TRUE */
  1074.   cache         number not null,                 /* how many to cache in sga */
  1075.   highwater     number not null,                     /* disk high water mark */
  1076.   audit$        char("S_OPFL") not null)             /* auditing options */
  1077. /
  1078. create table procedure$                                   /* procedure table */
  1079. ( obj#          number not null,                            /* object number */
  1080.   audit$        char("S_OPFL") not null,                 /* auditing options */
  1081.   storagesize   number,                         /* storage size of procedure */
  1082.   options       number)                                   /* compile options */
  1083. /
  1084. create table argument$                     /* procedure argument description */
  1085. ( obj#           number not null,                           /* object number */
  1086.   procedure$     char(30),             /* procedure name (within a package) */
  1087.   overload#      number not null,
  1088.                 /* 0 = not overloaded, n = unique id of overloaded procedure */
  1089.   position       number not null,  /* argument position (0 for return value) */
  1090.   sequence#      number not null,
  1091.   level#         number not null,
  1092.   argument       char(30),          /* argument name (null for return value) */
  1093.   type           number not null,                           /* argument type */
  1094.   default#       number,   /* null = no default value, 1 = has default value */
  1095.   in_out         number,
  1096.   length         number,                                      /* data length */
  1097.   precision      number,                                /* numeric precision */
  1098.   scale          number,                                    /* numeric scale */
  1099.   radix          number)                                    /* numeric radix */
  1100. /
  1101. create table source$                                         /* source table */
  1102. ( obj#          number not null,                            /* object number */
  1103.   line          number not null,                              /* line number */
  1104.   source        long)                                         /* source line */
  1105. /
  1106. create table idl_ub1$                            /* idl table for ub1 pieces */
  1107. ( obj#          number not null,                            /* object number */
  1108.   part          number not null,
  1109.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  1110.   piece#        number not null,                             /* piece number */
  1111.   length        number not null,                             /* piece length */
  1112.   piece         long raw not null)                              /* ub1 piece */
  1113. /
  1114. create table idl_char$                          /* idl table for char pieces */
  1115. ( obj#          number not null,                            /* object number */
  1116.   part          number not null,
  1117.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  1118.   piece#        number not null,                             /* piece number */
  1119.   length        number not null,                             /* piece length */
  1120.   piece         long not null)                                 /* char piece */
  1121. /
  1122. create table idl_ub2$                            /* idl table for ub2 pieces */
  1123. ( obj#          number not null,                            /* object number */
  1124.   part          number not null,
  1125.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  1126.   piece#        number not null,                             /* piece number */
  1127.   length        number not null,                             /* piece length */
  1128.   piece         long not null)                                  /* ub2 piece */
  1129. /
  1130. create table idl_sb4$                            /* idl table for sb4 pieces */
  1131. ( obj#          number not null,                            /* object number */
  1132.   part          number not null,
  1133.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  1134.   piece#        number not null,                             /* piece number */
  1135.   length        number not null,                             /* piece length */
  1136.   piece         long not null)                                  /* sb4 piece */
  1137. /
  1138. create table error$                                           /* error table */
  1139. ( obj#          number not null,                            /* object number */
  1140.   sequence      number default 0 not null,
  1141.                                   /* sequence number (for ordering purposes) */
  1142.   line          number not null,                              /* line number */
  1143.   position      number not null,                         /* position in line */
  1144.   textlength    number not null,                 /* length of the error text */
  1145.   text          long not null)                                 /* error text */
  1146. /
  1147. create table trigger$                                       /* trigger table */
  1148. ( obj#          number not null,                            /* object number */
  1149.   type          number not null,                            /* trigger type: */
  1150.         /*  0 = BEFORE TABLE, 1 = BEFORE ROW, 2 = AFTER TABLE, 3 = AFTER ROW */
  1151.   update$       number not null,                           /* fire on update */
  1152.   insert$       number not null,                           /* fire on insert */
  1153.   delete$       number not null,                           /* fire on delete */
  1154.   baseobject    number not null,                        /* triggering object */
  1155.   refoldname    char("M_IDEN"),                      /* old referencing name */
  1156.   refnewname    char("M_IDEN"),                      /* new referencing name */
  1157.   definition    char(255),                             /* trigger definition */
  1158.   whenclause    char(255),                            /* text of when clause */
  1159.   action        long,                                      /* action to fire */
  1160.   actionsize    number,                               /* size of action text */
  1161.   enabled       number)                         /* 0 = DISABLED, 1 = ENABLED */
  1162. /
  1163. create table triggercol$
  1164. ( obj#          number not null,                            /* object number */
  1165.   col#          number not null,                            /* column number */
  1166.   type          number not null,                /* type of column reference: */
  1167.       /* 2 = OLD IN-ARG, 3 = NEW IN-ARG, 5 = NEW OUT-VAR, 7 = NEW IN/OUT-VAR */
  1168.   position      number)                               /* position in trigger */
  1169. /
  1170. create table objauth$                           /* table authorization table */
  1171. ( obj#          number not null,                            /* object number */
  1172.   grantor#      number not null,                      /* grantor user number */
  1173.   grantee#      number not null,                      /* grantee user number */
  1174.   privilege#    number not null,                   /* table privilege number */
  1175.   sequence#     number not null,                    /* unique grant sequence */
  1176.   parent        rowid,                                             /* parent */
  1177.   option$       number,                     /* null = none, 1 = grant option */
  1178.   col#          number)     /* null = table level, column id if column grant */
  1179. /
  1180. create table sysauth$                          /* system authorization table */
  1181. ( grantee#      number not null,          /* grantee number (user# or role#) */
  1182.   privilege#    number not null,                      /* role or privilege # */
  1183.   sequence#     number not null,                    /* unique grant sequence */
  1184.   option$       number)                     /* null = none, 1 = admin option */
  1185. /
  1186. create table defrole$                                  /* default role table */
  1187. ( user#         number not null,                                  /* user id */
  1188.   role#         number not null)                          /* default role id */
  1189. /
  1190. create table profile$                                    /* resource profile */
  1191. ( profile#      number not null,   /* user$.resource$ and profname$.profile# */
  1192.   resource#     number not null,                          /* resource number */
  1193.   type          number not null,  /* 0 = kernel resource, else tool resource */
  1194.   limit         number not null)                           /* resource limit */
  1195. /
  1196. create table profname$                /* mapping of profile# to profile name */
  1197. ( profile#      number not null,
  1198.   name          char("M_IDEN") not null)
  1199. /
  1200. create table dependency$                                 /* dependency table */
  1201. ( d_obj#        number not null,                  /* dependent object number */
  1202.   d_timestamp   date not null,   /* dependent object specification timestamp */
  1203.   order#        number not null,                             /* order number */
  1204.   p_obj#        number not null,                     /* parent object number */
  1205.   p_timestamp   date not null)      /* parent object specification timestamp */
  1206. /
  1207. create table access$                                         /* access table */
  1208. ( d_obj#        number not null,                  /* dependent object number */
  1209.   order#        number not null,                  /* dependency order number */
  1210.   columns       raw("M_BVCO"),                /* list of cols for this entry */
  1211.   types         number not null)                             /* access types */
  1212. /
  1213. create table lab$
  1214. ( lab#          number not null,           /* internal database label number */
  1215.   olab          raw(32),                    /* operating system label number */
  1216.   alias         char("M_IDEN"))                      /* alias for label name */
  1217. /
  1218. create table aud$                                       /* audit trail table */
  1219. ( sessionid     number not null,
  1220.   entryid       number not null,
  1221.   statement     number not null,
  1222.   timestamp     date not null,
  1223.   userid        char("M_IDEN"),
  1224.   userhost      char("M_HOST"),
  1225.   terminal      char("M_TERM"),
  1226.   action        number not null,
  1227.   returncode    number not null,
  1228.   obj$creator   char("M_IDEN"),
  1229.   obj$name      char("M_XDBI"),
  1230.   auth$privileges char("S_PRFL"),
  1231.   auth$grantee  char("M_IDEN"),
  1232.   new$owner     char("M_IDEN"),
  1233.   new$name      char("M_XDBI"),
  1234.   ses$actions   char("S_ACFL"),
  1235.   ses$tid       number,
  1236.   logoff$lread  number,
  1237.   logoff$pread  number,
  1238.   logoff$lwrite number,
  1239.   logoff$dead   number,
  1240.   logoff$time   date,
  1241.   comment$text  long,
  1242.   spare1        char(255),
  1243.   spare2        number,
  1244.   obj$label     raw(32),                                    /* K_MLS changes */
  1245.   ses$label     raw(32),
  1246.   priv$used     number)
  1247. /
  1248. create table link$                             /* remote database link table */
  1249. ( owner#        number not null,                        /* owner user number */
  1250.   name          char("M_XDBI") not null,                /* link name */
  1251.   ctime         date not null,                              /* creation time */
  1252.   host          char("M_HOST"),    /* optional driver string for connect */
  1253.   userid        char("M_IDEN"),             /* optional user to logon as */
  1254.   password      char("M_IDEN"))                    /* password for logon */
  1255. /
  1256. create table props$
  1257. ( name          char("M_IDEN") not null,                /* property name */
  1258.   value$        char(255),                        /* property value */
  1259.   comment$      char(255))               /* description of property */
  1260. /
  1261. create table com$                                           /* comment table */
  1262. ( obj#          number not null,                            /* object number */
  1263.   col#          number,                /* column number (NULL if for object) */
  1264.   comment$      long)          /* user-specified description */
  1265. /
  1266. create table resource_cost$
  1267. ( resource#     number not null,                         /* 2, 4, 6, 7, 8, 9 */
  1268.   cost          number not null)                                     /* >= 0 */
  1269. /
  1270. create unique index i_view1 on view$(obj#)
  1271. /
  1272. create unique index i_syn1 on syn$(obj#)
  1273. /
  1274. create unique index i_seq1 on seq$(obj#)
  1275. /
  1276. # defer creating this index until after we populate the table.
  1277. # the table objauth$ will not be unique after we copy it from v6;
  1278. # some pruning work will need to be done (later).
  1279. #
  1280. # create unique index i_objauth1 on
  1281. #   objauth$(obj#, grantor#, grantee#, privilege#, col#)
  1282. # /
  1283. create index i_objauth2 on objauth$(obj#, grantee#, col#)
  1284. /
  1285. create unique index i_sysauth1 on sysauth$(grantee#, privilege#)
  1286. /
  1287. create unique index i_defrole1 on defrole$(user#, role#)
  1288. /
  1289. create index i_aud1 on aud$(sessionid, ses$tid)
  1290. /
  1291. create index i_link1 on link$(owner#, name)
  1292. /
  1293. create unique index i_com1 on com$(obj#,col#)
  1294. /
  1295. create unique index i_procedure1 on procedure$(obj#)
  1296. /
  1297. create unique index i_argument1 on
  1298.   argument$(obj#, procedure$, overload#, position, sequence#)
  1299. /
  1300. create unique index i_source1 on source$(obj#,line)
  1301. /
  1302. create unique index i_idl_ub11 on idl_ub1$(obj#,part,piece#)
  1303. /
  1304. create unique index i_idl_char1 on idl_char$(obj#,part,piece#)
  1305. /
  1306. create unique index i_idl_ub21 on idl_ub2$(obj#,part,piece#)
  1307. /
  1308. create unique index i_idl_sb41 on idl_sb4$(obj#,part,piece#)
  1309. /
  1310. create index i_error1 on error$(obj#, sequence)
  1311. /
  1312. create unique index i_dependency1 on dependency$(d_obj#, d_timestamp, order#)
  1313. /
  1314. create index i_dependency2 on dependency$(p_obj#, p_timestamp)
  1315. /
  1316. create index i_trigger1 on trigger$(baseobject)
  1317. /
  1318. create unique index i_trigger2 on trigger$(obj#)
  1319. /
  1320. create index i_triggercol1 on triggercol$(obj#)
  1321. /
  1322. create unique index i_profname on profname$(name)
  1323. /
  1324. create index i_profile on profile$(profile#)
  1325. /
  1326. create sequence label_translation   /* sequence for translation cache (lab$) */
  1327.   increment by 1
  1328.   start with 3
  1329.   minvalue 3
  1330.   nomaxvalue
  1331.   cache 20
  1332.   order
  1333.   nocycle
  1334. /
  1335. create sequence object_grant                 /* object grant sequence number */
  1336.   start with 1
  1337.   increment by 1
  1338.   minvalue 1
  1339.   nomaxvalue
  1340.   cache 20
  1341.   order
  1342.   nocycle
  1343. /
  1344. create sequence system_grant                 /* system grant sequence number */
  1345.   start with 1
  1346.   increment by 1
  1347.   minvalue 1
  1348.   nomaxvalue
  1349.   cache 20
  1350.   order
  1351.   nocycle
  1352. /
  1353. create sequence profnum$                   /* profile number sequence number */
  1354.   increment by 1
  1355.   start with 0                              /* profile# for DEFAULT always 0 */
  1356.   minvalue 0
  1357.   nocache                                           /* don't want to reuse 0 */
  1358. /
  1359. #create profile "DEFAULT" limit            /* default value, always present */
  1360. #  composite_limit              unlimited                   /* service units */
  1361. #  sessions_per_user            unlimited              /* logins per user id */
  1362. #  cpu_per_session              unlimited            /* cpu usage in minutes */
  1363. #  cpu_per_call                 unlimited        /* max cpu minutes per call */
  1364. #  logical_reads_per_session    unlimited
  1365. #  logical_reads_per_call       unlimited
  1366. #  idle_time                    unlimited
  1367. #  connect_time                         unlimited
  1368. #  private_sga                  unlimited      /* valid only with TP-monitor */
  1369. #/
  1370. create table incexp                      /* incremental export support table */
  1371. ( owner#        number not null,                                 /* owner id */
  1372.   name          char("M_IDEN") not null,                  /* object name */
  1373.   type          number(1) not null,                           /* object type */
  1374.   ctime         date,                      /* time of last cumulative export */
  1375.   itime         date not null,            /* time of last incremental export */
  1376.   expid         number(3) not null)                             /* export id */
  1377. /
  1378. create unique index i_incexp on incexp(owner#, name, type)
  1379. /
  1380. #create user sys identified by change_on_install
  1381. #/
  1382. #create role public
  1383. #/
  1384. #create role connect
  1385. #/
  1386. #grant create session,alter session,create synonym,create view,
  1387. # create database link to connect
  1388. #/
  1389. #create role resource
  1390. #/
  1391. #grant create table,create cluster,create sequence,create trigger,
  1392. # create procedure to resource
  1393. #/
  1394. #create role dba
  1395. #/
  1396. #grant all privileges to dba with admin option
  1397. #/
  1398. #create user system identified by manager
  1399. #/
  1400. #grant dba,unlimited tablespace to system with admin option
  1401. #/
  1402. #grant all on incexp to system
  1403. #/
  1404. create table incvid                    /* incremental valid identifier table */
  1405. ( expid         number(3) not null)               /* id of last valid export */
  1406. /
  1407. grant all on incvid to system
  1408. /
  1409. create table incfil                         /* incremental file export table */
  1410. ( expid         number(3) not null,                             /* export id */
  1411.   exptype       char(1) not null,                        /* export type: */
  1412.                                 /* f - full, i - incremental, c - cumulative */
  1413.   expfile       char(100) not null,                  /* export file name */
  1414.   expdate       date not null,                                /* export date */
  1415.   expuser       char("M_IDEN") not null)            /* user doing export */
  1416. /
  1417. grant all on incfil to system
  1418. /
  1419. create table "_default_auditing_options_"   /* default auditing option table */
  1420. ( a             char(1))                              /* auditing option */
  1421. /
  1422. #
  1423. # we don't need to create audses$ since it is carried over from v6
  1424. #
  1425. #create sequence audses$                               /* auditing session id */
  1426. #  start with 1
  1427. #  increment by 1
  1428. #  minvalue 1
  1429. #  maxvalue 2E9                                     /* maxvalue fits in a ub4 */
  1430. #  cycle
  1431. #  cache 20
  1432. #  noorder
  1433. #/
  1434. create table audit$                                 /* auditing option table */
  1435. ( user#         number not null,                   /* user identifier number */
  1436.   option#       number not null,                   /* auditing option number */
  1437.   success       number,                                 /* audit on success? */
  1438.   failure       number)                                 /* audit on failure? */
  1439.                /* null = no audit, 1 = audit by session, 2 = audit by access */
  1440. /
  1441. create unique index i_audit on audit$(user#, option#)
  1442.    /* this index is to ensure uniqueness and not performance */
  1443. /
  1444. create table pending_trans$             /* pending or "indoubt" transactions */
  1445. ( local_tran_id   char("M_LTID") not null, /* print form of kxid (local) */
  1446.   global_tran_fmt integer not null,               /* global tran format code */
  1447.   global_oracle_id  char("M_GTID"),                      /* Oracle k2gti */
  1448.   global_foreign_id raw("M_GTID"),                       /* non-Oracle k2gti */
  1449.   tran_comment    char("M_XCMT"),             /* commit/rollback comment */
  1450.   state           char(16) not null,       /* see k2.h: k2sta (tx state) */
  1451.   status          char(1) not null,                   /* Pending, Damage */
  1452.   heuristic_dflt  char(1),                  /* advice: Commit/Rollback/? */
  1453.   session_vector  raw(4) not null,              /* bit map of pending sess's */
  1454.   reco_vector     raw(4) not null,             /* map of sess's rdy for reco */
  1455.   fail_time       date not null,                            /* time inserted */
  1456.   heuristic_time  date,                        /* time of heuristic decision */
  1457.   reco_time       date not null,               /* last time tried (exp.b.o.) */
  1458.   top_db_user     char("M_IDEN"),        /* top level DB session created */
  1459.   top_os_user     char("M_UNML"),              /* top level OS user name */
  1460.   top_os_host     char("M_HOST"),         /* top level user OS host name */
  1461.   top_os_terminal char("M_TERM"),            /* top level OS terminal id */
  1462.   global_commit#  char(16) )              /* global system commit number */
  1463. /
  1464. create unique index i_pending_trans1 on pending_trans$(local_tran_id)
  1465.   /* this index is not for performance, but rather to ensure uniqueness */
  1466. /
  1467. create table pending_sessions$                    /* child of pending_trans$ */
  1468. ( local_tran_id   char("M_LTID") not null,                  /* 1:n w/ parent */
  1469.   session_id      smallint not null,
  1470.   branch_id       raw("M_GBID") not null,                        /* of local */
  1471.   interface       char(1) not null,              /* C=commit/confirm, P=prep */
  1472.   parent_dbid     char("M_IDBI"),                  /* null string->top level */
  1473.   parent_db       char("M_XDBI"),      /* global name of parent database */
  1474.   db_userid       integer not null)                 /* creator of DB session */
  1475. /
  1476. create table pending_sub_sessions$             /* child of pending_sessions$ */
  1477. ( local_tran_id   char("M_LTID") not null,      /* w/session_id,1:n w/parent */
  1478.   session_id      smallint not null,                             /* of local */
  1479.   sub_session_id  smallint not null, /* session,sub_session is remote branch */
  1480.   interface       char(1) not null,              /* C=hold commit, N=no hold */
  1481.   dbid            char("M_IDBI") not null,                      /* of remote */
  1482.   link_owner      integer not null,                       /* owner of dblink */
  1483.   dblink          char("M_XDBI") not null)
  1484. /
  1485. create cluster c_mlog# (master char("M_IDEN"),
  1486.                         mowner char("M_IDEN"))
  1487. /
  1488. create index i_mlog# on cluster c_mlog#
  1489. /
  1490. create table mlog$          /* list of local master tables used by snapshots */
  1491. ( mowner          char("M_IDEN") not null,            /* owner of master */
  1492.   master          char("M_IDEN") not null,             /* name of master */
  1493.   oldest          date,                                /* maximum age of log */
  1494.   oscn            number,                                   /* scn of oldest */
  1495.   youngest        date,                     /* most recent snaptime assigned */
  1496.   yscn            number,                                 /* scn of youngest */
  1497.   log             char("M_IDEN") not null,                /* name of log */
  1498.   trig            char("M_IDEN") not null)  /* trigger on master for log */
  1499. cluster c_mlog# (master, mowner)
  1500. /
  1501. create table slog$                     /* list of snapshots on local masters */
  1502. ( mowner          char("M_IDEN") not null,            /* owner of master */
  1503.   master          char("M_IDEN") not null,             /* name of master */
  1504.   snapshot        date,                               /* identifies snapshot */
  1505.   sscn            number,                                 /* scn of snapshot */
  1506.   snaptime        date               not null,        /* when last refreshed */
  1507.   tscn            number)                                 /* scn of snaptime */
  1508. cluster c_mlog# (master, mowner)
  1509. /
  1510. create index i_slog1 on slog$(snaptime)
  1511. /
  1512. create table snap$                                /* list of local snapshots */
  1513. ( sowner          char("M_IDEN") not null,              /* owner of snapshot */
  1514.   vname           char("M_IDEN") not null,          /* name of snapshot view */
  1515.   tname           char("M_IDEN") not null,         /* name of snapshot table */
  1516.   mview           char("M_IDEN") not null,     /* view snapshot is made from */
  1517.   mowner          char("M_IDEN"),                         /* owner of master */
  1518.   master          char("M_IDEN"),                          /* name of master */
  1519.   mlink           char("M_XDBI"),            /* database link to master site */
  1520.   can_use_log     char(1),                  /* is query_expr a simple query? */
  1521.   snapshot        date,       /* used by the master to identify the snapshot */
  1522.   sscn            number,                                 /* scn of snapshot */
  1523.   snaptime        date,             /* when this snapshot was last refreshed */
  1524.   tscn            number,                                 /* scn of snaptime */
  1525.   error#          number,          /* last error caused by automatic refresh */
  1526.   auto_fast       char(1),            /* date function for automatic refresh */
  1527.   auto_fun        char("M_DATF"),         /* time for next automatic refresh */
  1528.   auto_date       date,             /* time for next automatic refresh force */
  1529.   query_txt       long)                /* query which this view instantiates */
  1530. /
  1531. create unique index i_snap1 on snap$(vname, sowner)
  1532. /
  1533. create cluster hist$
  1534. ( obj#            number,                                   /* object number */
  1535.   col#            number)                                   /* column number */
  1536.   pctfree 5 size 200
  1537. /
  1538. create index i_hist$ on cluster hist$
  1539. /
  1540. create table histogram$                                   /* histogram table */
  1541. ( obj#            number not null,                          /* object number */
  1542.   col#            number not null,                          /* column number */
  1543.   bucket          number not null,                          /* bucket number */
  1544.   endpoint        number not null,                  /* endpoint hashed value */
  1545.   endpointr       raw(32))                             /* endpoint raw value */
  1546. cluster hist$(obj#, col#)
  1547. /
  1548. create table dual (dummy char(1))    /* pl/sql's standard pckg requires dual */
  1549. /
  1550. insert into dual values('X')
  1551. /
  1552. create public synonym dual for dual
  1553. /
  1554. grant select on dual to public with grant option
  1555. /
  1556. #
  1557. #  FAMILY "PRIVILEGE MAP"
  1558. #  Tables for mapping privilege numbers to privilege names.
  1559. #
  1560. #  SYSTEM_PRIVILEGE_MAP maps a system privilege  number
  1561. #  to the name.
  1562. #
  1563. create table SYSTEM_PRIVILEGE_MAP (
  1564.         PRIVILEGE       number not null,
  1565.         NAME            char(40) not null)
  1566. /
  1567. comment on table SYSTEM_PRIVILEGE_MAP is
  1568. 'Description table for privilege type codes.  Maps privilege  type numbers to type names'
  1569. /
  1570. comment on column SYSTEM_PRIVILEGE_MAP.PRIVILEGE is
  1571. 'Numeric privilege type code'
  1572. /
  1573. comment on column SYSTEM_PRIVILEGE_MAP.NAME is
  1574. 'Name of the type of privilege'
  1575. /
  1576. insert into SYSTEM_PRIVILEGE_MAP values (-3, 'ALTER SYSTEM');
  1577. insert into SYSTEM_PRIVILEGE_MAP values (-4, 'AUDIT SYSTEM');
  1578. insert into SYSTEM_PRIVILEGE_MAP values (-5, 'CREATE SESSION');
  1579. insert into SYSTEM_PRIVILEGE_MAP values (-6, 'ALTER SESSION');
  1580. insert into SYSTEM_PRIVILEGE_MAP values (-7, 'RESTRICTED SESSION');
  1581. insert into SYSTEM_PRIVILEGE_MAP values (-10, 'CREATE TABLESPACE');
  1582. insert into SYSTEM_PRIVILEGE_MAP values (-11, 'ALTER TABLESPACE');
  1583. insert into SYSTEM_PRIVILEGE_MAP values (-12, 'MANAGE TABLESPACE');
  1584. insert into SYSTEM_PRIVILEGE_MAP values (-13, 'DROP TABLESPACE');
  1585. insert into SYSTEM_PRIVILEGE_MAP values (-15, 'UNLIMITED TABLESPACE');
  1586. insert into SYSTEM_PRIVILEGE_MAP values (-20, 'CREATE USER');
  1587. insert into SYSTEM_PRIVILEGE_MAP values (-21, 'BECOME USER');
  1588. insert into SYSTEM_PRIVILEGE_MAP values (-22, 'ALTER USER');
  1589. insert into SYSTEM_PRIVILEGE_MAP values (-23, 'DROP USER');
  1590. insert into SYSTEM_PRIVILEGE_MAP values (-30, 'CREATE ROLLBACK SEGMENT');
  1591. insert into SYSTEM_PRIVILEGE_MAP values (-31, 'ALTER ROLLBACK SEGMENT');
  1592. insert into SYSTEM_PRIVILEGE_MAP values (-32, 'DROP ROLLBACK SEGMENT');
  1593. insert into SYSTEM_PRIVILEGE_MAP values (-40, 'CREATE TABLE');
  1594. insert into SYSTEM_PRIVILEGE_MAP values (-41, 'CREATE ANY TABLE');
  1595. insert into SYSTEM_PRIVILEGE_MAP values (-42, 'ALTER ANY TABLE');
  1596. insert into SYSTEM_PRIVILEGE_MAP values (-43, 'BACKUP ANY TABLE');
  1597. insert into SYSTEM_PRIVILEGE_MAP values (-44, 'DROP ANY TABLE');
  1598. insert into SYSTEM_PRIVILEGE_MAP values (-45, 'LOCK ANY TABLE');
  1599. insert into SYSTEM_PRIVILEGE_MAP values (-46, 'COMMENT ANY TABLE');
  1600. insert into SYSTEM_PRIVILEGE_MAP values (-47, 'SELECT ANY TABLE');
  1601. insert into SYSTEM_PRIVILEGE_MAP values (-48, 'INSERT ANY TABLE');
  1602. insert into SYSTEM_PRIVILEGE_MAP values (-49, 'UPDATE ANY TABLE');
  1603. insert into SYSTEM_PRIVILEGE_MAP values (-50, 'DELETE ANY TABLE');
  1604. insert into SYSTEM_PRIVILEGE_MAP values (-60, 'CREATE CLUSTER');
  1605. insert into SYSTEM_PRIVILEGE_MAP values (-61, 'CREATE ANY CLUSTER');
  1606. insert into SYSTEM_PRIVILEGE_MAP values (-62, 'ALTER ANY CLUSTER');
  1607. insert into SYSTEM_PRIVILEGE_MAP values (-63, 'DROP ANY CLUSTER');
  1608. insert into SYSTEM_PRIVILEGE_MAP values (-71, 'CREATE ANY INDEX');
  1609. insert into SYSTEM_PRIVILEGE_MAP values (-72, 'ALTER ANY INDEX');
  1610. insert into SYSTEM_PRIVILEGE_MAP values (-73, 'DROP ANY INDEX');
  1611. insert into SYSTEM_PRIVILEGE_MAP values (-80, 'CREATE SYNONYM');
  1612. insert into SYSTEM_PRIVILEGE_MAP values (-81, 'CREATE ANY SYNONYM');
  1613. insert into SYSTEM_PRIVILEGE_MAP values (-82, 'DROP ANY SYNONYM');
  1614. insert into SYSTEM_PRIVILEGE_MAP values (-85, 'CREATE PUBLIC SYNONYM');
  1615. insert into SYSTEM_PRIVILEGE_MAP values (-86, 'DROP PUBLIC SYNONYM');
  1616. insert into SYSTEM_PRIVILEGE_MAP values (-90, 'CREATE VIEW');
  1617. insert into SYSTEM_PRIVILEGE_MAP values (-91, 'CREATE ANY VIEW');
  1618. insert into SYSTEM_PRIVILEGE_MAP values (-92, 'DROP ANY VIEW');
  1619. insert into SYSTEM_PRIVILEGE_MAP values (-105, 'CREATE SEQUENCE');
  1620. insert into SYSTEM_PRIVILEGE_MAP values (-106, 'CREATE ANY SEQUENCE');
  1621. insert into SYSTEM_PRIVILEGE_MAP values (-107, 'ALTER ANY SEQUENCE');
  1622. insert into SYSTEM_PRIVILEGE_MAP values (-108, 'DROP ANY SEQUENCE');
  1623. insert into SYSTEM_PRIVILEGE_MAP values (-109, 'SELECT ANY SEQUENCE');
  1624. insert into SYSTEM_PRIVILEGE_MAP values (-115, 'CREATE DATABASE LINK');
  1625. insert into SYSTEM_PRIVILEGE_MAP values (-120, 'CREATE PUBLIC DATABASE LINK');
  1626. insert into SYSTEM_PRIVILEGE_MAP values (-121, 'DROP PUBLIC DATABASE LINK');
  1627. insert into SYSTEM_PRIVILEGE_MAP values (-125, 'CREATE ROLE');
  1628. insert into SYSTEM_PRIVILEGE_MAP values (-126, 'DROP ANY ROLE');
  1629. insert into SYSTEM_PRIVILEGE_MAP values (-127, 'GRANT ANY ROLE');
  1630. insert into SYSTEM_PRIVILEGE_MAP values (-128, 'ALTER ANY ROLE');
  1631. insert into SYSTEM_PRIVILEGE_MAP values (-130, 'AUDIT ANY');
  1632. insert into SYSTEM_PRIVILEGE_MAP values (-131, 'SYSTEM GRANT');
  1633. insert into SYSTEM_PRIVILEGE_MAP values (-135, 'ALTER DATABASE');
  1634. insert into SYSTEM_PRIVILEGE_MAP values (-138, 'FORCE TRANSACTION');
  1635. insert into SYSTEM_PRIVILEGE_MAP values (-139, 'FORCE ANY TRANSACTION');
  1636. insert into SYSTEM_PRIVILEGE_MAP values (-140, 'CREATE PROCEDURE');
  1637. insert into SYSTEM_PRIVILEGE_MAP values (-141, 'CREATE ANY PROCEDURE');
  1638. insert into SYSTEM_PRIVILEGE_MAP values (-142, 'ALTER ANY PROCEDURE');
  1639. insert into SYSTEM_PRIVILEGE_MAP values (-143, 'DROP ANY PROCEDURE');
  1640. insert into SYSTEM_PRIVILEGE_MAP values (-144, 'EXECUTE ANY PROCEDURE');
  1641. insert into SYSTEM_PRIVILEGE_MAP values (-151, 'CREATE TRIGGER');
  1642. insert into SYSTEM_PRIVILEGE_MAP values (-152, 'CREATE ANY TRIGGER');
  1643. insert into SYSTEM_PRIVILEGE_MAP values (-153, 'ALTER ANY TRIGGER');
  1644. insert into SYSTEM_PRIVILEGE_MAP values (-154, 'DROP ANY TRIGGER');
  1645. insert into SYSTEM_PRIVILEGE_MAP values (-155, 'TRUNCATE');
  1646. insert into SYSTEM_PRIVILEGE_MAP values (-160, 'CREATE PROFILE');
  1647. insert into SYSTEM_PRIVILEGE_MAP values (-161, 'ALTER PROFILE');
  1648. insert into SYSTEM_PRIVILEGE_MAP values (-162, 'DROP PROFILE');
  1649. insert into SYSTEM_PRIVILEGE_MAP values (-163, 'ALTER RESOURCE COST');
  1650. insert into SYSTEM_PRIVILEGE_MAP values (-165, 'ANALYZE ANY');
  1651. insert into SYSTEM_PRIVILEGE_MAP values (-167, 'GRANT ANY PRIVILEGE');
  1652. insert into SYSTEM_PRIVILEGE_MAP values (-172, 'CREATE SNAPSHOT');
  1653. insert into SYSTEM_PRIVILEGE_MAP values (-173, 'CREATE ANY SNAPSHOT');
  1654. insert into SYSTEM_PRIVILEGE_MAP values (-174, 'ALTER ANY SNAPSHOT');
  1655. insert into SYSTEM_PRIVILEGE_MAP values (-175, 'DROP ANY SNAPSHOT');
  1656. insert into SYSTEM_PRIVILEGE_MAP values (-197, 'WRITEDOWN');
  1657. insert into SYSTEM_PRIVILEGE_MAP values (-198, 'READUP');
  1658. insert into SYSTEM_PRIVILEGE_MAP values (-199, 'WRITEUP');
  1659. create unique index I_SYSTEM_PRIVILEGE_MAP
  1660.         on SYSTEM_PRIVILEGE_MAP (PRIVILEGE, NAME)
  1661. /
  1662. drop public synonym SYSTEM_PRIVILEGE_MAP
  1663. /
  1664. create public synonym SYSTEM_PRIVILEGE_MAP for SYSTEM_PRIVILEGE_MAP
  1665. /
  1666. grant select on SYSTEM_PRIVILEGE_MAP to public with grant option
  1667. /
  1668. #
  1669. #  TABLE_PRIVILEGE_MAP maps a table privilege (auditing option) number
  1670. #  to the name.
  1671. #
  1672. create table TABLE_PRIVILEGE_MAP (
  1673.         PRIVILEGE       number not null,
  1674.         NAME            char(40) not null)
  1675. /
  1676. comment on table TABLE_PRIVILEGE_MAP is
  1677. 'Description table for privilege (auditing option) type codes.  Maps privilege (auditing option) type numbers to type names'
  1678. /
  1679. comment on column TABLE_PRIVILEGE_MAP.PRIVILEGE is
  1680. 'Numeric privilege (auditing option) type code'
  1681. /
  1682. comment on column TABLE_PRIVILEGE_MAP.NAME is
  1683. 'Name of the type of privilege (auditing option)'
  1684. /
  1685. insert into TABLE_PRIVILEGE_MAP values (0, 'ALTER');
  1686. insert into TABLE_PRIVILEGE_MAP values (1, 'AUDIT');
  1687. insert into TABLE_PRIVILEGE_MAP values (2, 'COMMENT');
  1688. insert into TABLE_PRIVILEGE_MAP values (3, 'DELETE');
  1689. insert into TABLE_PRIVILEGE_MAP values (4, 'GRANT');
  1690. insert into TABLE_PRIVILEGE_MAP values (5, 'INDEX');
  1691. insert into TABLE_PRIVILEGE_MAP values (6, 'INSERT');
  1692. insert into TABLE_PRIVILEGE_MAP values (7, 'LOCK');
  1693. insert into TABLE_PRIVILEGE_MAP values (8, 'RENAME');
  1694. insert into TABLE_PRIVILEGE_MAP values (9, 'SELECT');
  1695. insert into TABLE_PRIVILEGE_MAP values (10, 'UPDATE');
  1696. insert into TABLE_PRIVILEGE_MAP values (11, 'REFERENCES');
  1697. insert into TABLE_PRIVILEGE_MAP values (12, 'EXECUTE');
  1698. create unique index I_TABLE_PRIVILEGE_MAP
  1699.         on TABLE_PRIVILEGE_MAP (PRIVILEGE, NAME)
  1700. /
  1701. drop public synonym TABLE_PRIVILEGE_MAP
  1702. /
  1703. create public synonym TABLE_PRIVILEGE_MAP for TABLE_PRIVILEGE_MAP
  1704. /
  1705. grant select on TABLE_PRIVILEGE_MAP to public with grant option
  1706. /
  1707. #
  1708. #  FAMILY "OPTION MAP"
  1709. #       Tables for mapping auditing option numbers to auditing
  1710. #  the name.
  1711. #
  1712. #  STMT_AUDIT_OPTION_MAP maps a auditing option number to the name.
  1713. #
  1714. create table STMT_AUDIT_OPTION_MAP (
  1715.         OPTION#         number not null,
  1716.         NAME            char(40) not null)
  1717. /
  1718. comment on table STMT_AUDIT_OPTION_MAP is
  1719. 'Description table for auditing option type codes.  Maps auditing option type numbers to type names'
  1720. /
  1721. comment on column STMT_AUDIT_OPTION_MAP.OPTION# is
  1722. 'Numeric auditing option type code'
  1723. /
  1724. comment on column STMT_AUDIT_OPTION_MAP.NAME is
  1725. 'Name of the type of auditing option'
  1726. /
  1727.  
  1728. insert into STMT_AUDIT_OPTION_MAP values (  3, 'ALTER SYSTEM');
  1729. insert into STMT_AUDIT_OPTION_MAP values (  4, 'SYSTEM AUDIT');
  1730. insert into STMT_AUDIT_OPTION_MAP values (  5, 'CREATE SESSION');
  1731. insert into STMT_AUDIT_OPTION_MAP values (  6, 'ALTER SESSION');
  1732. insert into STMT_AUDIT_OPTION_MAP values (  7, 'RESTRICTED SESSION');
  1733. insert into STMT_AUDIT_OPTION_MAP values (  8, 'TABLE');
  1734. insert into STMT_AUDIT_OPTION_MAP values (  9, 'CLUSTER');
  1735. insert into STMT_AUDIT_OPTION_MAP values ( 10, 'CREATE TABLESPACE');
  1736. insert into STMT_AUDIT_OPTION_MAP values ( 11, 'ALTER TABLESPACE');
  1737. insert into STMT_AUDIT_OPTION_MAP values ( 12, 'MANAGE TABLESPACE');
  1738. insert into STMT_AUDIT_OPTION_MAP values ( 13, 'DROP TABLESPACE');
  1739. insert into STMT_AUDIT_OPTION_MAP values ( 14, 'TABLESPACE');
  1740. insert into STMT_AUDIT_OPTION_MAP values ( 15, 'UNLIMITED TABLESPACE');
  1741. insert into STMT_AUDIT_OPTION_MAP values ( 16, 'USER');
  1742. insert into STMT_AUDIT_OPTION_MAP values ( 17, 'ROLLBACK SEGMENT');
  1743. insert into STMT_AUDIT_OPTION_MAP values ( 18, 'CLASS');
  1744. insert into STMT_AUDIT_OPTION_MAP values ( 19, 'INDEX');
  1745. insert into STMT_AUDIT_OPTION_MAP values ( 20, 'CREATE USER');
  1746. insert into STMT_AUDIT_OPTION_MAP values ( 21, 'BECOME USER');
  1747. insert into STMT_AUDIT_OPTION_MAP values ( 22, 'ALTER USER');
  1748. insert into STMT_AUDIT_OPTION_MAP values ( 23, 'DROP USER');
  1749. insert into STMT_AUDIT_OPTION_MAP values ( 24, 'SYNONYM');
  1750. insert into STMT_AUDIT_OPTION_MAP values ( 25, 'PUBLIC SYNONYM');
  1751. insert into STMT_AUDIT_OPTION_MAP values ( 26, 'VIEW');
  1752. insert into STMT_AUDIT_OPTION_MAP values ( 27, 'SEQUENCE');
  1753. insert into STMT_AUDIT_OPTION_MAP values ( 28, 'DATABASE LINK');
  1754. insert into STMT_AUDIT_OPTION_MAP values ( 29, 'PUBLIC DATABASE LINK');
  1755. insert into STMT_AUDIT_OPTION_MAP values ( 30, 'CREATE ROLLBACK SEGMENT');
  1756. insert into STMT_AUDIT_OPTION_MAP values ( 31, 'ALTER ROLLBACK SEGMENT');
  1757. insert into STMT_AUDIT_OPTION_MAP values ( 32, 'DROP ROLLBACK SEGMENT');
  1758. insert into STMT_AUDIT_OPTION_MAP values ( 33, 'ROLE');
  1759. insert into STMT_AUDIT_OPTION_MAP values ( 34, 'SET');
  1760. insert into STMT_AUDIT_OPTION_MAP values ( 35, 'PROCEDURE');
  1761. insert into STMT_AUDIT_OPTION_MAP values ( 36, 'TRIGGER');
  1762. insert into STMT_AUDIT_OPTION_MAP values ( 40, 'CREATE TABLE');
  1763. insert into STMT_AUDIT_OPTION_MAP values ( 41, 'CREATE ANY TABLE');
  1764. insert into STMT_AUDIT_OPTION_MAP values ( 42, 'ALTER ANY TABLE');
  1765. insert into STMT_AUDIT_OPTION_MAP values ( 43, 'BACKUP ANY TABLE');
  1766. insert into STMT_AUDIT_OPTION_MAP values ( 44, 'DROP ANY TABLE');
  1767. insert into STMT_AUDIT_OPTION_MAP values ( 45, 'LOCK ANY TABLE');
  1768. insert into STMT_AUDIT_OPTION_MAP values ( 46, 'COMMENT ANY TABLE');
  1769. insert into STMT_AUDIT_OPTION_MAP values ( 47, 'SELECT ANY TABLE');
  1770. insert into STMT_AUDIT_OPTION_MAP values ( 48, 'INSERT ANY TABLE');
  1771. insert into STMT_AUDIT_OPTION_MAP values ( 49, 'UPDATE ANY TABLE');
  1772. insert into STMT_AUDIT_OPTION_MAP values ( 50, 'DELETE ANY TABLE');
  1773. insert into STMT_AUDIT_OPTION_MAP values ( 53, 'GRANT ANY TABLE');
  1774. insert into STMT_AUDIT_OPTION_MAP values ( 60, 'CREATE CLUSTER');
  1775. insert into STMT_AUDIT_OPTION_MAP values ( 61, 'CREATE ANY CLUSTER');
  1776. insert into STMT_AUDIT_OPTION_MAP values ( 62, 'ALTER ANY CLUSTER');
  1777. insert into STMT_AUDIT_OPTION_MAP values ( 63, 'DROP ANY CLUSTER');
  1778. insert into STMT_AUDIT_OPTION_MAP values ( 70, 'CREATE INDEX');
  1779. insert into STMT_AUDIT_OPTION_MAP values ( 71, 'CREATE ANY INDEX');
  1780. insert into STMT_AUDIT_OPTION_MAP values ( 72, 'ALTER ANY INDEX');
  1781. insert into STMT_AUDIT_OPTION_MAP values ( 73, 'DROP ANY INDEX');
  1782. insert into STMT_AUDIT_OPTION_MAP values ( 80, 'CREATE SYNONYM');
  1783. insert into STMT_AUDIT_OPTION_MAP values ( 81, 'CREATE ANY SYNONYM');
  1784. insert into STMT_AUDIT_OPTION_MAP values ( 82, 'DROP ANY SYNONYM');
  1785. insert into STMT_AUDIT_OPTION_MAP values ( 85, 'CREATE PUBLIC SYNONYM');
  1786. insert into STMT_AUDIT_OPTION_MAP values ( 86, 'DROP PUBLIC SYNONYM');
  1787. insert into STMT_AUDIT_OPTION_MAP values ( 90, 'CREATE VIEW');
  1788. insert into STMT_AUDIT_OPTION_MAP values ( 91, 'CREATE ANY VIEW');
  1789. insert into STMT_AUDIT_OPTION_MAP values ( 92, 'DROP ANY VIEW');
  1790. insert into STMT_AUDIT_OPTION_MAP values (100, 'GRANT ANY VIEW');
  1791. insert into STMT_AUDIT_OPTION_MAP values (105, 'CREATE SEQUENCE');
  1792. insert into STMT_AUDIT_OPTION_MAP values (106, 'CREATE ANY SEQUENCE');
  1793. insert into STMT_AUDIT_OPTION_MAP values (107, 'ALTER ANY SEQUENCE');
  1794. insert into STMT_AUDIT_OPTION_MAP values (108, 'DROP ANY SEQUENCE');
  1795. insert into STMT_AUDIT_OPTION_MAP values (109, 'SELECT ANY SEQUENCE');
  1796. insert into STMT_AUDIT_OPTION_MAP values (111, 'GRANT SEQUENCE');
  1797. insert into STMT_AUDIT_OPTION_MAP values (115, 'CREATE DATABASE LINK');
  1798. insert into STMT_AUDIT_OPTION_MAP values (120, 'CREATE PUBLIC DATABASE LINK');
  1799. insert into STMT_AUDIT_OPTION_MAP values (121, 'DROP PUBLIC DATABASE LINK');
  1800. insert into STMT_AUDIT_OPTION_MAP values (125, 'CREATE ROLE');
  1801. insert into STMT_AUDIT_OPTION_MAP values (126, 'DROP ANY ROLE');
  1802. insert into STMT_AUDIT_OPTION_MAP values (127, 'GRANT ANY ROLE');
  1803. insert into STMT_AUDIT_OPTION_MAP values (128, 'ALTER ANY ROLE');
  1804. insert into STMT_AUDIT_OPTION_MAP values (130, 'AUDIT ANY');
  1805. insert into STMT_AUDIT_OPTION_MAP values (131, 'SYSTEM GRANT');
  1806. insert into STMT_AUDIT_OPTION_MAP values (140, 'CREATE PROCEDURE');
  1807. insert into STMT_AUDIT_OPTION_MAP values (141, 'CREATE ANY PROCEDURE');
  1808. insert into STMT_AUDIT_OPTION_MAP values (142, 'ALTER ANY PROCEDURE');
  1809. insert into STMT_AUDIT_OPTION_MAP values (143, 'DROP ANY PROCEDURE');
  1810. insert into STMT_AUDIT_OPTION_MAP values (144, 'EXECUTE ANY PROCEDURE');
  1811. insert into STMT_AUDIT_OPTION_MAP values (145, 'GRANT ANY PROCEDURE');
  1812. insert into STMT_AUDIT_OPTION_MAP values (146, 'EXECUTE PROCEDURE');
  1813. insert into STMT_AUDIT_OPTION_MAP values (147, 'GRANT PROCEDURE');
  1814. insert into STMT_AUDIT_OPTION_MAP values (151, 'CREATE TRIGGER');
  1815. insert into STMT_AUDIT_OPTION_MAP values (152, 'CREATE ANY TRIGGER');
  1816. insert into STMT_AUDIT_OPTION_MAP values (153, 'ALTER ANY TRIGGER');
  1817. insert into STMT_AUDIT_OPTION_MAP values (154, 'DROP ANY TRIGGER');
  1818. insert into STMT_AUDIT_OPTION_MAP values (155, 'TRUNCATE');
  1819. insert into STMT_AUDIT_OPTION_MAP values (160, 'CREATE PROFILE');
  1820. insert into STMT_AUDIT_OPTION_MAP values (161, 'ALTER PROFILE');
  1821. insert into STMT_AUDIT_OPTION_MAP values (162, 'DROP PROFILE');
  1822. insert into STMT_AUDIT_OPTION_MAP values (163, 'ALTER RESOURCE COST');
  1823. insert into STMT_AUDIT_OPTION_MAP values (165, 'ANALYZE ANY');
  1824. insert into STMT_AUDIT_OPTION_MAP values (170, 'CREATE SNAPSHOT');
  1825. insert into STMT_AUDIT_OPTION_MAP values (171, 'ALTER SNAPSHOT');
  1826. insert into STMT_AUDIT_OPTION_MAP values (172, 'DROP SNAPSHOT');
  1827. insert into STMT_AUDIT_OPTION_MAP values (173, 'CREATE ANY SNAPSHOT');
  1828. insert into STMT_AUDIT_OPTION_MAP values (174, 'ALTER ANY SNAPSHOT');
  1829. insert into STMT_AUDIT_OPTION_MAP values (175, 'DROP ANY SNAPSHOT');
  1830. insert into STMT_AUDIT_OPTION_MAP values (176, 'CREATE CLASS');
  1831. insert into STMT_AUDIT_OPTION_MAP values (177, 'CREATE ANY CLASS');
  1832. insert into STMT_AUDIT_OPTION_MAP values (178, 'ALTER ANY CLASS');
  1833. insert into STMT_AUDIT_OPTION_MAP values (179, 'DROP ANY CLASS');
  1834. insert into STMT_AUDIT_OPTION_MAP values (180, 'LOCK ANY CLASS');
  1835. insert into STMT_AUDIT_OPTION_MAP values (181, 'COMMENT ANY CLASS');
  1836. insert into STMT_AUDIT_OPTION_MAP values (182, 'GRANT ANY CLASS');
  1837. insert into STMT_AUDIT_OPTION_MAP values (183, 'CREATE SET');
  1838. insert into STMT_AUDIT_OPTION_MAP values (184, 'CREATE ANY SET');
  1839. insert into STMT_AUDIT_OPTION_MAP values (185, 'ALTER ANY SET');
  1840. insert into STMT_AUDIT_OPTION_MAP values (186, 'BACKUP ANY SET');
  1841. insert into STMT_AUDIT_OPTION_MAP values (187, 'DROP ANY SET');
  1842. insert into STMT_AUDIT_OPTION_MAP values (188, 'LOCK ANY SET');
  1843. insert into STMT_AUDIT_OPTION_MAP values (189, 'SELECT ANY SET');
  1844. insert into STMT_AUDIT_OPTION_MAP values (190, 'INSERT ANY SET');
  1845. insert into STMT_AUDIT_OPTION_MAP values (191, 'UPDATE ANY SET');
  1846. insert into STMT_AUDIT_OPTION_MAP values (192, 'DELETE ANY SET');
  1847. insert into STMT_AUDIT_OPTION_MAP values (193, 'GRANT ANY SET');
  1848. insert into STMT_AUDIT_OPTION_MAP values (197, 'READUP');
  1849. insert into STMT_AUDIT_OPTION_MAP values (198, 'WRITEDOWN');
  1850. insert into STMT_AUDIT_OPTION_MAP values (199, 'WRITEUP');
  1851. insert into STMT_AUDIT_OPTION_MAP values ( 77, 'NOT EXISTS');
  1852. insert into STMT_AUDIT_OPTION_MAP values ( 87, 'EXISTS');
  1853. insert into STMT_AUDIT_OPTION_MAP values ( 54, 'ALTER TABLE');
  1854. insert into STMT_AUDIT_OPTION_MAP values ( 55, 'BACKUP TABLE');
  1855. insert into STMT_AUDIT_OPTION_MAP values ( 56, 'DROP TABLE');
  1856. insert into STMT_AUDIT_OPTION_MAP values ( 57, 'LOCK TABLE');
  1857. insert into STMT_AUDIT_OPTION_MAP values ( 58, 'COMMENT TABLE');
  1858. insert into STMT_AUDIT_OPTION_MAP values ( 65, 'SELECT TABLE');
  1859. insert into STMT_AUDIT_OPTION_MAP values ( 66, 'INSERT TABLE');
  1860. insert into STMT_AUDIT_OPTION_MAP values ( 67, 'UPDATE TABLE');
  1861. insert into STMT_AUDIT_OPTION_MAP values ( 68, 'DELETE TABLE');
  1862. insert into STMT_AUDIT_OPTION_MAP values ( 69, 'GRANT TABLE');
  1863. insert into STMT_AUDIT_OPTION_MAP values (103, 'ALTER SEQUENCE');
  1864. insert into STMT_AUDIT_OPTION_MAP values (104, 'SELECT SEQUENCE');
  1865. create unique index I_STMT_AUDIT_OPTION_MAP
  1866.         on STMT_AUDIT_OPTION_MAP (OPTION#, NAME)
  1867. /
  1868. drop public synonym STMT_AUDIT_OPTION_MAP
  1869. /
  1870. create public synonym  STMT_AUDIT_OPTION_MAP for STMT_AUDIT_OPTION_MAP
  1871. /
  1872. grant select on STMT_AUDIT_OPTION_MAP to public
  1873. /
  1874. create table uet$                                       /* used extent table */
  1875. ( segfile#      number not null,               /* segment header file number */
  1876.   segblock#     number not null,              /* segment header block number */
  1877.   ext#          number not null,         /* extent number within the segment */
  1878.   ts#           number not null,        /* tablespace containing this extent */
  1879.   file#         number not null,              /* file containing this extent */
  1880.   block#        number not null,              /* starting dba of this extent */
  1881.   length        number not null)          /* length in blocks of this extent */
  1882. cluster c_file#_block#(segfile#, segblock#)
  1883. /
  1884. create table seg$                                           /* segment table */
  1885. ( file#         number not null,               /* segment header file number */
  1886.   block#        number not null,              /* segment header block number */
  1887.   type          number not null,                /* segment type (see KTS.H): */
  1888.    /* 1 = UNDO, 2 = SAVE UNDO, 3 = TEMPORARY, 4 = CACHE, 5 = DATA, 6 = INDEX */
  1889.   ts#           number not null,       /* tablespace containing this segment */
  1890.   blocks        number not null,       /* blocks allocated to segment so far */
  1891.   extents       number not null,      /* extents allocated to segment so far */
  1892.   iniexts       number not null,                      /* initial extent size */
  1893.   minexts       number not null,                /* minimum number of extents */
  1894.   maxexts       number not null,                /* maximum number of extents */
  1895.   extsize       number not null,                 /* initial next extent size */
  1896.   extpct        number not null,                    /* percent size increase */
  1897.   user#         number not null,               /* user who owns this segment */
  1898.   lists         number,                        /* freelists for this segment */
  1899.   groups        number)                  /* freelist groups for this segment */
  1900. cluster c_file#_block#(file#, block#)
  1901. /
  1902.  
  1903. #
  1904. # m_convert
  1905. #
  1906. insert into tab$ select obj#, ts#, file#, block#, clu#, tab#, cols, clucols,
  1907.    pctfree$, pctused$, initrans, maxtrans, modified,
  1908.    substr (audit$, 1, 22) || '----',
  1909.    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL from sys.tab$;
  1910. insert into clu$ select obj#, ts#, file#, block#, cols, pctfree$, pctused$,
  1911.    initrans, maxtrans, size$, hashfunc, 0, 0, 0, 0, 0, 0, 0, 0, 0
  1912.    from sys.clu$;
  1913. insert into undo$ select us#, name, user#, file#, block#, scnbas, scnwrp,
  1914.    xactsqn, undosqn, NULL, status$ from sys.undo$;
  1915. insert into ts$ select ts#, name, owner#, online$, undofile#, undoblock#,
  1916.    blocksize, inc#, 0, 0, dflminext, dflmaxext, dflinit, dflincr, dflextpct
  1917.    from sys.ts$;
  1918. #^ set_clean_offline()
  1919. insert into file$ select * from sys.file$;
  1920. insert into ind$ select obj#, ts#, file#, block#, bo#, cols, pctfree$,
  1921.    initrans, maxtrans, compress$, unique$,
  1922.    0, 0, 0, 0, 0, 0, 0, 0 from sys.ind$;
  1923. insert into icol$ select * from sys.icol$;
  1924. insert into col$ select obj#, col#, segcol#, segcollength, offset, name,
  1925.    type#, length, fixedstorage, precision, scale, null$, 0,
  1926.    lowval, hival, deflength, NULL, 0, 0 from sys.col$;
  1927. #^ copy_long (sys, col$, default$, migrate, col$, default$, obj#, col#)
  1928. insert into user$ select user#, name, 1, password, datats#, tempts#, ctime,
  1929.    ptime, 0, audit$, 1, 0, 0 from sys.user$;
  1930. insert into con$ select owner#, name, con#, NULL from sys.con$;
  1931. insert into cdef$ select con#, obj#, cols, type, robj#, rcon#, rrules, NULL,
  1932.    NULL, NULL, condlength, NULL, NULL from sys.cdef$;
  1933. #^ copy_long (sys, cdef$, condition, migrate, cdef$, condition, con#)
  1934.  
  1935. #
  1936. # by default all constraints in cdef$ are disabled (enabled = null).
  1937. # however, columns in v6 that are not null should be enabled (103146 & 103233)
  1938. #
  1939. update cdef$ set cdef$.enabled = 1 where cdef$.con# in
  1940.    (select col$.null$ from col$ where col$.null$ > 0);
  1941.  
  1942. insert into ccol$ select con#, obj#, col#, pos#, NULL from sys.ccol$;
  1943.  
  1944. insert into tsq$ select * from sys.tsq$;
  1945. insert into syn$ select * from sys.syn$;
  1946. # move synonym for dual to sys
  1947. update syn$ set owner = 'SYS' where owner = 'MIGRATE';
  1948. insert into view$ select obj#,
  1949.    '--' || substr (audit$, 3, 8) || '--' || substr (audit$, 13, 10) || '----',
  1950.    cols, textlength, NULL from sys.view$;
  1951. #^ copy_long (sys, view$, text, migrate, view$, text, obj#)
  1952. insert into seq$ select obj#, increment$, minvalue, maxvalue, cycle,
  1953.    order$, cache, highwater,
  1954.    substr (audit$, 1, 4) || '----' || substr (audit$, 9, 2) ||
  1955.      '--------' || substr (audit$, 19, 2) || '------'
  1956.    from sys.seq$;
  1957. insert into aud$ select sessionid, entryid, statement, timestamp, userid,
  1958.    userhost, terminal, action, returncode, obj$creator, obj$name,
  1959.    auth$privileges, auth$grantee, NULL, new$name, ses$actions, ses$tid,
  1960.    logoff$lread, logoff$pread, logoff$lwrite, logoff$dead, logoff$time,
  1961.    comment$text, NULL, 0, NULL, NULL, NULL from sys.aud$;
  1962. insert into link$ select owner#, upper (name) || '.WORLD',
  1963.                          ctime, host, userid, password from sys.link$;
  1964. insert into props$ select * from sys.props$;
  1965. #insert into props$ values('NLS_LANGUAGE','AMERICAN','Language');
  1966. #insert into props$ values('NLS_TERRITORY','AMERICA','Territory');
  1967. #insert into props$ values('NLS_CURRENCY','$','Local currency');
  1968. #insert into props$ values('NLS_ISO_CURRENCY','AMERICA','ISO currency');
  1969. #insert into props$ values('NLS_NUMERIC_CHARACTERS','.,','Numeric characters');
  1970. #insert into props$ values('NLS_DATE_FORMAT','DD-MON-YY','Date format');
  1971. #insert into props$ values('NLS_DATE_LANGUAGE','AMERICAN','Date language');
  1972. #insert into props$ values('NLS_CHARACTERSET','US7ASCII','Character set');
  1973. #insert into props$ values('NLS_SORT','BINARY','Linguistic definition');
  1974. insert into props$ values('GLOBAL_DB_NAME','CHANGE_ON_INSTALL.WORLD','Global database name');
  1975. insert into com$ select * from sys.com$;
  1976. insert into incexp select * from sys.incexp;
  1977. insert into incvid select * from sys.incvid;
  1978. insert into incfil select * from sys.incfil;
  1979.  
  1980. insert into "_default_auditing_options_"
  1981.    select * from sys."_default_auditing_options_";
  1982.  
  1983. insert into obj$ select obj#, owner#, name,
  1984.    decode (type, 1, 4, 3, 5, 1),
  1985.    type, ctime, mtime, mtime, 1, NULL, NULL from sys.obj$;
  1986.  
  1987.  
  1988. #
  1989. #  the following is from conv6to7.bsq
  1990. #
  1991.  
  1992. # Convert colauth$ and tabauth$ into objauth$
  1993. # tmpidx is use to sort and order the rows of tabauth$.
  1994. #^ connect (maint, internal)
  1995. create index tmpidx on tabauth$(sequence#);
  1996. #^ connect (migrate, migrate)
  1997. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$)
  1998.   select obj#,grantor#,grantee#,0,object_grant.nextval,decode(alter$,3,1,null)
  1999.   from sys.tabauth$ where (alter$=2 or alter$=3) and sequence#>0
  2000. /
  2001. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$)
  2002.   select obj#,grantor#,grantee#,3,object_grant.nextval,decode(delete$,3,1,null)
  2003.   from sys.tabauth$ where (delete$=2 or delete$=3) and sequence#>0
  2004. /
  2005. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$)
  2006.   select obj#,grantor#,grantee#,5,object_grant.nextval,decode(index$,3,1,null)
  2007.   from sys.tabauth$ where (index$=2 or index$=3) and sequence#>0
  2008. /
  2009. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$)
  2010.   select obj#,grantor#,grantee#,6,object_grant.nextval,decode(insert$,3,1,null)
  2011.   from sys.tabauth$ where (insert$=2 or insert$=3) and sequence#>0
  2012. /
  2013. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$)
  2014.   select obj#,grantor#,grantee#,9,object_grant.nextval,decode(select$,3,1,null)
  2015.   from sys.tabauth$ where (select$=2 or select$=3) and sequence#>0
  2016. /
  2017. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$)
  2018.   select obj#,grantor#,grantee#,10,object_grant.nextval,decode(update$,3,1,null)
  2019.   from sys.tabauth$ where (update$=2 or update$=3) and sequence#>0
  2020. /
  2021. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$)
  2022.   select obj#,grantor#,grantee#,11,object_grant.nextval,decode(references$,1,null)
  2023.   from sys.tabauth$ where (references$=2 or references$=3) and sequence#>0
  2024. /
  2025. #^ connect (maint, internal)
  2026. drop index tmpidx;
  2027. create index tmpidx on colauth$(sequence#);
  2028. #^ connect (migrate, migrate)
  2029.  
  2030. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$,col#)
  2031.   select col$.obj#,grantor#,grantee#,10,object_grant.nextval,
  2032.   decode(update$,3,1,null),col#
  2033.   from sys.colauth$,sys.col$
  2034.   where col$.name=colauth$.name and col$.obj# = colauth$.obj#
  2035.     and (update$=2 or update$=3) and sequence#>0
  2036. /
  2037. insert into objauth$(obj#,grantor#,grantee#,privilege#,sequence#,option$,col#)
  2038.   select col$.obj#,grantor#,grantee#,10,object_grant.nextval,
  2039.   decode(references$,3,1,null),col#
  2040.   from sys.colauth$,sys.col$
  2041.   where col$.name=colauth$.name and col$.obj# = colauth$.obj#
  2042.     and (references$=2 or references$=3)
  2043.     and sequence#>0
  2044. /
  2045. #^ connect (maint, internal)
  2046. drop index tmpidx;
  2047. #^ connect (migrate, migrate)
  2048.  
  2049. # remove duplicate grants.
  2050. delete from objauth$ o where
  2051.         o.option$ is null and exists
  2052.         (select r.obj# from objauth$ r where
  2053.                 r.option$ = 1 and
  2054.                 o.obj# = r.obj# and o.grantor# = r.grantor# and
  2055.                 o.grantee# = r.grantee# and o.privilege# = r.privilege#);
  2056.  
  2057. # Delete any un-needed grants
  2058. delete from objauth$ where obj# not in (select obj# from obj$);
  2059.  
  2060. # we need to create the index here after we insert into objauth above.
  2061. # the inserts will create duplicate entries in objauth which we have just
  2062. #   purged.  now we can create the unique index i_objauth1
  2063. #
  2064. create unique index i_objauth1 on
  2065.   objauth$(obj#, grantor#, grantee#, privilege#, col#)
  2066. /
  2067.  
  2068. # Create Connect, Resource and Dba roles
  2069. insert into user$ (user#, name, type, datats#, tempts#, ctime, resource$,
  2070.     defrole)
  2071.     select user#, 'CONNECT', 0, 0, 0, sysdate, 0, 1 from sys.user$
  2072.     where name = '_NEXT_USER';
  2073. insert into user$ (user#, name, type, datats#, tempts#, ctime, resource$,
  2074.     defrole)
  2075.     select user# + 1, 'RESOURCE', 0, 0, 0, sysdate, 0, 1 from sys.user$
  2076.     where name = '_NEXT_USER';
  2077. insert into user$ (user#, name, type, datats#, tempts#, ctime, resource$,
  2078.     defrole)
  2079.     select user# + 2, 'DBA', 0, 0, 0, sysdate, 0, 1 from sys.user$
  2080.     where name = '_NEXT_USER';
  2081. update user$ set user#=user#+3 where name='_NEXT_USER';
  2082.  
  2083. # Change Public to a role
  2084. update user$ set type=0 where name='PUBLIC'
  2085. /
  2086. # Convert user$ privileges into sysauth$ entries
  2087. insert into sysauth$(grantee#, privilege#, sequence#)
  2088.   select user#, -1, system_grant.nextval from sys.user$ where connect$=1
  2089.   and user#!=1
  2090. /
  2091. update sysauth$ set privilege#=(select user# from user$ where name='CONNECT')
  2092.   where privilege#=-1
  2093. /
  2094. insert into sysauth$(grantee#, privilege#, sequence#)
  2095.   select user#, -1, system_grant.nextval from sys.user$ where resource$=1
  2096.   and user#!=1
  2097. /
  2098. update sysauth$ set privilege#=(select user# from user$ where name='RESOURCE')
  2099.   where privilege#=-1
  2100. /
  2101. insert into sysauth$(grantee#, privilege#, sequence#)
  2102.   select user#, -1, system_grant.nextval from sys.user$ where dba$=1
  2103.   and user#!=1
  2104. /
  2105. update sysauth$ set privilege#=(select user# from user$ where name='DBA')
  2106.   where privilege#=-1
  2107. /
  2108. # Grant create sequence priv to anyone who had resource() on a tablespace
  2109. insert into sysauth$(grantee#,privilege#,sequence#)
  2110.   select tsq$.user#,-105,-1
  2111.   from sys.tsq$,sys.user$
  2112.   where tsq$.user#=user$.user# and maxblocks is null
  2113.     and user$.resource$!=0
  2114. /
  2115. update sysauth$ set sequence# = system_grant.nextval where sequence# = -1
  2116. /
  2117. # Grant each user who had v6 RESOURCE privilege the "unlimited tablespace"
  2118. # privilege.
  2119. #
  2120. insert into sysauth$(grantee#, privilege#, sequence#)
  2121.    select user#, -15, system_grant.nextval from sys.user$
  2122.    where resource$ = 1 and dba$ != 1;
  2123.  
  2124. # Grant each user who had v6 DBA privilege the "unlimited tablespace"
  2125. # privilege with the admin option.
  2126. #
  2127. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2128.    select user#, -15, system_grant.nextval, 1 from sys.user$ where dba$ = 1;
  2129.  
  2130. # Perform grants to Connect, Resource and Dba roles
  2131. insert into sysauth$(grantee#, privilege#, sequence#)
  2132.   values (-1, -5, system_grant.nextval)
  2133. /
  2134. insert into sysauth$(grantee#, privilege#, sequence#)
  2135.   values (-1, -6, system_grant.nextval)
  2136. /
  2137. insert into sysauth$(grantee#, privilege#, sequence#)
  2138.   values (-1, -80, system_grant.nextval)
  2139. /
  2140. insert into sysauth$(grantee#, privilege#, sequence#)
  2141.   values (-1, -90, system_grant.nextval)
  2142. /
  2143. insert into sysauth$(grantee#, privilege#, sequence#)
  2144.   values (-1, -115, system_grant.nextval)
  2145. /
  2146. insert into sysauth$(grantee#, privilege#, sequence#)
  2147.   values (-1, -40, system_grant.nextval)
  2148. /
  2149. insert into sysauth$(grantee#, privilege#, sequence#)
  2150.   values (-1, -60, system_grant.nextval)
  2151. /
  2152. insert into sysauth$(grantee#, privilege#, sequence#)
  2153.   values (-1, -105, system_grant.nextval)
  2154. /
  2155. update sysauth$ set grantee#=(select user# from user$ where name='CONNECT')
  2156.   where grantee#=-1
  2157. /
  2158. insert into sysauth$(grantee#, privilege#, sequence#)
  2159.   values (-1, -40, system_grant.nextval)
  2160. /
  2161. insert into sysauth$(grantee#, privilege#, sequence#)
  2162.   values (-1, -60, system_grant.nextval)
  2163. /
  2164. insert into sysauth$(grantee#, privilege#, sequence#)
  2165.   values (-1, -105, system_grant.nextval)
  2166. /
  2167. insert into sysauth$(grantee#, privilege#, sequence#)
  2168.   values (-1, -140, system_grant.nextval)
  2169. /
  2170. insert into sysauth$(grantee#, privilege#, sequence#)
  2171.   values (-1, -151, system_grant.nextval)
  2172. /
  2173. update sysauth$ set grantee#=(select user# from user$ where name='RESOURCE')
  2174.   where grantee#=-1
  2175. /
  2176. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2177.   values (-1, -3  ,system_grant.nextval, 1)
  2178. /
  2179. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2180.   values (-1, -4  ,system_grant.nextval, 1)
  2181. /
  2182. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2183.   values (-1, -5  ,system_grant.nextval, 1)
  2184. /
  2185. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2186.   values (-1, -6  ,system_grant.nextval, 1)
  2187. /
  2188. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2189.   values (-1, -7  ,system_grant.nextval, 1)
  2190. /
  2191. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2192.   values (-1, -10 ,system_grant.nextval, 1)
  2193. /
  2194. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2195.   values (-1, -11 ,system_grant.nextval, 1)
  2196. /
  2197. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2198.   values (-1, -12 ,system_grant.nextval, 1)
  2199. /
  2200. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2201.   values (-1, -13 ,system_grant.nextval, 1)
  2202. /
  2203. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2204.   values (-1, -20 ,system_grant.nextval, 1)
  2205. /
  2206. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2207.   values (-1, -21 ,system_grant.nextval, 1)
  2208. /
  2209. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2210.   values (-1, -22 ,system_grant.nextval, 1)
  2211. /
  2212. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2213.   values (-1, -23 ,system_grant.nextval, 1)
  2214. /
  2215. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2216.   values (-1, -30 ,system_grant.nextval, 1)
  2217. /
  2218. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2219.   values (-1, -31 ,system_grant.nextval, 1)
  2220. /
  2221. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2222.   values (-1, -32 ,system_grant.nextval, 1)
  2223. /
  2224. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2225.   values (-1, -40 ,system_grant.nextval, 1)
  2226. /
  2227. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2228.   values (-1, -41 ,system_grant.nextval, 1)
  2229. /
  2230. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2231.   values (-1, -42 ,system_grant.nextval, 1)
  2232. /
  2233. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2234.   values (-1, -43 ,system_grant.nextval, 1)
  2235. /
  2236. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2237.   values (-1, -44 ,system_grant.nextval, 1)
  2238. /
  2239. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2240.   values (-1, -45 ,system_grant.nextval, 1)
  2241. /
  2242. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2243.   values (-1, -46 ,system_grant.nextval, 1)
  2244. /
  2245. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2246.   values (-1, -47 ,system_grant.nextval, 1)
  2247. /
  2248. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2249.   values (-1, -48 ,system_grant.nextval, 1)
  2250. /
  2251. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2252.   values (-1, -49 ,system_grant.nextval, 1)
  2253. /
  2254. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2255.   values (-1, -50 ,system_grant.nextval, 1)
  2256. /
  2257. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2258.   values (-1, -60 ,system_grant.nextval, 1)
  2259. /
  2260. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2261.   values (-1, -61 ,system_grant.nextval, 1)
  2262. /
  2263. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2264.   values (-1, -62 ,system_grant.nextval, 1)
  2265. /
  2266. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2267.   values (-1, -63 ,system_grant.nextval, 1)
  2268. /
  2269. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2270.   values (-1, -71 ,system_grant.nextval, 1)
  2271. /
  2272. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2273.   values (-1, -72 ,system_grant.nextval, 1)
  2274. /
  2275. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2276.   values (-1, -73 ,system_grant.nextval, 1)
  2277. /
  2278. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2279.   values (-1, -80 ,system_grant.nextval, 1)
  2280. /
  2281. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2282.   values (-1, -81 ,system_grant.nextval, 1)
  2283. /
  2284. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2285.   values (-1, -82 ,system_grant.nextval, 1)
  2286. /
  2287. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2288.   values (-1, -85 ,system_grant.nextval, 1)
  2289. /
  2290. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2291.   values (-1, -86 ,system_grant.nextval, 1)
  2292. /
  2293. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2294.   values (-1, -90 ,system_grant.nextval, 1)
  2295. /
  2296. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2297.   values (-1, -91 ,system_grant.nextval, 1)
  2298. /
  2299. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2300.   values (-1, -92 ,system_grant.nextval, 1)
  2301. /
  2302. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2303.   values (-1, -105 ,system_grant.nextval, 1)
  2304. /
  2305. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2306.   values (-1, -106,system_grant.nextval, 1)
  2307. /
  2308. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2309.   values (-1, -107,system_grant.nextval, 1)
  2310. /
  2311. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2312.   values (-1, -108,system_grant.nextval, 1)
  2313. /
  2314. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2315.   values (-1, -109,system_grant.nextval, 1)
  2316. /
  2317. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2318.   values (-1, -115,system_grant.nextval, 1)
  2319. /
  2320. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2321.   values (-1, -120,system_grant.nextval, 1)
  2322. /
  2323. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2324.   values (-1, -121,system_grant.nextval, 1)
  2325. /
  2326. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2327.   values (-1, -125,system_grant.nextval, 1)
  2328. /
  2329. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2330.   values (-1, -126,system_grant.nextval, 1)
  2331. /
  2332. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2333.   values (-1, -127,system_grant.nextval, 1)
  2334. /
  2335. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2336.   values (-1, -128,system_grant.nextval, 1)
  2337. /
  2338. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2339.   values (-1, -130,system_grant.nextval, 1)
  2340. /
  2341. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2342.   values (-1, -131,system_grant.nextval, 1)
  2343. /
  2344. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2345.   values (-1, -135,system_grant.nextval, 1)
  2346. /
  2347. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2348.   values (-1, -138,system_grant.nextval, 1)
  2349. /
  2350. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2351.   values (-1, -139,system_grant.nextval, 1)
  2352. /
  2353. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2354.   values (-1, -140,system_grant.nextval, 1)
  2355. /
  2356. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2357.   values (-1, -141,system_grant.nextval, 1)
  2358. /
  2359. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2360.   values (-1, -142,system_grant.nextval, 1)
  2361. /
  2362. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2363.   values (-1, -143,system_grant.nextval, 1)
  2364. /
  2365. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2366.   values (-1, -144,system_grant.nextval, 1)
  2367. /
  2368. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2369.   values (-1, -151,system_grant.nextval, 1)
  2370. /
  2371. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2372.   values (-1, -152,system_grant.nextval, 1)
  2373. /
  2374. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2375.   values (-1, -153,system_grant.nextval, 1)
  2376. /
  2377. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2378.   values (-1, -154,system_grant.nextval, 1)
  2379. /
  2380. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2381.   values (-1, -160,system_grant.nextval, 1)
  2382. /
  2383. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2384.   values (-1, -161,system_grant.nextval, 1)
  2385. /
  2386. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2387.   values (-1, -162,system_grant.nextval, 1)
  2388. /
  2389. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2390.   values (-1, -163,system_grant.nextval, 1)
  2391. /
  2392. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2393.   values (-1, -165,system_grant.nextval, 1)
  2394. /
  2395. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2396.   values (-1, -167,system_grant.nextval, 1)
  2397. /
  2398. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2399.   values (-1, -170,system_grant.nextval, 1)
  2400. /
  2401. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2402.   values (-1, -171,system_grant.nextval, 1)
  2403. /
  2404. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2405.   values (-1, -172,system_grant.nextval, 1)
  2406. /
  2407. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2408.   values (-1, -173,system_grant.nextval, 1)
  2409. /
  2410. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2411.   values (-1, -174,system_grant.nextval, 1)
  2412. /
  2413. insert into sysauth$(grantee#, privilege#, sequence#, option$)
  2414.   values (-1, -175,system_grant.nextval, 1)
  2415. /
  2416. update sysauth$ set grantee#=(select user# from user$ where name='DBA')
  2417.   where grantee#=-1
  2418. /
  2419.  
  2420. # Add resource profiles
  2421. insert into resource_cost$ values (0, 0);
  2422. insert into resource_cost$ values (1, 0);
  2423. insert into resource_cost$ values (2, 0);
  2424. insert into resource_cost$ values (3, 0);
  2425. insert into resource_cost$ values (4, 0);
  2426. insert into resource_cost$ values (5, 0);
  2427. insert into resource_cost$ values (6, 0);
  2428. insert into resource_cost$ values (7, 0);
  2429. insert into resource_cost$ values (8, 0);
  2430. insert into resource_cost$ values (9, 0);
  2431.  
  2432. # under version six we can't ``create profile PUBLIC_DEFAULT''
  2433. # so we'll populate the tables ourselves
  2434. insert into profname$ values (0, 'DEFAULT');
  2435. #
  2436. insert into profile$ values (0, 0, 0, 2147483647);
  2437. insert into profile$ values (0, 1, 0, 2147483647);
  2438. insert into profile$ values (0, 2, 0, 2147483647);
  2439. insert into profile$ values (0, 3, 0, 2147483647);
  2440. insert into profile$ values (0, 4, 0, 2147483647);
  2441. insert into profile$ values (0, 5, 0, 2147483647);
  2442. insert into profile$ values (0, 6, 0, 2147483647);
  2443. insert into profile$ values (0, 7, 0, 2147483647);
  2444. insert into profile$ values (0, 8, 0, 2147483647);
  2445. insert into profile$ values (0, 9, 0, 0);
  2446.  
  2447. #
  2448. # m_bootstrap
  2449. #
  2450. insert into bootstrap$ values (1, 0, '7.0.7.0.0');
  2451.  
  2452. insert into bootstrap$ select 2, 0,
  2453.    'create rollback segment system storage ( initial ' ||
  2454.       seg$.iniexts * ts$.blocksize ||
  2455.    ' next ' || seg$.extsize * ts$.blocksize ||
  2456.    ' minextents ' || seg$.minexts ||
  2457.    ' maxextents ' || seg$.maxexts ||
  2458.    ' objno 0' ||
  2459.    ' extents ( file ' || seg$.file# ||
  2460.    ' block ' || seg$.block# || '))'
  2461.    from sys.seg$, sys.undo$, sys.ts$
  2462.    where seg$.file# = undo$.file# and seg$.block# = undo$.block# and
  2463.          undo$.name = 'SYSTEM' and ts$.ts# = 0;
  2464.  
  2465. insert into bootstrap$ select 3, clu$.obj#,
  2466.    'create cluster c_obj# (obj# number)' ||
  2467.    ' pctfree ' || clu$.pctfree$ ||
  2468.    ' pctused ' || clu$.pctused$ ||
  2469.    ' initrans ' || clu$.initrans ||
  2470.    ' maxtrans ' || clu$.maxtrans ||
  2471.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2472.    ' next ' || seg$.extsize * ts$.blocksize ||
  2473.    ' minextents ' || seg$.minexts ||
  2474.    ' maxextents ' || seg$.maxexts ||
  2475.    ' pctincrease ' || seg$.extpct ||
  2476.    ' objno ' || clu$.obj# ||
  2477.    ' extents ( file ' || seg$.file# ||
  2478.    ' block ' || seg$.block# || '))' ||
  2479.    ' size ' || clu$.size$
  2480.    from sys.clu$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2481.    where seg$.file# = clu$.file# and seg$.block# = clu$.block# and
  2482.       clu$.obj# = obj$.obj# and obj$.name = 'C_OBJ#' and ts$.ts# = 0 and
  2483.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2484.  
  2485. insert into bootstrap$ select 4, ind$.obj#,
  2486.    'create index i_obj# on cluster c_obj#' ||
  2487.    ' pctfree ' || ind$.pctfree$ ||
  2488.    ' initrans ' || ind$.initrans ||
  2489.    ' maxtrans ' || ind$.maxtrans ||
  2490.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2491.    ' next ' || seg$.extsize * ts$.blocksize ||
  2492.    ' minextents ' || seg$.minexts ||
  2493.    ' maxextents ' || seg$.maxexts ||
  2494.    ' pctincrease ' || seg$.extpct ||
  2495.    ' objno ' || ind$.obj# ||
  2496.    ' extents ( file ' || seg$.file# ||
  2497.    ' block ' || seg$.block# || '))'
  2498.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2499.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2500.       ind$.obj# = obj$.obj# and obj$.name = 'I_OBJ#' and ts$.ts# = 0 and
  2501.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2502.  
  2503. #^ create_table_clu(5, tab$, "c_obj#(obj#)",
  2504.     "create table tab$
  2505.      (obj#     number not null,
  2506.       ts#      number not null,
  2507.       file#    number not null,
  2508.       block#   number not null,
  2509.       clu#     number,
  2510.       tab#     number,
  2511.       cols     number not null,
  2512.       clucols  number,
  2513.       pctfree$ number not null,
  2514.       pctused$ number not null,
  2515.       initrans number not null,
  2516.       maxtrans number not null,
  2517.       modified number not null,
  2518.       audit$   varchar2(32) not null,
  2519.       rowcnt   number,
  2520.       blkcnt   number,
  2521.       empcnt   number,
  2522.       avgspc   number,
  2523.       chncnt   number,
  2524.       avgrln   number,
  2525.       spare1   number,
  2526.       spare2   number)")
  2527.  
  2528. insert into bootstrap$ select 6, ind$.obj#,
  2529.    'create index i_tab1 on tab$(clu#)' ||
  2530.    ' pctfree ' || ind$.pctfree$ ||
  2531.    ' initrans ' || ind$.initrans ||
  2532.    ' maxtrans ' || ind$.maxtrans ||
  2533.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2534.    ' next ' || seg$.extsize * ts$.blocksize ||
  2535.    ' minextents ' || seg$.minexts ||
  2536.    ' maxextents ' || seg$.maxexts ||
  2537.    ' pctincrease ' || seg$.extpct ||
  2538.    ' objno ' || ind$.obj# ||
  2539.    ' extents ( file ' || seg$.file# ||
  2540.    ' block ' || seg$.block# || '))'
  2541.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2542.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2543.       ind$.obj# = obj$.obj# and obj$.name = 'I_TAB1' and ts$.ts# = 0 and
  2544.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2545.  
  2546. #^ create_table_clu(7, clu$, "c_obj#(obj#)",
  2547.    "create table clu$
  2548.     (obj#     number not null,
  2549.      ts#      number not null,
  2550.      file#    number not null,
  2551.      block#   number not null,
  2552.      cols     number not null,
  2553.      pctfree$ number not null,
  2554.      pctused$ number not null,
  2555.      initrans number not null,
  2556.      maxtrans number not null,
  2557.      size$    number,
  2558.      hashfunc char (30),
  2559.      hashkeys number,
  2560.      func     number,
  2561.      extind   number,
  2562.      spare4   number,
  2563.      spare5   number,
  2564.      spare6   number,
  2565.      spare7   number,
  2566.      spare8   number,
  2567.      spare9   number)")
  2568.  
  2569. insert into bootstrap$ select 8, clu$.obj#,
  2570.    'create cluster c_ts# (ts# number)' ||
  2571.    ' pctfree ' || clu$.pctfree$ ||
  2572.    ' pctused ' || clu$.pctused$ ||
  2573.    ' initrans ' || clu$.initrans ||
  2574.    ' maxtrans ' || clu$.maxtrans ||
  2575.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2576.    ' next ' || seg$.extsize * ts$.blocksize ||
  2577.    ' minextents ' || seg$.minexts ||
  2578.    ' maxextents 99' ||
  2579.    ' pctincrease ' || seg$.extpct ||
  2580.    ' objno ' || clu$.obj# ||
  2581.    ' extents ( file ' || seg$.file# ||
  2582.    ' block ' || seg$.block# || '))'
  2583.    from sys.clu$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2584.    where seg$.file# = clu$.file# and seg$.block# = clu$.block# and
  2585.       clu$.obj# = obj$.obj# and obj$.name = 'C_TS#' and ts$.ts# = 0 and
  2586.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2587.  
  2588. insert into bootstrap$ select 9, ind$.obj#,
  2589.    'create index i_ts# on cluster c_ts#' ||
  2590.    ' pctfree ' || ind$.pctfree$ ||
  2591.    ' initrans ' || ind$.initrans ||
  2592.    ' maxtrans ' || ind$.maxtrans ||
  2593.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2594.    ' next ' || seg$.extsize * ts$.blocksize ||
  2595.    ' minextents ' || seg$.minexts ||
  2596.    ' maxextents 99' ||
  2597.    ' pctincrease ' || seg$.extpct ||
  2598.    ' objno ' || ind$.obj# ||
  2599.    ' extents ( file ' || seg$.file# ||
  2600.    ' block ' || seg$.block# || '))'
  2601.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2602.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2603.       ind$.obj# = obj$.obj# and obj$.name = 'I_TS#' and ts$.ts# = 0 and
  2604.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2605.  
  2606. insert into bootstrap$ select 10, clu$.obj#,
  2607.    'create cluster c_file#_block# (segfile# number, segblock# number)' ||
  2608.    ' pctfree ' || clu$.pctfree$ ||
  2609.    ' pctused ' || clu$.pctused$ ||
  2610.    ' initrans ' || clu$.initrans ||
  2611.    ' maxtrans ' || clu$.maxtrans ||
  2612.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2613.    ' next ' || seg$.extsize * ts$.blocksize ||
  2614.    ' minextents ' || seg$.minexts ||
  2615.    ' maxextents 99' ||
  2616.    ' pctincrease ' || seg$.extpct ||
  2617.    ' objno ' || clu$.obj# ||
  2618.    ' extents ( file ' || seg$.file# ||
  2619.    ' block ' || seg$.block# || '))' ||
  2620.    ' size ' || clu$.size$
  2621.    from sys.clu$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2622.    where seg$.file# = clu$.file# and seg$.block# = clu$.block# and
  2623.       clu$.obj# = obj$.obj# and obj$.name = 'C_FILE#_BLOCK#' and
  2624.       ts$.ts# = 0 and obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2625.  
  2626. insert into bootstrap$ select 11, ind$.obj#,
  2627.    'create index i_file#_block# on cluster c_file#_block#' ||
  2628.    ' pctfree ' || ind$.pctfree$ ||
  2629.    ' initrans ' || ind$.initrans ||
  2630.    ' maxtrans ' || ind$.maxtrans ||
  2631.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2632.    ' next ' || seg$.extsize * ts$.blocksize ||
  2633.    ' minextents ' || seg$.minexts ||
  2634.    ' maxextents 99' ||
  2635.    ' pctincrease ' || seg$.extpct ||
  2636.    ' objno ' || ind$.obj# ||
  2637.    ' extents ( file ' || seg$.file# ||
  2638.    ' block ' || seg$.block# || '))'
  2639.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2640.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2641.       ind$.obj# = obj$.obj# and obj$.name = 'I_FILE#_BLOCK#' and
  2642.       ts$.ts# = 0 and obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2643.  
  2644.  
  2645. insert into bootstrap$ select 12, clu$.obj#,
  2646.    'create cluster c_user# (user# number)' ||
  2647.    ' pctfree ' || clu$.pctfree$ ||
  2648.    ' pctused ' || clu$.pctused$ ||
  2649.    ' initrans ' || clu$.initrans ||
  2650.    ' maxtrans ' || clu$.maxtrans ||
  2651.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2652.    ' next ' || seg$.extsize * ts$.blocksize ||
  2653.    ' minextents ' || seg$.minexts ||
  2654.    ' maxextents ' || seg$.maxexts ||
  2655.    ' pctincrease ' || seg$.extpct ||
  2656.    ' objno ' || clu$.obj# ||
  2657.    ' extents ( file ' || seg$.file# ||
  2658.    ' block ' || seg$.block# || '))' ||
  2659.    ' size ' || clu$.size$
  2660.    from sys.clu$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2661.    where seg$.file# = clu$.file# and seg$.block# = clu$.block# and
  2662.       clu$.obj# = obj$.obj# and obj$.name = 'C_USER#' and
  2663.       ts$.ts# = 0 and obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2664.  
  2665. insert into bootstrap$ select 13, ind$.obj#,
  2666.    'create index i_user# on cluster c_user#' ||
  2667.    ' pctfree ' || ind$.pctfree$ ||
  2668.    ' initrans ' || ind$.initrans ||
  2669.    ' maxtrans ' || ind$.maxtrans ||
  2670.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2671.    ' next ' || seg$.extsize * ts$.blocksize ||
  2672.    ' minextents ' || seg$.minexts ||
  2673.    ' maxextents ' || seg$.maxexts ||
  2674.    ' pctincrease ' || seg$.extpct ||
  2675.    ' objno ' || ind$.obj# ||
  2676.    ' extents ( file ' || seg$.file# ||
  2677.    ' block ' || seg$.block# || '))'
  2678.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2679.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2680.       ind$.obj# = obj$.obj# and obj$.name = 'I_USER#' and
  2681.       ts$.ts# = 0 and obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2682.  
  2683. #^ create_table_clu(14, fet$, "c_ts#(ts#)",
  2684.    "create table fet$
  2685.      (ts#    number not null,
  2686.       file#  number not null,
  2687.       block# number not null,
  2688.       length number not null)")
  2689.  
  2690. #^ create_table_clu(15, uet$,  "c_file#_block#(segfile#, segblock#)",
  2691.    "create table uet$
  2692.     (segfile#  number not null,
  2693.      segblock# number not null,
  2694.      ext#      number not null,
  2695.      ts#       number not null,
  2696.      file#     number not null,
  2697.      block#    number not null,
  2698.      length    number not null)")
  2699.  
  2700. #^ create_table_clu(16, seg$, "c_file#_block#(file#, block#)",
  2701.    "create table seg$
  2702.     (file#   number not null,
  2703.      block#  number not null,
  2704.      type    number not null,
  2705.      ts#     number not null,
  2706.      blocks  number not null,
  2707.      extents number not null,
  2708.      iniexts number not null,
  2709.      minexts number not null,
  2710.      maxexts number not null,
  2711.      extsize number not null,
  2712.      extpct  number not null,
  2713.      user#   number not null,
  2714.      lists   number,
  2715.      groups  number)")
  2716.  
  2717. #^ create_table(17, undo$,
  2718.    "create table undo$
  2719.     (us#     number not null,
  2720.      name    char (30) not null,
  2721.      user#   number not null,
  2722.      file#   number not null,
  2723.      block#  number not null,
  2724.      scnbas  number not null,
  2725.      scnwrp  number,
  2726.      xactsqn number,
  2727.      inst#   number,
  2728.      undosqn number,
  2729.      status$ number not null)")
  2730.  
  2731. insert into bootstrap$ select 18, ind$.obj#,
  2732.    'create unique index i_undo1 on undo$(us#)' ||
  2733.    ' pctfree ' || ind$.pctfree$ ||
  2734.    ' initrans ' || ind$.initrans ||
  2735.    ' maxtrans ' || ind$.maxtrans ||
  2736.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2737.    ' next ' || seg$.extsize * ts$.blocksize ||
  2738.    ' minextents ' || seg$.minexts ||
  2739.    ' maxextents ' || seg$.maxexts ||
  2740.    ' pctincrease ' || seg$.extpct ||
  2741.    ' objno ' || ind$.obj# ||
  2742.    ' extents ( file ' || seg$.file# ||
  2743.    ' block ' || seg$.block# || '))'
  2744.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2745.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2746.       ind$.obj# = obj$.obj# and obj$.name = 'I_UNDO1' and ts$.ts# = 0 and
  2747.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2748.  
  2749. #^ create_table_clu(19, ts$, "c_ts#(ts#)",
  2750.    "create table ts$
  2751.     (ts#        number not null,
  2752.      name       char (30) not null,
  2753.      owner#     number not null,
  2754.      online$    number not null,
  2755.      undofile#  number,
  2756.      undoblock# number,
  2757.      blocksize  number not null,
  2758.      inc#       number not null,
  2759.      scnwrp     number,
  2760.      scnbas     number,
  2761.      dflminext  number not null,
  2762.      dflmaxext  number not null,
  2763.      dflinit    number not null,
  2764.      dflincr    number not null,
  2765.      dflextpct  number not null)")
  2766.  
  2767. #^ create_table(20, file$,
  2768.    "create table file$
  2769.     (file#   number not null,
  2770.      status$ number not null,
  2771.      blocks  number not null,
  2772.      ts#     number not null)")
  2773.  
  2774. insert into bootstrap$ select 21, ind$.obj#,
  2775.    'create unique index i_file1 on file$(file#)' ||
  2776.    ' pctfree ' || ind$.pctfree$ ||
  2777.    ' initrans ' || ind$.initrans ||
  2778.    ' maxtrans ' || ind$.maxtrans ||
  2779.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2780.    ' next ' || seg$.extsize * ts$.blocksize ||
  2781.    ' minextents ' || seg$.minexts ||
  2782.    ' maxextents ' || seg$.maxexts ||
  2783.    ' pctincrease ' || seg$.extpct ||
  2784.    ' objno ' || ind$.obj# ||
  2785.    ' extents ( file ' || seg$.file# ||
  2786.    ' block ' || seg$.block# || '))'
  2787.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2788.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2789.       ind$.obj# = obj$.obj# and obj$.name = 'I_FILE1' and ts$.ts# = 0 and
  2790.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2791.  
  2792. #^ create_table(22, obj$,
  2793.    "create table obj$
  2794.     (obj#        number not null,
  2795.      owner#      number not null,
  2796.      name        char (30) not null,
  2797.      namespace   number not null,
  2798.      type        number not null,
  2799.      ctime       date not null,
  2800.      mtime       date not null,
  2801.      stime       date not null,
  2802.      status      number not null,
  2803.      remoteowner char (30),
  2804.      linkname    char (128))")
  2805.  
  2806. insert into bootstrap$ select 23, ind$.obj#,
  2807.    'create unique index i_obj1 on obj$(obj#)' ||
  2808.    ' pctfree ' || ind$.pctfree$ ||
  2809.    ' initrans ' || ind$.initrans ||
  2810.    ' maxtrans ' || ind$.maxtrans ||
  2811.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2812.    ' next ' || seg$.extsize * ts$.blocksize ||
  2813.    ' minextents ' || seg$.minexts ||
  2814.    ' maxextents ' || seg$.maxexts ||
  2815.    ' pctincrease ' || seg$.extpct ||
  2816.    ' objno ' || ind$.obj# ||
  2817.    ' extents ( file ' || seg$.file# ||
  2818.    ' block ' || seg$.block# || '))'
  2819.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2820.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2821.       ind$.obj# = obj$.obj# and obj$.name = 'I_OBJ1' and ts$.ts# = 0 and
  2822.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2823.  
  2824. insert into bootstrap$ select 24, ind$.obj#,
  2825.    'create unique index i_obj2 on obj$(owner#, name, namespace,' ||
  2826.    ' remoteowner, linkname)' ||
  2827.    ' pctfree ' || ind$.pctfree$ ||
  2828.    ' initrans ' || ind$.initrans ||
  2829.    ' maxtrans ' || ind$.maxtrans ||
  2830.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2831.    ' next ' || seg$.extsize * ts$.blocksize ||
  2832.    ' minextents ' || seg$.minexts ||
  2833.    ' maxextents ' || seg$.maxexts ||
  2834.    ' pctincrease ' || seg$.extpct ||
  2835.    ' objno ' || ind$.obj# ||
  2836.    ' extents ( file ' || seg$.file# ||
  2837.    ' block ' || seg$.block# || '))'
  2838.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2839.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2840.       ind$.obj# = obj$.obj# and obj$.name = 'I_OBJ2' and ts$.ts# = 0 and
  2841.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2842.  
  2843. #^ create_table_clu(25, ind$, "c_obj#(bo#)",
  2844.    "create table ind$
  2845.     (obj#      number not null,
  2846.      ts#       number not null,
  2847.      file#     number not null,
  2848.      block#    number not null,
  2849.      bo#       number not null,
  2850.      cols      number not null,
  2851.      pctfree$  number not null,
  2852.      initrans  number not null,
  2853.      maxtrans  number not null,
  2854.      compress$ number not null,
  2855.      unique$   number not null,
  2856.      blevel    number,
  2857.      leafcnt   number,
  2858.      distkey   number,
  2859.      lblkkey   number,
  2860.      dblkkey   number,
  2861.      clufac    number,
  2862.      spare7    number,
  2863.      spare8    number)")
  2864.  
  2865. insert into bootstrap$ select 26, ind$.obj#,
  2866.    'create unique index i_ind1 on ind$(obj#)' ||
  2867.    ' pctfree ' || ind$.pctfree$ ||
  2868.    ' initrans ' || ind$.initrans ||
  2869.    ' maxtrans ' || ind$.maxtrans ||
  2870.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2871.    ' next ' || seg$.extsize * ts$.blocksize ||
  2872.    ' minextents ' || seg$.minexts ||
  2873.    ' maxextents ' || seg$.maxexts ||
  2874.    ' pctincrease ' || seg$.extpct ||
  2875.    ' objno ' || ind$.obj# ||
  2876.    ' extents ( file ' || seg$.file# ||
  2877.    ' block ' || seg$.block# || '))'
  2878.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2879.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2880.       ind$.obj# = obj$.obj# and obj$.name = 'I_IND1' and ts$.ts# = 0 and
  2881.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2882.  
  2883.  
  2884. #^ create_table_clu(27, icol$, "c_obj#(bo#)",
  2885.    "create table icol$
  2886.     (obj#         number not null,
  2887.      bo#          number not null,
  2888.      col#         number not null,
  2889.      pos#         number not null,
  2890.      segcol#      number not null,
  2891.      segcollength number not null,
  2892.      offset        number not null)")
  2893.  
  2894. insert into bootstrap$ select 28, ind$.obj#,
  2895.    'create  index i_icol1 on icol$(obj#)' ||
  2896.    ' pctfree ' || ind$.pctfree$ ||
  2897.    ' initrans ' || ind$.initrans ||
  2898.    ' maxtrans ' || ind$.maxtrans ||
  2899.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2900.    ' next ' || seg$.extsize * ts$.blocksize ||
  2901.    ' minextents ' || seg$.minexts ||
  2902.    ' maxextents ' || seg$.maxexts ||
  2903.    ' pctincrease ' || seg$.extpct ||
  2904.    ' objno ' || ind$.obj# ||
  2905.    ' extents ( file ' || seg$.file# ||
  2906.    ' block ' || seg$.block# || '))'
  2907.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2908.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2909.       ind$.obj# = obj$.obj# and obj$.name = 'I_ICOL1' and ts$.ts# = 0 and
  2910.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2911.  
  2912. #^ create_table_clu(29, col$, "c_obj#(obj#)",
  2913.    "create table col$
  2914.     (obj#          number not null,
  2915.      col#          number not null,
  2916.      segcol#       number not null,
  2917.      segcollength  number not null,
  2918.      offset        number not null,
  2919.      name          char (30) not null,
  2920.      type#         number not null,
  2921.      length        number not null,
  2922.      fixedstorage  number not null,
  2923.      precision     number,
  2924.      scale         number,
  2925.      null$         number not null,
  2926.      distcnt       number,
  2927.      lowval        raw(32),
  2928.      hival         raw(32),
  2929.      deflength     number,
  2930.      default$      long,
  2931.      spare2        number,
  2932.      spare3        number)")
  2933.  
  2934. insert into bootstrap$ select 30, ind$.obj#,
  2935.    'create unique index i_col1 on col$(obj#, name)' ||
  2936.    ' pctfree ' || ind$.pctfree$ ||
  2937.    ' initrans ' || ind$.initrans ||
  2938.    ' maxtrans ' || ind$.maxtrans ||
  2939.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2940.    ' next ' || seg$.extsize * ts$.blocksize ||
  2941.    ' minextents ' || seg$.minexts ||
  2942.    ' maxextents ' || seg$.maxexts ||
  2943.    ' pctincrease ' || seg$.extpct ||
  2944.    ' objno ' || ind$.obj# ||
  2945.    ' extents ( file ' || seg$.file# ||
  2946.    ' block ' || seg$.block# || '))'
  2947.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2948.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2949.       ind$.obj# = obj$.obj# and obj$.name = 'I_COL1' and ts$.ts# = 0 and
  2950.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2951.  
  2952. insert into bootstrap$ select 31, ind$.obj#,
  2953.    'create unique index i_col2 on col$(obj#, col#)' ||
  2954.    ' pctfree ' || ind$.pctfree$ ||
  2955.    ' initrans ' || ind$.initrans ||
  2956.    ' maxtrans ' || ind$.maxtrans ||
  2957.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2958.    ' next ' || seg$.extsize * ts$.blocksize ||
  2959.    ' minextents ' || seg$.minexts ||
  2960.    ' maxextents ' || seg$.maxexts ||
  2961.    ' pctincrease ' || seg$.extpct ||
  2962.    ' objno ' || ind$.obj# ||
  2963.    ' extents ( file ' || seg$.file# ||
  2964.    ' block ' || seg$.block# || '))'
  2965.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  2966.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  2967.       ind$.obj# = obj$.obj# and obj$.name = 'I_COL2' and ts$.ts# = 0 and
  2968.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  2969.  
  2970.  
  2971. #^ create_table_clu(32, user$, "c_user#(user#)",
  2972.    "create table user$
  2973.     (user#     number not null,
  2974.      name      char (30) not null,
  2975.      type      number not null,
  2976.      password  char (30),
  2977.      datats#   number not null,
  2978.      tempts#   number not null,
  2979.      ctime     date not null,
  2980.      ptime     date,
  2981.      resource$ number not null,
  2982.      audit$    char (32),
  2983.      defrole   number not null,
  2984.      spare1    number,
  2985.      spare2    number)")
  2986.  
  2987. insert into bootstrap$ select 33, ind$.obj#,
  2988.    'create unique index i_user1 on user$(name)' ||
  2989.    ' pctfree ' || ind$.pctfree$ ||
  2990.    ' initrans ' || ind$.initrans ||
  2991.    ' maxtrans ' || ind$.maxtrans ||
  2992.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  2993.    ' next ' || seg$.extsize * ts$.blocksize ||
  2994.    ' minextents ' || seg$.minexts ||
  2995.    ' maxextents ' || seg$.maxexts ||
  2996.    ' pctincrease ' || seg$.extpct ||
  2997.    ' objno ' || ind$.obj# ||
  2998.    ' extents ( file ' || seg$.file# ||
  2999.    ' block ' || seg$.block# || '))'
  3000.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3001.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3002.       ind$.obj# = obj$.obj# and obj$.name = 'I_USER1' and ts$.ts# = 0 and
  3003.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3004.  
  3005. #^ create_table(34, con$,
  3006.    "create table con$
  3007.     (owner# number not null,
  3008.      name   char (30) not null,
  3009.      con#   number not null,
  3010.      spare1 number)")
  3011.  
  3012. insert into bootstrap$ select 35, ind$.obj#,
  3013.    'create unique index i_con1 on con$(owner#, name)' ||
  3014.    ' pctfree ' || ind$.pctfree$ ||
  3015.    ' initrans ' || ind$.initrans ||
  3016.    ' maxtrans ' || ind$.maxtrans ||
  3017.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3018.    ' next ' || seg$.extsize * ts$.blocksize ||
  3019.    ' minextents ' || seg$.minexts ||
  3020.    ' maxextents ' || seg$.maxexts ||
  3021.    ' pctincrease ' || seg$.extpct ||
  3022.    ' objno ' || ind$.obj# ||
  3023.    ' extents ( file ' || seg$.file# ||
  3024.    ' block ' || seg$.block# || '))'
  3025.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3026.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3027.       ind$.obj# = obj$.obj# and obj$.name = 'I_CON1' and ts$.ts# = 0 and
  3028.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3029.  
  3030. insert into bootstrap$ select 36, ind$.obj#,
  3031.    'create unique index i_con2 on con$(con#)' ||
  3032.    ' pctfree ' || ind$.pctfree$ ||
  3033.    ' initrans ' || ind$.initrans ||
  3034.    ' maxtrans ' || ind$.maxtrans ||
  3035.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3036.    ' next ' || seg$.extsize * ts$.blocksize ||
  3037.    ' minextents ' || seg$.minexts ||
  3038.    ' maxextents ' || seg$.maxexts ||
  3039.    ' pctincrease ' || seg$.extpct ||
  3040.    ' objno ' || ind$.obj# ||
  3041.    ' extents ( file ' || seg$.file# ||
  3042.    ' block ' || seg$.block# || '))'
  3043.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3044.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3045.       ind$.obj# = obj$.obj# and obj$.name = 'I_CON2' and ts$.ts# = 0 and
  3046.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3047.  
  3048.  
  3049. insert into bootstrap$ select 37, clu$.obj#,
  3050.    'create cluster c_cobj# (obj# number)' ||
  3051.    ' pctfree ' || clu$.pctfree$ ||
  3052.    ' pctused ' || clu$.pctused$ ||
  3053.    ' initrans ' || clu$.initrans ||
  3054.    ' maxtrans ' || clu$.maxtrans ||
  3055.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3056.    ' next ' || seg$.extsize * ts$.blocksize ||
  3057.    ' minextents ' || seg$.minexts ||
  3058.    ' maxextents ' || seg$.maxexts ||
  3059.    ' pctincrease ' || seg$.extpct ||
  3060.    ' objno ' || clu$.obj# ||
  3061.    ' extents ( file ' || seg$.file# ||
  3062.    ' block ' || seg$.block# || '))' ||
  3063.    ' size ' || clu$.size$
  3064.    from sys.clu$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3065.    where seg$.file# = clu$.file# and seg$.block# = clu$.block# and
  3066.       clu$.obj# = obj$.obj# and obj$.name = 'C_COBJ#' and
  3067.       ts$.ts# = 0 and obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3068.  
  3069. insert into bootstrap$ select 38, ind$.obj#,
  3070.    'create index i_cobj# on cluster c_cobj#' ||
  3071.    ' pctfree ' || ind$.pctfree$ ||
  3072.    ' initrans ' || ind$.initrans ||
  3073.    ' maxtrans ' || ind$.maxtrans ||
  3074.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3075.    ' next ' || seg$.extsize * ts$.blocksize ||
  3076.    ' minextents ' || seg$.minexts ||
  3077.    ' maxextents ' || seg$.maxexts ||
  3078.    ' pctincrease ' || seg$.extpct ||
  3079.    ' objno ' || ind$.obj# ||
  3080.    ' extents ( file ' || seg$.file# ||
  3081.    ' block ' || seg$.block# || '))'
  3082.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3083.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3084.       ind$.obj# = obj$.obj# and obj$.name = 'I_COBJ#' and
  3085.       ts$.ts# = 0 and obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3086.  
  3087. #^ create_table_clu(39, cdef$, "c_cobj#(obj#)",
  3088.    "create table cdef$
  3089.     (con#       number not null,
  3090.      obj#       number not null,
  3091.      cols       number,
  3092.      type       number not null,
  3093.      robj#      number,
  3094.      rcon#      number,
  3095.      rrules     char (3),
  3096.      match      number,
  3097.      refact     number,
  3098.      enabled    number,
  3099.      condlength number,
  3100.      condition  long,
  3101.      spare1     number)")
  3102.  
  3103. insert into bootstrap$ select 40, ind$.obj#,
  3104.    'create unique index i_cdef1 on cdef$(con#)' ||
  3105.    ' pctfree ' || ind$.pctfree$ ||
  3106.    ' initrans ' || ind$.initrans ||
  3107.    ' maxtrans ' || ind$.maxtrans ||
  3108.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3109.    ' next ' || seg$.extsize * ts$.blocksize ||
  3110.    ' minextents ' || seg$.minexts ||
  3111.    ' maxextents ' || seg$.maxexts ||
  3112.    ' pctincrease ' || seg$.extpct ||
  3113.    ' objno ' || ind$.obj# ||
  3114.    ' extents ( file ' || seg$.file# ||
  3115.    ' block ' || seg$.block# || '))'
  3116.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3117.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3118.       ind$.obj# = obj$.obj# and obj$.name = 'I_CDEF1' and ts$.ts# = 0 and
  3119.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3120.  
  3121. insert into bootstrap$ select 41, ind$.obj#,
  3122.    'create index i_cdef2 on cdef$(obj#)' ||
  3123.    ' pctfree ' || ind$.pctfree$ ||
  3124.    ' initrans ' || ind$.initrans ||
  3125.    ' maxtrans ' || ind$.maxtrans ||
  3126.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3127.    ' next ' || seg$.extsize * ts$.blocksize ||
  3128.    ' minextents ' || seg$.minexts ||
  3129.    ' maxextents ' || seg$.maxexts ||
  3130.    ' pctincrease ' || seg$.extpct ||
  3131.    ' objno ' || ind$.obj# ||
  3132.    ' extents ( file ' || seg$.file# ||
  3133.    ' block ' || seg$.block# || '))'
  3134.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3135.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3136.       ind$.obj# = obj$.obj# and obj$.name = 'I_CDEF2' and ts$.ts# = 0 and
  3137.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3138.  
  3139. insert into bootstrap$ select 42, ind$.obj#,
  3140.    'create index i_cdef3 on cdef$(robj#)' ||
  3141.    ' pctfree ' || ind$.pctfree$ ||
  3142.    ' initrans ' || ind$.initrans ||
  3143.    ' maxtrans ' || ind$.maxtrans ||
  3144.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3145.    ' next ' || seg$.extsize * ts$.blocksize ||
  3146.    ' minextents ' || seg$.minexts ||
  3147.    ' maxextents ' || seg$.maxexts ||
  3148.    ' pctincrease ' || seg$.extpct ||
  3149.    ' objno ' || ind$.obj# ||
  3150.    ' extents ( file ' || seg$.file# ||
  3151.    ' block ' || seg$.block# || '))'
  3152.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3153.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3154.       ind$.obj# = obj$.obj# and obj$.name = 'I_CDEF3' and ts$.ts# = 0 and
  3155.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3156.  
  3157. #^ create_table_clu(43, ccol$, "c_cobj#(obj#)",
  3158.    "create table ccol$
  3159.     (con# number not null,
  3160.      obj# number not null,
  3161.      col# number not null,
  3162.      pos# number,
  3163.      spare1 number)")
  3164.  
  3165. insert into bootstrap$ select 44, ind$.obj#,
  3166.    'create unique index i_ccol1 on ccol$(con#, col#)' ||
  3167.    ' pctfree ' || ind$.pctfree$ ||
  3168.    ' initrans ' || ind$.initrans ||
  3169.    ' maxtrans ' || ind$.maxtrans ||
  3170.    ' storage ( initial ' || seg$.iniexts * ts$.blocksize ||
  3171.    ' next ' || seg$.extsize * ts$.blocksize ||
  3172.    ' minextents ' || seg$.minexts ||
  3173.    ' maxextents ' || seg$.maxexts ||
  3174.    ' pctincrease ' || seg$.extpct ||
  3175.    ' objno ' || ind$.obj# ||
  3176.    ' extents ( file ' || seg$.file# ||
  3177.    ' block ' || seg$.block# || '))'
  3178.    from sys.ind$, sys.seg$, sys.ts$, sys.obj$, sys.user$
  3179.    where seg$.file# = ind$.file# and seg$.block# = ind$.block# and
  3180.       ind$.obj# = obj$.obj# and obj$.name = 'I_CCOL1' and ts$.ts# = 0 and
  3181.       obj$.owner# = user$.user# and user$.name = 'MIGRATE';
  3182.  
  3183. #^ create_table(45, bootstrap$,
  3184.    "create table bootstrap$
  3185.     (line# number not null,
  3186.      obj#     number not null,
  3187.      sql_text long not null)")
  3188.  
  3189. #
  3190. # m_misc
  3191. #
  3192.  
  3193. ## the following changes are for epeeler and deal with
  3194. ## how not null column constraints are handled
  3195.  
  3196. ## update the cdef$ table first to make the NULL$ constraints type 7
  3197. update cdef$ set type=7 where
  3198.   con# in (select abs(null$) from col$ where null$>0 or
  3199.            null$ < 0);
  3200.  
  3201. ## update the col$ for the enables NOT NULL column constraints
  3202. update col$ set null$=1 where null$ > 0;
  3203.  
  3204. ## update the col$ table for the disables NOT NULL column constraints
  3205. update col$ set null$=0 where null$ < 0;
  3206.  
  3207. ## update the col$ table for the enabled primary keys
  3208. update col$ c set null$=null$+1 where
  3209. (obj#,col#) = (select cc.obj#,cc.col# from ccol$ cc,cdef$ cd
  3210.                where cc.con#=cd.con# and cd.type=2 and
  3211.                enabled is not null and c.obj#=cc.obj# and
  3212.                c.col#=cc.col#);
  3213.  
  3214.  
  3215. #
  3216. # convert v6 nls parameters into their v7 equivalent
  3217. #
  3218.  
  3219. #^ convert_nls()
  3220.  
  3221. #
  3222. # convert v6 longs into v7 varchar2 (2000);
  3223. #
  3224.  
  3225. update col$ set type# = 1, length = 2000 where name = 'SQL_TEXT' and
  3226.    obj# = (select obj$.obj# from obj$ where obj$.name = 'BOOTSTRAP$');
  3227.  
  3228. update col$ set type# = 1, length = 2000 where name = 'SOURCE' and
  3229.    obj# = (select obj$.obj# from obj$ where obj$.name = 'SOURCE$');
  3230.  
  3231. update col$ set type# = 1, length = 2000 where name = 'TEXT' and
  3232.    obj# = (select obj$.obj# from obj$ where obj$.name = 'ERROR$');
  3233.  
  3234. update col$ set type# = 1, length = 2000 where name = 'DEFINITION' and
  3235.    obj# = (select obj$.obj# from obj$ where obj$.name = 'TRIGGER$');
  3236.  
  3237. update col$ set type# = 1, length = 2000 where name = 'WHENCLAUSE' and
  3238.    obj# = (select obj$.obj# from obj$ where obj$.name = 'TRIGGER$');
  3239.  
  3240. update col$ set type# = 1, length = 2000 where name = 'COMMENT$TEXT' and
  3241.    obj# = (select obj$.obj# from obj$ where obj$.name = 'AUD$' and
  3242.            obj$.owner# = (select user$.user# from user$
  3243.                                  where user$.name = 'MIGRATE'));
  3244.  
  3245. update col$ set type# = 1, length = 2000 where name = 'COMMENT$' and
  3246.    obj# = (select obj$.obj# from obj$ where obj$.name = 'COM$' and
  3247.            obj$.owner# = (select user$.user# from user$
  3248.                                  where user$.name = 'MIGRATE'));
  3249. #
  3250. # convert v6 longs to pidl types
  3251. #
  3252. #sb4 = type 29
  3253. #ub2 = type 25
  3254.  
  3255. update col$ set type# = 29 where name = 'PIECE' and
  3256.    obj# = (select obj$.obj# from obj$ where obj$.name = 'IDL_SB4$');
  3257.  
  3258. update col$ set type# = 25 where name = 'PIECE' and
  3259.    obj# = (select obj$.obj# from obj$ where obj$.name = 'IDL_UB2$');
  3260.  
  3261. #
  3262. #  swap the ownership of the data dictionary in
  3263. #  migrate's copy.
  3264. #  use _NEXT_USER as the temp for swapping.
  3265. #
  3266. # _NEXT_USER <- SYS
  3267. update obj$ set owner# = (select user# from user$ where name = '_NEXT_USER')
  3268.    where owner# = (select user# from user$ where name = 'SYS') and
  3269.          name in (select name from sys.v7_objects where type = 'M' or type = 'P');
  3270. #
  3271. # SYS <- MIGRATE
  3272. #
  3273. update obj$ set owner# = (select user# from user$ where name = 'SYS')
  3274.    where owner# = (select user# from user$ where name = 'MIGRATE');
  3275. #
  3276. # MIGRATE <- _NEXT_USER
  3277. #
  3278. update obj$ set owner# = (select user# from user$ where name = 'MIGRATE')
  3279.    where owner# = (select user# from user$ where name = '_NEXT_USER');
  3280. #
  3281. #  swap SYS and MIGRATE in col GRANTOR# in table objauth$
  3282. #
  3283. update objauth$ set grantor# =
  3284.   (select user# from user$ where name = '_NEXT_USER')
  3285.   where grantor# = (select user# from user$ where name = 'SYS');
  3286. update objauth$ set grantor# =
  3287.    (select user# from user$ where name = 'SYS')
  3288.    where grantor# = (select user# from user$ where name = 'MIGRATE');
  3289. update objauth$ set grantor# =
  3290.    (select user# from user$ where name = 'MIGRATE')
  3291.    where grantor# = (select user# from user$ where name = '_NEXT_USER');
  3292. #
  3293. # invalidate all the views so they get recreated in v7
  3294. #
  3295. update obj$ set status = 5 where type = 4;
  3296. #
  3297. #  change migrate's password.  after sys and migrate change
  3298. #  tables, one will no longer be able to log in as migrate.
  3299. #
  3300. update user$ set user$.password = 'no login' where user$.name = 'MIGRATE';
  3301.  
  3302. #
  3303. #  Now populate the space management tables.  This must be handled
  3304. #  *very* delicately.  We cannot allow any space operations to
  3305. #  occur while we are doing this.  The c_file#_block# and c_ts# cluster
  3306. #  and their indexes were created with maxextents = 1, so they cannot
  3307. #  extend.  We must also be careful not to issue any SQL that uses
  3308. #  a sort, as they may cause a temp table to extend.  We also must
  3309. #  get a consistant snapshot of all 3 tables, so we lock them
  3310. #  all in exclusive mode.  This prevents SMON from doing any
  3311. #  temp segment cleanup while we copy the tables.
  3312. #  We also cannot allow the system rollback segment to extend while all
  3313. #  this is going on, so we freeze it at its current size.
  3314. #
  3315.  
  3316. #^ connect (maint, internal)
  3317. #^ freeze_rb()
  3318. #^ connect (migrate, migrate)
  3319.  
  3320. #^ run ("lock table fet$ in exclusive mode")
  3321. #^ run ("lock table seg$ in exclusive mode")
  3322. #^ run ("lock table uet$ in exclusive mode")
  3323.  
  3324. #
  3325. #  populate seg$
  3326. #
  3327. #^ run ("insert into seg$
  3328.         select file#, block#, type, ts#, blocks, extents,
  3329.         iniexts, minexts, maxexts, extsize, extpct, user#, NULL, NULL
  3330.         from sys.seg$")
  3331. #
  3332. #  populate fet$
  3333. #
  3334. #^ run ("insert into fet$ select * from sys.fet$")
  3335. #
  3336. #  populate uet$;
  3337. #
  3338. #^ run ("insert into uet$ select * from sys.uet$")
  3339. #
  3340. #  convert segment owners in seg$
  3341. #
  3342. update seg$ set user# = (select user# from user$ where name = 'SYS')
  3343.   where user# = (select user# from user$ where name = 'MIGRATE');
  3344. #
  3345. #  all rollback segments in v7 have pctincrease = 0
  3346. #
  3347. update seg$ s set s.extpct = 0 where exists
  3348.  (select u.file#, u.block# from undo$ u
  3349.     where u.file# = s.file# and u.block# = s.block#);
  3350. #
  3351. #  set maxexts to 99 for those space management objects that we created
  3352. #  with maxextents 1
  3353. #
  3354. update seg$ s set s.maxexts = 99
  3355.   where s.user# = (select user# from user$ where name = 'SYS')
  3356.     and exists (select o.obj# from obj$ o, clu$ c
  3357.                 where (o.name = 'C_FILE#_BLOCK#' or o.name = 'C_TS#')
  3358.                   and o.obj# = c.obj#
  3359.                   and o.owner# = s.user#
  3360.                   and c.file# = s.file# and c.block# = s.block#);
  3361.  
  3362. update seg$ s set s.maxexts = 99
  3363.   where s.user# = (select user# from user$ where name = 'SYS')
  3364.     and exists (select o.obj# from obj$ o, ind$ i
  3365.                 where (o.name = 'I_FILE#_BLOCK#' or o.name = 'I_TS#')
  3366.                   and o.obj# = i.obj#
  3367.                   and o.owner# = s.user#
  3368.                   and i.file# = s.file# and i.block# = s.block#);
  3369. update ts$ set inc# = (select inc# from sys.ts$ where name = 'SYSTEM')
  3370. where name = 'SYSTEM';
  3371. #^ connect (maint, internal)
  3372.  
  3373.