home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / programming / oracle7 7.2 / DB / UTIL72 / CAT7106.SQL < prev    next >
Encoding:
Text File  |  1995-05-09  |  5.0 KB  |  137 lines

  1. rem 
  2. rem $Header: cat7106.sql 7020200.1 95/02/15 18:33:26 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1992 by Oracle Corporation 
  5. Rem    NAME
  6. Rem      cat7106.sql 
  7. Rem    DESCRIPTION
  8. Rem      Upgrade script from 7.1.3, 7.1.4, or 7.1.5 to 7.1.6
  9. Rem    RETURNS
  10. Rem 
  11. Rem    NOTES
  12. Rem      You must connect internal to run this script.
  13. Rem      The files: catrep.sql, catdefer.sql must also be sourced
  14. Rem      after this file to obtain the full version of replication in 7.1.6.
  15. Rem    MODIFIED   (MM/DD/YY)
  16. Rem     hasun      01/23/95 -  merge changes from branch 1.1.710.3
  17. Rem     hasun      12/21/94 -  merge changes from branch 1.1.710.1
  18. Rem     hasun      01/12/95 -  Add columns for duplicate SCN fix
  19. Rem     hasun      12/28/94 -  Insert into def$_destination before
  20. Rem                            foreign key is added to repcat$_repschema
  21. Rem     hasun      12/12/94 -  Add new constraint to repcat$_repschema
  22. Rem                            Add new constraint to def$_destination
  23. Rem     hasun      12/12/94 -  Branch_for_patch
  24. Rem     hasun      12/12/94 -  Creation
  25.  
  26. Rem
  27. Rem --------------------
  28. Rem CASE 1: 7.1.3, 7.1.4
  29. Rem --------------------
  30. Rem All of the def$ tables are owned by SYS. All of the tables must 
  31. Rem be dropped and in the correct order to avoid constraint conlicts.
  32. Rem
  33. Rem -------------
  34. Rem CASE 2: 7.1.5
  35. Rem -------------
  36. Rem All of the def$ tables are owned by SYSTEM. 
  37. Rem The following tables need to be dropped:
  38. Rem system.def$_trandest
  39. Rem system.def$_tran
  40. Rem system.def$_schedule
  41. Rem The following tables need to be altered:
  42. Rem system.def$_call
  43. Rem 
  44.  
  45. Rem -----------------------------------------------------------------
  46. Rem CASE 1: 7.1.3, 7.1.4
  47. Rem -----------------------------------------------------------------
  48. Rem
  49. Rem Drop def$ that were previous own by SYS
  50. Rem
  51. DROP TABLE sys.def$_calldest;
  52. DROP TABLE sys.def$_call;
  53. DROP TABLE sys.def$_error;
  54. DROP TABLE sys.def$_defaultdest;
  55. DROP TABLE sys.def$_trandest;
  56. DROP TABLE sys.def$_tran;
  57. DROP TABLE sys.def$_schedule;
  58.  
  59. Rem ----------------------------------------------------------------
  60. Rem CASE 2: 7.1.5
  61. Rem -----------------------------------------------------------------
  62. Rem
  63. Rem In order to drop def$_tran, the foreign key constraints 
  64. Rem for def$_call and def$_error must be dropped. In addition
  65. Rem these constraints do not exist in 7.1.6
  66. Rem
  67. ALTER TABLE system.def$_call DROP CONSTRAINT def$_calls_prnt;
  68. ALTER TABLE system.def$_error DROP CONSTRAINT def$_error_tran;
  69.  
  70. Rem
  71. Rem Add new columns to def$_call in 7.1.6
  72. Rem
  73. ALTER TABLE system.def$_call ADD (
  74.   destination_list CHAR(1),        /* R = RepSchema, D = def$_calldest */
  75.   origin_user_id   NUMBER,         /* userid deferring tran */
  76.   origin_user      VARCHAR2(30),   /* user deferring tran (used at remote) */
  77.   delivery_order   NUMBER,         /* order to deliver to destinations */
  78.   origin_tran_id   VARCHAR2(22),   /* original tid (if copied) */
  79.   origin_tran_db   VARCHAR2(128),  /* origial  node */
  80.   start_time       DATE,           /* time original tid started */
  81.   destination_count INTEGER,       /* set on first push */
  82.   commit_comment VARCHAR2(50)      /* commit comment */
  83. )
  84. /
  85.  
  86. Rem
  87. Rem Drop tables replaced by views
  88. Rem
  89. DROP TABLE system.def$_trandest;
  90. DROP TABLE system.def$_tran;
  91. DROP TABLE system.def$_schedule;
  92.  
  93. Rem
  94. Rem  The tables def$_calldest and repcat$_repschema have new 
  95. Rem  foreign key constraints on def$_destination, a new table in 7.1.6
  96. Rem  Before the constraints are added, def$_destination must exist.
  97. Rem
  98. CREATE TABLE system.def$_destination(
  99.   dblink         VARCHAR2(128)  -- queue name
  100.     CONSTRAINT def$_destination_primary PRIMARY KEY,
  101.   last_delivered NUMBER         -- scn (from deliver_order column of def$_call)
  102.                          DEFAULT 0 NOT NULL,
  103.   last_tran_id   VARCHAR2(22),  -- transaction id last delivered
  104.   last_tran_db   VARCHAR2(128), -- node  origination/copying last delivered txn
  105.   disabled       CHAR(1),       -- T = propogtion to dest disabled F = enabled 
  106.   job            NUMBER,        -- number of job which does the push
  107.   last_txn_count NUMBER,        -- number of transacitons executed lat push
  108.   last_error     NUMBER,        -- sqlcode from last push
  109.   last_msg       VARCHAR2(255)) -- error message from last push
  110. /
  111.  
  112. ALTER TABLE system.def$_calldest ADD (
  113.   CONSTRAINT def$_call_destination  -- Destination table must have a row
  114.     FOREIGN KEY(dblink)  
  115.     REFERENCES system.def$_destination(dblink)
  116. )
  117. /
  118.  
  119. Rem
  120. Rem repcat$_repschema may already contain data that may not be in 
  121. Rem def$_destination. Thus before the foreign key constraint can be added
  122. Rem def$_destination must be populated.
  123. Rem
  124.  
  125. INSERT INTO system.def$_destination (dblink) 
  126.   SELECT DISTINCT dblink 
  127.   FROM system.repcat$_repschema
  128.   WHERE dblink NOT IN (SELECT dblink FROM system.def$_destination);
  129.  
  130.  
  131. ALTER TABLE system.repcat$_repschema ADD (
  132.   CONSTRAINT repcat$_repschema_dest 
  133.     FOREIGN KEY(dblink)
  134.     REFERENCES system.def$_destination(dblink)
  135. )
  136. /
  137.