Bo's Oracle Station

查看: 1911|回复: 0

升级数据库的过程

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-12-10 21:08:25 | 显示全部楼层 |阅读模式
11.2.0.3上:
  1. [oracle@classroom ~]$ . oraenv
  2. ORACLE_SID = [orcl] ? rcat
  3. The Oracle base remains unchanged with value /u01/app/oracle
  4. [oracle@classroom ~]$ sqlplus /nolog

  5. SQL*Plus: Release 11.2.0.3.0 Production on 星期四 12月 10 21:00:30 2020

  6. Copyright (c) 1982, 2011, Oracle.  All rights reserved.

  7. SQL> conn / as sysdba
  8. Connected to an idle instance.
  9. SQL> startup
  10. ORACLE instance started.

  11. Total System Global Area 1603411968 bytes
  12. Fixed Size                    2228784 bytes
  13. Variable Size                  503320016 bytes
  14. Database Buffers         1090519040 bytes
  15. Redo Buffers                    7344128 bytes
  16. Database mounted.
  17. Database opened.
  18. SQL> @/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/preupgrd.sql






  19. Loading Pre-Upgrade Package...


  20. ***************************************************************************
  21. Executing Pre-Upgrade Checks in RCAT...
  22. ***************************************************************************


  23.       ************************************************************

  24.                    ====>> ERRORS FOUND for RCAT <<====

  25. The following are *** ERROR LEVEL CONDITIONS *** that must be addressed
  26.                     prior to attempting your upgrade.
  27.             Failure to do so will result in a failed upgrade.


  28. 1) Check Tag:          PURGE_RECYCLEBIN
  29.     Check Summary: Check that recycle bin is empty prior to upgrade
  30.     Fixup Summary:
  31.      "The recycle bin will be purged."

  32.             You MUST resolve the above error prior to upgrade

  33.       ************************************************************

  34.       ************************************************************

  35.                ====>> PRE-UPGRADE RESULTS for RCAT <<====

  36. ACTIONS REQUIRED:

  37. 1. Review results of the pre-upgrade checks:
  38. /u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade.log

  39. 2. Execute in the SOURCE environment BEFORE upgrade:
  40. /u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade_fixups.sql

  41. 3. Execute in the NEW environment AFTER upgrade:
  42. /u01/app/oracle/cfgtoollogs/rcat/preupgrade/postupgrade_fixups.sql

  43.       ************************************************************

  44. ***************************************************************************
  45. Pre-Upgrade Checks in RCAT Completed.
  46. ***************************************************************************

  47. ***************************************************************************
  48. ***************************************************************************
  49. SQL>
复制代码
  1. SQL> @/u01/app/oracle/cfgtoollogs/rcat/preupgrade/preupgrade_fixups.sql
  2. Pre-Upgrade Fixup Script Generated on 2020-12-10 21:07:56  Version: 12.1.0.2 Build: 006
  3. Beginning Pre-Upgrade Fixups...
  4. Executing in container RCAT

  5. **********************************************************************
  6. Check Tag:     EM_PRESENT
  7. Check Summary: Check if Enterprise Manager is present
  8. Fix Summary:   Execute emremove.sql prior to upgrade.
  9. **********************************************************************
  10. Fixup Returned Information:
  11. WARNING: --> Enterprise Manager Database Control repository found in the database

  12.      In Oracle Database 12c, Database Control is removed during
  13.      the upgrade. To save time during the Upgrade, this action
  14.      can be done prior to upgrading using the following steps after
  15.      copying rdbms/admin/emremove.sql from the new Oracle home
  16.    - Stop EM Database Control:
  17.     [        DISCUZ_CODE_2        ]gt; emctl stop dbconsole

  18.    - Connect to the Database using the SYS account AS SYSDBA:

  19.    SET ECHO ON;
  20.    SET SERVEROUTPUT ON;
  21.    @emremove.sql
  22.      Without the set echo and serveroutput commands you will not
  23.      be able to follow the progress of the script.
  24. **********************************************************************


  25. **********************************************************************
  26. Check Tag:     AMD_EXISTS
  27. Check Summary: Check to see if AMD is present in the database
  28. Fix Summary:   Manually execute ORACLE_HOME/oraolap/admin/catnoamd.sql script to remove OLAP.
  29. **********************************************************************
  30. Fixup Returned Information:
  31. INFORMATION: --> OLAP Catalog(AMD) exists in database

  32.      Starting with Oracle Database 12c, OLAP Catalog component is desupported.
  33.      If you are not using the OLAP Catalog component and want
  34.      to remove it, then execute the
  35.      ORACLE_HOME/olap/admin/catnoamd.sql script before or
  36.      after the upgrade.
  37. **********************************************************************


  38. **********************************************************************
  39. Check Tag:     PURGE_RECYCLEBIN
  40. Check Summary: Check that recycle bin is empty prior to upgrade
  41. Fix Summary:   The recycle bin will be purged.
  42. **********************************************************************
  43. Fixup Succeeded
  44. **********************************************************************


  45. **********************************************************************
  46. Check Tag:     APEX_UPGRADE_MSG
  47. Check Summary: Check that APEX will need to be upgraded.
  48. Fix Summary:   Oracle Application Express can be manually upgraded prior to database upgrade.
  49. **********************************************************************
  50. Fixup Returned Information:
  51. INFORMATION: --> Oracle Application Express (APEX) can be
  52.      manually upgraded prior to database upgrade

  53.      APEX is currently at version 3.2.1.00.10 and will need to be
  54.      upgraded to APEX version 4.2.5 in the new release.
  55.      Note 1: To reduce database upgrade time, APEX can be manually
  56.              upgraded outside of and prior to database upgrade.
  57.      Note 2: See MOS Note 1088970.1 for information on APEX
  58.              installation upgrades.
  59. **********************************************************************


  60. **********************************************************************
  61.                       [Pre-Upgrade Recommendations]
  62. **********************************************************************

  63.                         *****************************************
  64.                         ********* Dictionary Statistics *********
  65.                         *****************************************

  66. Please gather dictionary statistics 24 hours prior to
  67. upgrading the database.
  68. To gather dictionary statistics execute the following command
  69. while connected as SYSDBA:
  70.     EXECUTE dbms_stats.gather_dictionary_stats;

  71. ^^^ MANUAL ACTION SUGGESTED ^^^


  72.            **************************************************
  73.                 ************* Fixup Summary ************

  74. 1 fixup routine was successful.
  75. 3 fixup routines returned INFORMATIONAL text that should be reviewed.

  76. **************** Pre-Upgrade Fixup Script Complete *********************
  77. SQL>
复制代码
  1. SQL> shutdown immediate
  2. Database closed.
  3. Database dismounted.
  4. ORACLE instance shut down.
  5. SQL>
复制代码


-----------------------------------------------------------------------------------------------------------------------

  1. #Backup file is  /u01/app/oracle/product/12.1.0/grid/srvm/admin/oratab.bak.classroom line added by Agent
  2. #



  3. # This file is used by ORACLE utilities.  It is created by root.sh
  4. # and updated by either Database Configuration Assistant while creating
  5. # a database or ASM Configuration Assistant while creating ASM instance.

  6. # A colon, ':', is used as the field terminator.  A new line terminates
  7. # the entry.  Lines beginning with a pound sign, '#', are comments.
  8. #
  9. # Entries are of the form:
  10. #   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
  11. #
  12. # The first and second fields are the system identifier and home
  13. # directory of the database respectively.  The third field indicates
  14. # to the dbstart utility that the database should , "Y", or should not,
  15. # "N", be brought up at system boot time.
  16. #
  17. # Multiple entries with the same $ORACLE_SID are not allowed.
  18. #
  19. #
  20. em12rep:/u01/app/oracle/product/12.1.0/dbhome_1:N               # line added by Agent
  21. orcl2:/u01/app/oracle/product/12.1.0/dbhome_1:N         # line added by Agent
  22. orcl:/u01/app/oracle/product/12.1.0/dbhome_2:N          # line added by Agent
  23. cdb1:/u01/app/oracle/product/12.1.0/dbhome_1:N          # line added by Agent
  24. rcat:/u01/app/oracle/product/12.1.0/dbhome_1:N          # line added by Agent
  25. +ASM:/u01/app/oracle/product/12.1.0/grid:N              # line added by Agen                                                                              
复制代码
  1. [oracle@classroom ~]$ . oraenv
  2. ORACLE_SID = [rcat] ? rcat
  3. The Oracle base remains unchanged with value /u01/app/oracle
  4. [oracle@classroom ~]$ which sqlplus
  5. /u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus
  6. [oracle@classroom ~]$ sqlplus /nolog

  7. SQL*Plus: Release 12.1.0.2.0 Production on 星期四 12月 10 21:17:28 2020

  8. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  9. SQL> conn / as sysdba
  10. Connected to an idle instance.
  11. SQL> startup upgrade
  12. ORA-01078: failure in processing system parameters
  13. LRM-00109: could not open parameter file '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initrcat.ora'
  14. SQL>
复制代码
  1. [oracle@classroom ~]$ cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilercat.ora  /u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilercat.ora
  2. [oracle@classroom ~]$ cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwrcat /u01/app/oracle/product/12.1.0/dbhome_1/dbs/
  3. [oracle@classroom ~]$
复制代码
  1. [oracle@classroom ~]$ sqlplus /nolog

  2. SQL*Plus: Release 12.1.0.2.0 Production on 星期四 12月 10 21:24:59 2020

  3. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  4. SQL> conn / as sysdba
  5. Connected to an idle instance.
  6. SQL> startup upgrade
  7. ORACLE instance started.

  8. Total System Global Area 1610612736 bytes
  9. Fixed Size                    2924928 bytes
  10. Variable Size                  671092352 bytes
  11. Database Buffers          922746880 bytes
  12. Redo Buffers                   13848576 bytes
  13. Database mounted.
  14. Database opened.
  15. SQL> @?/rdbms/admin/catupgrd.sql
  16. DOC>######################################################################
  17. DOC>######################################################################
  18. DOC>                                     NOTE
  19. DOC>
  20. DOC>        The catupgrd.sql is being deprecated in the 12.1 release of the
  21. DOC>        Oracle Database.  Customers are encouraged to use catctl.pl as
  22. DOC>        the replacement for catupgrd.sql when upgrading the database dictionary.
  23. DOC>
  24. DOC>                        cd $ORACLE_HOME/rdbms/admin
  25. DOC>                        $ORACLE_HOME/perl/bin/perl catctl.pl -n 4 catupgrd.sql
  26. DOC>
  27. DOC>        Refer to the Oracle Database Upgrade Guide for more information.
  28. DOC>
  29. DOC>        This database upgrade procedure must be called with the following
  30. DOC>        argument when invoking from the SQL prompt:
  31. DOC>
  32. DOC>                        @catupgrd.sql PARALLEL=NO
  33. DOC>
  34. DOC>######################################################################
  35. DOC>######################################################################
  36. DOC>#
  37. old   2: WHERE        UPPER('&&1') = 'PARALLEL=NO' OR
  38. new   2: WHERE        UPPER('') = 'PARALLEL=NO' OR
  39. old   3:        UPPER('&&1') = 'PARALLEL=YES'
  40. new   3:        UPPER('') = 'PARALLEL=YES'
  41. SELECT (to_number(count(*)))/(to_number(count(*))) FROM DUAL
  42.                             *
  43. ERROR at line 1:
  44. ORA-01476: 除数为 0


  45. Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  46. With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
  47. and Unified Auditing options
  48. [oracle@classroom ~]$
复制代码
  1. [oracle@classroom admin]$ pwd
  2. /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin
  3. [oracle@classroom admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl -n 4 catupgrd.sql
复制代码
  1. [oracle@classroom ~]$ sqlplus /nolog

  2. SQL*Plus: Release 12.1.0.2.0 Production on 星期四 12月 10 21:24:59 2020

  3. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  4. SQL> conn / as sysdba
  5. Connected to an idle instance.
  6. SQL> startup upgrade
  7. ORACLE instance started.

  8. Total System Global Area 1610612736 bytes
  9. Fixed Size                    2924928 bytes
  10. Variable Size                  671092352 bytes
  11. Database Buffers          922746880 bytes
  12. Redo Buffers                   13848576 bytes
  13. Database mounted.
  14. Database opened.
  15. SQL> @?/rdbms/admin/catupgrd.sql
  16. DOC>######################################################################
  17. DOC>######################################################################
  18. DOC>                                     NOTE
  19. DOC>
  20. DOC>        The catupgrd.sql is being deprecated in the 12.1 release of the
  21. DOC>        Oracle Database.  Customers are encouraged to use catctl.pl as
  22. DOC>        the replacement for catupgrd.sql when upgrading the database dictionary.
  23. DOC>
  24. DOC>                        cd $ORACLE_HOME/rdbms/admin
  25. DOC>                        $ORACLE_HOME/perl/bin/perl catctl.pl -n 4 catupgrd.sql
  26. DOC>
  27. DOC>        Refer to the Oracle Database Upgrade Guide for more information.
  28. DOC>
  29. DOC>        This database upgrade procedure must be called with the following
  30. DOC>        argument when invoking from the SQL prompt:
  31. DOC>
  32. DOC>                        @catupgrd.sql PARALLEL=NO
  33. DOC>
  34. DOC>######################################################################
  35. DOC>######################################################################
  36. DOC>#
  37. old   2: WHERE        UPPER('&&1') = 'PARALLEL=NO' OR
  38. new   2: WHERE        UPPER('') = 'PARALLEL=NO' OR
  39. old   3:        UPPER('&&1') = 'PARALLEL=YES'
  40. new   3:        UPPER('') = 'PARALLEL=YES'
  41. SELECT (to_number(count(*)))/(to_number(count(*))) FROM DUAL
  42.                             *
  43. ERROR at line 1:
  44. ORA-01476: 除数为 0


  45. Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  46. With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
  47. and Unified Auditing options
  48. [oracle@classroom ~]$ $ORACLE_HOME/perl/bin/perl catctl.pl -n 8 catupgrd.sql
  49. Can't open perl script "catctl.pl": (null)
  50. [oracle@classroom ~]$ /u01/app/oracle/product/12.1.0/
  51. agent/      dbhome_1/   dbhome_2/   gc_inst/    grid/       middleware/ swlib/      
  52. [oracle@classroom ~]$ cd /u01/app/oracle/product/
  53. [oracle@classroom product]$ cd 12.1.0/
  54. [oracle@classroom 12.1.0]$ cd dbhome_1/rdbms/admin/
  55. [oracle@classroom admin]$ pwd
  56. /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin
  57. [oracle@classroom admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl -n 4 catupgrd.sql

  58. Argument list for [catctl.pl]
  59. SQL Process Count     n = 4
  60. SQL PDB Process Count N = 0
  61. Input Directory       d = 0
  62. Phase Logging Table   t = 0
  63. Log Dir               l = 0
  64. Script                s = 0
  65. Serial Run            S = 0
  66. Upgrade Mode active   M = 0
  67. Start Phase           p = 0
  68. End Phase             P = 0
  69. Log Id                i = 0
  70. Run in                c = 0
  71. Do not run in         C = 0
  72. Echo OFF              e = 1
  73. No Post Upgrade       x = 0
  74. Reverse Order         r = 0
  75. Open Mode Normal      o = 0
  76. Debug catcon.pm       z = 0
  77. Debug catctl.pl       Z = 0
  78. Display Phases        y = 0
  79. Child Process         I = 0

  80. catctl.pl version: 12.1.0.2.0
  81. Oracle Base           = /u01/app/oracle

  82. Analyzing file catupgrd.sql
  83. Log files in /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin
  84. catcon: ALL catcon-related output will be written to catupgrd_catcon_28605.lst
  85. catcon: See catupgrd*.log files for output generated by scripts
  86. catcon: See catupgrd_*.lst files for spool files, if any
  87. Number of Cpus        = 4
  88. SQL Process Count     = 4

  89. ------------------------------------------------------
  90. Phases [0-73]
  91. Serial   Phase #: 0 Files: 1








  92.     Time: 263s  
  93. Serial   Phase #: 1 Files: 5     Time: 153s  
  94. Restart  Phase #: 2 Files: 1     Time: 0s   
  95. Parallel Phase #: 3 Files: 18    Time: 37s   
  96. Restart  Phase #: 4 Files: 1     Time: 0s   
  97. Serial   Phase #: 5 Files: 5     Time: 64s   
  98. Serial   Phase #: 6 Files: 1     Time: 32s   
  99. Serial   Phase #: 7 Files: 4     Time: 18s   
  100. Restart  Phase #: 8 Files: 1     Time: 3s   
  101. Parallel Phase #: 9 Files: 62    Time: 112s  
  102. Restart  Phase #:10 Files: 1     Time: 0s   
  103. Serial   Phase #:11 Files: 1     Time: 49s   
  104. Restart  Phase #:12 Files: 1     Time: 1s   
  105. Parallel Phase #:13 Files: 91    Time: 13s   
  106. Restart  Phase #:14 Files: 1     Time: 0s   
  107. Parallel Phase #:15 Files: 111   Time: 36s   
  108. Restart  Phase #:16 Files: 1     Time: 0s   
  109. Serial   Phase #:17 Files: 3     Time: 2s   
  110. Restart  Phase #:18 Files: 1     Time: 1s   
  111. Parallel Phase #:19 Files: 32    Time: 46s   
  112. Restart  Phase #:20 Files: 1     Time: 0s   
  113. Serial   Phase #:21 Files: 3     Time: 15s   
  114. Restart  Phase #:22 Files: 1     Time: 2s   
  115. Parallel Phase #:23 Files: 23    Time: 135s  
  116. Restart  Phase #:24 Files: 1     Time: 0s   
  117. Parallel Phase #:25 Files: 11    Time: 72s   
  118. Restart  Phase #:26 Files: 1     Time: 0s   
  119. Serial   Phase #:27 Files: 1     Time: 1s   
  120. Restart  Phase #:28 Files: 1     Time: 1s   
  121. Serial   Phase #:30 Files: 1     Time: 0s   
  122. Serial   Phase #:31 Files: 257   Time: 42s   
  123. Serial   Phase #:32 Files: 1     Time: 0s   
  124. Restart  Phase #:33 Files: 1     Time: 1s   
  125. Serial   Phase #:34 Files: 1     Time: 7s   
  126. Restart  Phase #:35 Files: 1     Time: 1s   
  127. Restart  Phase #:36 Files: 1     Time: 0s   
  128. Serial   Phase #:37 Files: 4     Time: 79s   
  129. Restart  Phase #:38 Files: 1     Time: 1s   
  130. Parallel Phase #:39 Files: 13    Time: 86s   
  131. Restart  Phase #:40 Files: 1     Time: 0s   
  132. Parallel Phase #:41 Files: 10    Time: 12s   
  133. Restart  Phase #:42 Files: 1     Time: 0s   
  134. Serial   Phase #:43 Files: 1     Time: 15s   
  135. Restart  Phase #:44 Files: 1     Time: 1s   
  136. Serial   Phase #:45 Files: 1     Time: 7s   
  137. Serial   Phase #:46 Files: 1     Time: 1s   
  138. Restart  Phase #:47 Files: 1     Time: 2s   
  139. Serial   Phase #:48 Files: 1     Time: 293s  
  140. Restart  Phase #:49 Files: 1     Time: 2s   
  141. Serial   Phase #:50 Files: 1     Time: 68s   
  142. Restart  Phase #:51 Files: 1     Time: 1s   
  143. Serial   Phase #:52 Files: 1     Time: 49s   
  144. Restart  Phase #:53 Files: 1     Time: 1s   
  145. Serial   Phase #:54 Files: 1     Time: 286s  
  146. Restart  Phase #:55 Files: 1     Time: 2s   
  147. Serial   Phase #:56 Files: 1     Time: 103s  
  148. Restart  Phase #:57 Files: 1     Time: 1s   
  149. Serial   Phase #:58 Files: 1     Time: 161s  
  150. Restart  Phase #:59 Files: 1     Time: 1s   
  151. Serial   Phase #:60 Files: 1     Time: 406s  
  152. Restart  Phase #:61 Files: 1     Time: 1s   
  153. Serial   Phase #:62 Files: 1     Time: 2215s
  154. Restart  Phase #:63 Files: 1     Time: 1s   
  155. Serial   Phase #:64 Files: 1     Time: 1s   
  156. Serial   Phase #:65 Files: 1 Calling sqlpatch with LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0/dbhome_1/lib; export LD_LIBRARY_PATH;/u01/app/oracle/product/12.1.0/dbhome_1/perl/bin/perl -I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin -I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch/sqlpatch.pl -verbose -upgrade_mode_only > catupgrd_datapatch_upgrade.log 2> catupgrd_datapatch_upgrade.err
  157. returned from sqlpatch
  158.     Time: 41s   
  159. Serial   Phase #:66 Files: 1     Time: 95s   
  160. Serial   Phase #:68 Files: 1     Time: 0s   
  161. Serial   Phase #:69 Files: 1 Calling sqlpatch with LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0/dbhome_1/lib; export LD_LIBRARY_PATH;/u01/app/oracle/product/12.1.0/dbhome_1/perl/bin/perl -I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin -I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch/sqlpatch.pl -verbose > catupgrd_datapatch_normal.log 2> catupgrd_datapatch_normal.err
  162. returned from sqlpatch
  163.     Time: 109s  
  164. Serial   Phase #:70 Files: 1     Time: 220s  
  165. Serial   Phase #:71 Files: 1     Time: 0s   
  166. Serial   Phase #:72 Files: 1     Time: 0s   
  167. Serial   Phase #:73 Files: 1     Time: 58s   

  168. Grand Total Time: 5439s

  169. LOG FILES: (catupgrd*.log)

  170. Upgrade Summary Report Located in:
  171. /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/rcat/upgrade/upg_summary.log

  172. Grand Total Upgrade Time:    [0d:1h:30m:39s]
  173. [oracle@classroom admin]$
  174. [oracle@classroom admin]$
  175. [oracle@classroom admin]$
  176. [oracle@classroom admin]$
  177. [oracle@classroom admin]$
  178. [oracle@classroom admin]$
  179. [oracle@classroom admin]$
  180. [oracle@classroom admin]$
  181. [oracle@classroom admin]$
  182. [oracle@classroom admin]$
复制代码
  1. /u01/app/oracle/cfgtoollogs/rcat/preupgrade/postupgrade_fixups.sql
复制代码

---------------------------------------------------------------
  1. SQL> @?/rdbms/admin/utlu121s.sql

  2. PL/SQL procedure successfully completed.


  3. PL/SQL procedure successfully completed.





  4. CATCTL REPORT = /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/rcat/upgrade/upg_summary.log

  5. PL/SQL procedure successfully completed.






  6. Oracle Database 12.1 Post-Upgrade Status Tool                12-13-2020 15:11:11

  7. Component                                Current         Version  Elapsed Time
  8. Name                                        Status                Number         HH:MM:SS

  9. Oracle Server                               UPGRADED      12.1.0.2.0  00:21:48
  10. JServer JAVA Virtual Machine                  VALID      12.1.0.2.0  00:04:52
  11. Oracle Workspace Manager                  VALID      12.1.0.2.0  00:01:23
  12. OLAP Analytic Workspace                   VALID      12.1.0.2.0  00:00:47
  13. OLAP Catalog                             OPTION OFF      11.2.0.3.0  00:00:00
  14. Oracle OLAP API                           VALID      12.1.0.2.0  00:00:25
  15. Oracle XDK                                  VALID      12.1.0.2.0  00:01:07
  16. Oracle Text                                  VALID      12.1.0.2.0  00:01:40
  17. Oracle XML Database                          VALID      12.1.0.2.0  00:03:04
  18. Oracle Database Java Packages                  VALID      12.1.0.2.0  00:00:18
  19. Oracle Multimedia                          VALID      12.1.0.2.0  00:02:40
  20. Spatial                                UPGRADED      12.1.0.2.0  00:06:44
  21. Oracle Application Express                  VALID     4.2.5.00.08  00:36:01
  22. Final Actions                                                         00:02:04
  23. Post Upgrade                                                         00:03:27

  24. Total Upgrade Time: 01:27:14

  25. PL/SQL procedure successfully completed.

  26. SQL>
  27. SQL> --
  28. SQL> -- Update Summary Table with con_name and endtime.
  29. SQL> --
  30. SQL> UPDATE sys.registry$upg_summary SET reportname = :ReportName,
  31.   2                                       con_name = SYS_CONTEXT('USERENV','CON_NAME'),
  32.   3                                       endtime  = SYSDATE
  33.   4              WHERE con_id = -1;

  34. 1 row updated.

  35. SQL> commit;

  36. Commit complete.

  37. SQL>
复制代码
  1. SQL> @?/rdbms/admin/catuppst.sql
  2. SQL> Rem
  3. SQL> Rem $Header: rdbms/admin/catuppst.sql /st_rdbms_12.1/1 2014/06/11 20:58:01 surman Exp $
  4. SQL> Rem
  5. SQL> Rem catuppst.sql
  6. SQL> Rem
  7. SQL> Rem Copyright (c) 2006, 2014, Oracle and/or its affiliates.
  8. SQL> Rem All rights reserved.
  9. SQL> Rem
  10. SQL> Rem    NAME
  11. SQL> Rem         catuppst.sql - CATalog UPgrade PoST-upgrade actions
  12. SQL> Rem
  13. SQL> Rem    DESCRIPTION
  14. SQL> Rem         This post-upgrade script performs remaining upgrade actions that
  15. SQL> Rem         do not require that the database be open in UPGRADE mode.
  16. SQL> Rem         Automatically apply the latest PSU.
  17. SQL> Rem
  18. SQL> Rem    NOTES
  19. SQL> Rem         You must be connected AS SYSDBA to run this script.
  20. SQL> Rem
  21. SQL> Rem    MODIFIED   (MM/DD/YY)
  22. SQL> Rem    surman        06/05/14 - Backport surman_bug-17277459 from main
  23. SQL> Rem    surman        05/19/14 - 17277459: Remove call to catbundle
  24. SQL> Rem    jerrede        01/17/14 - Fix Bug 18071399 Add Post Upgrade Report Time
  25. SQL> Rem    surman        05/31/13 - 16790144: Use @@
  26. SQL> Rem    cmlim        05/15/13 - bug 16816410: add table name to errorlogging
  27. SQL> Rem                           syntax
  28. SQL> Rem    surman        03/19/13 - 16094163: Add catbundleapply.sql
  29. SQL> Rem    cmlim        03/01/13 - bug 16306200: remove the workaround (added in
  30. SQL> Rem                           txn in bug 16085743) that re-updated
  31. SQL> Rem                           oracle-supplied bit in views owned by SYS after
  32. SQL> Rem                           bootstrap.  Workaround not needed once the shared
  33. SQL> Rem                           pool is flushed in catuposb.sql (bug 16306200).
  34. SQL> Rem    jerrede        01/14/13 - XbranchMerge jerrede_bug-16097914 from
  35. SQL> Rem                           st_rdbms_12.1.0.1
  36. SQL> Rem    jerrede        01/11/13 - Move Removal of EXF/RUL to upgrade.
  37. SQL> Rem                           LogMiner/Standyby can not deal with removing
  38. SQL> Rem                           a component outside of upgrade.
  39. SQL> Rem    sjanardh        01/10/13 - XbranchMerge maba_bug-14615619 from main
  40. SQL> Rem    jerrede        12/19/12 - Bug#16025279 Add Event for Not Removing EXF/RUL
  41. SQL> Rem                           Upgrade Components
  42. SQL> Rem    surman        12/10/12 - XbranchMerge surman_bug-12876907 from main
  43. SQL> Rem    maba        11/26/12 - fixed bug 14615619
  44. SQL> Rem    jerrede        11/05/12 - Add Exadata Bundle support
  45. SQL> Rem    cmlim        10/27/12 - bug 14258301 : gather fixed obj stats if none of
  46. SQL> Rem                           the fixed object tables have had stats collected
  47. SQL> Rem    mfallen        09/20/12 - bug 14390165: check if AWR data needs update
  48. SQL> Rem    jerrede        10/23/12 - Unset _ORACLE_SCRIPT
  49. SQL> Rem    jerrede        10/23/12 - Add Session Info
  50. SQL> Rem    maba        09/13/12 - added create dequeue log for bug 14278722
  51. SQL> Rem    jerrede        06/26/12 - Set event to optionally update required stats
  52. SQL> Rem                           during upgrade
  53. SQL> Rem    rpang        05/21/12 - Add network ACL migration status check
  54. SQL> Rem    traney        05/09/12 - lrg 6949943: mask ORA-942s
  55. SQL> Rem    jerrede        04/17/12 - Moved Mandatory Changes to catrequired.sql
  56. SQL> Rem    traney        04/04/12 - lrg 6762280: drop DBMS_DDL_INTERNAL_LIB
  57. SQL> Rem    traney        03/12/12 - bug 13719175: move post-utlmmig stats here
  58. SQL> Rem    cdilling        12/13/11 - drop SYSMAN schema - removal of EM component for
  59. SQL> Rem                           upgrade to 12.1
  60. SQL> Rem    aramappa        06/22/11 - Always run olstrig.sql when OLS installed in DB
  61. SQL> Rem    xbarr        04/28/11 - move DMSYS removal code to odmu112.sql
  62. SQL> Rem    xbarr        10/25/10 - run dmsysrem.sql to drop DMSYS schema if exists
  63. SQL> Rem    cdilling        07/21/10 - add call to catbundle.sql for bug 9925339
  64. SQL> Rem    srtata        12/16/08 - run olstrig.sql when upgrading from prior to 10.2
  65. SQL> Rem    srtata        10/15/08 - put back olstrig.sql as we found it cannot be run
  66. SQL> Rem                           as part of upgrade
  67. SQL> Rem    srtata        02/26/08 - move olstrig.sql to olsdbmig.sql
  68. SQL> Rem    ushaft        02/05/07 - post upgrade for ADDM tasks.
  69. SQL> Rem    cdilling        12/06/06 - add support for error logging
  70. SQL> Rem    rburns        11/10/06 - post upgrade actions
  71. SQL> Rem    rburns        11/10/06 - Created
  72. SQL> Rem
  73. SQL>
  74. SQL> Rem =====================================================================
  75. SQL> Rem Call Common session settings
  76. SQL> Rem =====================================================================
  77. SQL> @@catpses.sql
  78. SQL> Rem
  79. SQL> Rem $Header: rdbms/admin/catpses.sql /main/3 2014/02/20 12:45:39 surman Exp $
  80. SQL> Rem
  81. SQL> Rem catpses.sql
  82. SQL> Rem
  83. SQL> Rem Copyright (c) 2006, 2014, Oracle and/or its affiliates.
  84. SQL> Rem All rights reserved.
  85. SQL> Rem
  86. SQL> Rem    NAME
  87. SQL> Rem         catpses.sql - CATalog and CATProc SESsion script
  88. SQL> Rem
  89. SQL> Rem    DESCRIPTION
  90. SQL> Rem         This script initializes the session for running catalog
  91. SQL> Rem         and/or catproc scripts
  92. SQL> Rem
  93. SQL> Rem    NOTES
  94. SQL> Rem         It is used as the session script for parallel processes
  95. SQL> Rem         when catalog.sql and/or catproc.sql is run using multiprocesses
  96. SQL> Rem
  97. SQL> Rem BEGIN SQL_FILE_METADATA
  98. SQL> Rem SQL_SOURCE_FILE: rdbms/admin/catpses.sql
  99. SQL> Rem SQL_SHIPPED_FILE: rdbms/admin/catpses.sql
  100. SQL> Rem SQL_PHASE: CATPSES
  101. SQL> Rem SQL_STARTUP_MODE: NORMAL
  102. SQL> Rem SQL_IGNORABLE_ERRORS: NONE
  103. SQL> Rem SQL_CALLING_FILE: rdbms/admin/cdstrt.sql
  104. SQL> Rem END SQL_FILE_METADATA
  105. SQL> Rem
  106. SQL> Rem    MODIFIED   (MM/DD/YY)
  107. SQL> Rem    surman        12/29/13 - 13922626: Update SQL metadata
  108. SQL> Rem    jerrede        05/08/12 - Added session info for CDB.
  109. SQL> Rem    rburns        10/23/06 - add session script
  110. SQL> Rem    rburns        10/23/06 - Created
  111. SQL> Rem
  112. SQL>
  113. SQL> @@?/rdbms/admin/sqlsessstart.sql
  114. SQL> Rem
  115. SQL> Rem $Header: rdbms/admin/sqlsessstart.sql /main/1 2013/03/13 13:08:33 surman Exp $
  116. SQL> Rem
  117. SQL> Rem sqlsessstart.sql
  118. SQL> Rem
  119. SQL> Rem Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  120. SQL> Rem
  121. SQL> Rem    NAME
  122. SQL> Rem         sqlsessstart.sql - SQL session start
  123. SQL> Rem
  124. SQL> Rem    DESCRIPTION
  125. SQL> Rem         Any commands which should be run at the start of all oracle
  126. SQL> Rem         supplied scripts.
  127. SQL> Rem
  128. SQL> Rem    NOTES
  129. SQL> Rem         See sqlsessend.sql for the corresponding end script.
  130. SQL> Rem
  131. SQL> Rem    MODIFIED   (MM/DD/YY)
  132. SQL> Rem    surman        03/08/13 - 16462837: Common start and end scripts
  133. SQL> Rem    surman        03/08/13 - Created
  134. SQL> Rem
  135. SQL>
  136. SQL> alter session set "_ORACLE_SCRIPT" = true;

  137. Session altered.

  138. SQL>
  139. SQL> Rem =====================================================================
  140. SQL> Rem Assure CHAR semantics are not used in the dictionary
  141. SQL> Rem =====================================================================
  142. SQL> ALTER SESSION SET NLS_LENGTH_SEMANTICS=BYTE;

  143. Session altered.

  144. SQL>
  145. SQL> Rem =====================================================================
  146. SQL> Rem Needed for Consolidated databases
  147. SQL> Rem =====================================================================
  148. SQL> ALTER SESSION SET "_ORACLE_SCRIPT"=true;

  149. Session altered.

  150. SQL>
  151. SQL>
  152. SQL>
  153. SQL> @?/rdbms/admin/sqlsessend.sql
  154. SQL> Rem
  155. SQL> Rem $Header: rdbms/admin/sqlsessend.sql /main/1 2013/03/13 13:08:33 surman Exp $
  156. SQL> Rem
  157. SQL> Rem sqlsessend.sql
  158. SQL> Rem
  159. SQL> Rem Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  160. SQL> Rem
  161. SQL> Rem    NAME
  162. SQL> Rem         sqlsessend.sql - SQL session end
  163. SQL> Rem
  164. SQL> Rem    DESCRIPTION
  165. SQL> Rem         Any commands which should be run at the end of all oracle
  166. SQL> Rem         supplied scripts.
  167. SQL> Rem
  168. SQL> Rem    NOTES
  169. SQL> Rem         See sqlsessstart.sql for the corresponding start script.
  170. SQL> Rem
  171. SQL> Rem    MODIFIED   (MM/DD/YY)
  172. SQL> Rem    surman        03/08/13 - 16462837: Common start and end scripts
  173. SQL> Rem    surman        03/08/13 - Created
  174. SQL> Rem
  175. SQL>
  176. SQL> alter session set "_ORACLE_SCRIPT" = false;

  177. Session altered.

  178. SQL>
  179. SQL>
  180. SQL>
  181. SQL> Rem *********************************************************************
  182. SQL> Rem BEGIN catuppst.sql
  183. SQL> Rem *********************************************************************
  184. SQL> Rem Set identifier to POSTUP for errorlogging
  185. SQL>
  186. SQL> SET ERRORLOGGING ON TABLE SYS.REGISTRY$ERROR IDENTIFIER 'POSTUP';
  187. SQL>
  188. SQL> SELECT dbms_registry_sys.time_stamp('POSTUP_BGN') as timestamp from dual;

  189. TIMESTAMP
  190. --------------------------------------------------------------------------------
  191. COMP_TIMESTAMP POSTUP_BGN 2020-12-13 15:13:34

  192. SQL>
  193. SQL> Rem =======================================================================
  194. SQL> Rem  Run Post Upgrade Operations
  195. SQL> Rem =======================================================================
  196. SQL>
  197. SQL> @@catrequired.sql
  198. SQL> Rem
  199. SQL> Rem $Header: rdbms/admin/catrequired.sql /main/1 2012/07/19 11:27:56 jerrede Exp $
  200. SQL> Rem
  201. SQL> Rem catrequired.sql
  202. SQL> Rem
  203. SQL> Rem Copyright (c) 2006, 2012, Oracle and/or its affiliates.
  204. SQL> Rem All rights reserved.
  205. SQL> Rem
  206. SQL> Rem    NAME
  207. SQL> Rem         catrequired.sql - Catalog Mandatory Upgrade Script
  208. SQL> Rem
  209. SQL> Rem    DESCRIPTION
  210. SQL> Rem         This catalog script is a place holder
  211. SQL> Rem         for other things that may be added in the future.
  212. SQL> Rem         Right now it only calls catrequtlmg.sql.
  213. SQL> Rem
  214. SQL> Rem    NOTES
  215. SQL> Rem         You must be connected AS SYSDBA to run this script.
  216. SQL> Rem
  217. SQL> Rem    MODIFIED   (MM/DD/YY)
  218. SQL> Rem          jerrede        04/17/12 - Created
  219. SQL> Rem
  220. SQL>
  221. SQL>
  222. SQL> Rem *********************************************************************
  223. SQL> Rem BEGIN catrequired.sql
  224. SQL> Rem *********************************************************************
  225. SQL>
  226. SQL> Rem
  227. SQL> Rem Display Start TimeStamp
  228. SQL> Rem
  229. SQL> SELECT sys.dbms_registry_sys.time_stamp('catreq_bgn') as timestamp from dual;

  230. TIMESTAMP
  231. --------------------------------------------------------------------------------
  232. COMP_TIMESTAMP CATREQ_BGN 2020-12-13 15:13:34

  233. SQL>
  234. SQL>
  235. SQL> Rem
  236. SQL> Rem Post-utlmmig statistics gathering
  237. SQL> Rem
  238. SQL> @@catrequtlmg.sql
  239. SQL> Rem
  240. SQL> Rem $Header: rdbms/admin/catrequtlmg.sql /main/2 2013/01/09 14:23:01 jerrede Exp $
  241. SQL> Rem
  242. SQL> Rem catrequtlmg.sql
  243. SQL> Rem
  244. SQL> Rem Copyright (c) 2006, 2013, Oracle and/or its affiliates.
  245. SQL> Rem All rights reserved.
  246. SQL> Rem
  247. SQL> Rem    NAME
  248. SQL> Rem         catrequtlmg.sql - Catalog Mandatory Upgrade Script
  249. SQL> Rem
  250. SQL> Rem    DESCRIPTION
  251. SQL> Rem         This catalog script can run from utlmmig.sql or catuppst.sql.
  252. SQL> Rem         The event _utlmmig_table_stats_gathering determines where it
  253. SQL> Rem         is run.  If TRUE (the default) it is run from utlmmig.sql, if
  254. SQL> Rem         FALSE it will be run from catuppst.sql. This script gathers
  255. SQL> Rem         statistics on migration stats that are recreated after an
  256. SQL> Rem         upgrade occurs.
  257. SQL> Rem
  258. SQL> Rem    NOTES
  259. SQL> Rem         You must be connected AS SYSDBA to run this script.
  260. SQL> Rem
  261. SQL> Rem    MODIFIED   (MM/DD/YY)
  262. SQL> Rem    jerrede        12/20/12 - Turn off set serveroutput
  263. SQL> Rem    jerrede        04/17/12 - Moved from catuppst.sql
  264. SQL> Rem                           which was written by Tom Raney.
  265. SQL> Rem
  266. SQL>
  267. SQL>
  268. SQL> Rem *********************************************************************
  269. SQL> Rem BEGIN catrequtlmg.sql
  270. SQL> Rem *********************************************************************
  271. SQL>
  272. SQL> Rem =======================================================================
  273. SQL> Rem Statistics gathering
  274. SQL> Rem =======================================================================
  275. SQL> -- DBMS_STATS now depends on DBMS_UTILITY which may have gotten invalidated
  276. SQL> -- by some preceeding DDL statement, so package state needs to be cleared to
  277. SQL> -- avoid ORA-04068, reset_package causes set serveroutput on to not work.
  278. SQL>
  279. SQL> execute dbms_session.reset_package;

  280. PL/SQL procedure successfully completed.

  281. SQL> set serveroutput on;
  282. SQL>
  283. SQL> declare
  284.   2  
  285.   3    n_SampleSize                NUMBER           := DBMS_STATS.AUTO_SAMPLE_SIZE;
  286.   4    c_UPGSAMPLESIZE CONSTANT NUMBER           := 100;
  287.   5    c_TRACEEVENT CONSTANT VARCHAR2(30)  := '_utlmmig_table_stats_gathering';
  288.   6    c_POSTUPGRADE CONSTANT VARCHAR2(19) := 'CATREQ_POST_UPGRADE';
  289.   7    c_BOOTERR CONSTANT VARCHAR2(23)           := 'BOOTSTRAP_UPGRADE_ERROR';
  290.   8    c_MIGTABLE CONSTANT VARCHAR2(4)           := '$MIG';
  291.   9    c_POSTUPGTABLE CONSTANT VARCHAR2(1) := '



  292. ;
  293. 10    s_TableName VARCHAR2(4)                   := c_MIGTABLE;
  294. 11    b_InUtlMig BOOLEAN := sys.dbms_registry_sys.select_props_data(c_BOOTERR);
  295. 12    b_UpgradeMode BOOLEAN := sys.dbms_registry.is_in_upgrade_mode();
  296. 13    b_StatEvt  BOOLEAN := sys.dbms_registry.is_trace_event_set(c_TRACEEVENT);
  297. 14    b_SelProps BOOLEAN := sys.dbms_registry_sys.select_props_data(c_POSTUPGRADE);
  298. 15    b_Props BOOLEAN := TRUE;
  299. 16  
  300. 17  begin
  301. 18  
  302. 19    --
  303. 20    -- Debug Info
  304. 21    --
  305. 22    IF (b_StatEvt) THEN
  306. 23           sys.dbms_output.put_line('catrequtlmg: b_StatEvt     = TRUE');
  307. 24    ELSE
  308. 25           sys.dbms_output.put_line('catrequtlmg: b_StatEvt     = FALSE');
  309. 26    END IF;
  310. 27  
  311. 28    IF (b_SelProps) THEN
  312. 29           sys.dbms_output.put_line('catrequtlmg: b_SelProps    = TRUE');
  313. 30    ELSE
  314. 31           sys.dbms_output.put_line('catrequtlmg: b_SelProps    = FALSE');
  315. 32    END IF;
  316. 33  
  317. 34    IF (b_UpgradeMode) THEN
  318. 35           sys.dbms_output.put_line('catrequtlmg: b_UpgradeMode = TRUE');
  319. 36    ELSE
  320. 37           sys.dbms_output.put_line('catrequtlmg: b_UpgradeMode = FALSE');
  321. 38    END IF;
  322. 39  
  323. 40    IF (b_InUtlMig) THEN
  324. 41           sys.dbms_output.put_line('catrequtlmg: b_InUtlMig    = TRUE');
  325. 42    ELSE
  326. 43           sys.dbms_output.put_line('catrequtlmg: b_InUtlMig    = FALSE');
  327. 44           s_TableName := c_POSTUPGTABLE;
  328. 45    END IF;
  329. 46  
  330. 47    --
  331. 48    -- b_StatEvt = FALSE indicates don't collect stats
  332. 49    --              in upgrade mode.
  333. 50    --
  334. 51    -- Don't do the migration stats in UPGRADE mode.
  335. 52    -- Stats will run no matter what mode we are in
  336. 53    -- if post upgrade data is found in sys.props$.
  337. 54    --
  338. 55    IF (b_StatEvt = FALSE AND b_SelProps = FALSE) THEN
  339. 56  
  340. 57           --
  341. 58           -- In Upgrade Mode Only
  342. 59           --
  343. 60           IF (b_UpgradeMode) THEN
  344. 61  
  345. 62             --
  346. 63             -- Set sys.props$ table indicating that it
  347. 64             -- needs to be run in the post upgrade script.
  348. 65             --
  349. 66             b_Props := sys.dbms_registry_sys.insert_props_data(c_POSTUPGRADE,
  350. 67                      'Run Migration Stats',
  351. 68                      'Startup database in normal mode and run catuppst.sql');
  352. 69             IF (b_Props) THEN
  353. 70               sys.dbms_output.put_line('catrequtlmg: insert_props_data: Success');
  354. 71             ELSE
  355. 72               sys.dbms_output.put_line('catrequtlmg: insert_props_data: Failure');
  356. 73             END IF;
  357. 74  
  358. 75           END IF;
  359. 76  
  360. 77           RETURN;
  361. 78  
  362. 79    END IF;
  363. 80  
  364. 81    --
  365. 82    -- b_StatEvt = TRUE indicates collect stats
  366. 83    --              in upgrade mode.
  367. 84    --
  368. 85    -- Don't do the migration stats in NORMAL mode.
  369. 86    -- Stats will run no matter what mode we are in
  370. 87    -- if post upgrade data is found in sys.props$.
  371. 88    --
  372. 89    IF (b_StatEvt = TRUE AND b_SelProps = FALSE AND b_UpgradeMode = FALSE) THEN
  373. 90  
  374. 91             RETURN;
  375. 92  
  376. 93    END IF;
  377. 94  
  378. 95    --
  379. 96    -- Updating migration stats in post upgrade. Write an entry to
  380. 97    -- sys.props$ table to indicate that stat collection has started.
  381. 98    -- If this entry is present then this routine has failed.
  382. 99    --
  383. 100    IF (b_SelProps) THEN
  384. 101  
  385. 102           b_Props := sys.dbms_registry_sys.update_props_data(c_POSTUPGRADE,
  386. 103                                                'Started Migration Stats');
  387. 104           IF (b_Props) THEN
  388. 105             sys.dbms_output.put_line('catrequtlmg: update_props_data: Success');
  389. 106           ELSE
  390. 107             sys.dbms_output.put_line('catrequtlmg: update_props_data: Failure');
  391. 108           END IF;
  392. 109  
  393. 110    END IF;
  394. 111  
  395. 112    --
  396. 113    -- If we are in upgrade mode turn auto sample size off
  397. 114    -- results in a bug when we try and do a recomp in
  398. 115    -- utlrp.
  399. 116    --
  400. 117    IF (b_UpgradeMode) THEN
  401. 118           n_SampleSize := c_UPGSAMPLESIZE;
  402. 119    END IF;
  403. 120  
  404. 121    --
  405. 122    -- Delete Stats
  406. 123    --
  407. 124    sys.dbms_output.put_line('catrequtlmg: Deleting table stats');
  408. 125    sys.dbms_stats.delete_table_stats('SYS', 'OBJ' || s_TableName);
  409. 126    sys.dbms_stats.delete_table_stats('SYS', 'USER' || s_TableName);
  410. 127    sys.dbms_stats.delete_table_stats('SYS', 'COL' || s_TableName);
  411. 128    sys.dbms_stats.delete_table_stats('SYS', 'CLU' || s_TableName);
  412. 129    sys.dbms_stats.delete_table_stats('SYS', 'CON' || s_TableName);
  413. 130    sys.dbms_stats.delete_table_stats('SYS', 'TAB' || s_TableName);
  414. 131    sys.dbms_stats.delete_table_stats('SYS', 'IND' || s_TableName);
  415. 132    sys.dbms_stats.delete_table_stats('SYS', 'ICOL' || s_TableName);
  416. 133    sys.dbms_stats.delete_table_stats('SYS', 'LOB' || s_TableName);
  417. 134    sys.dbms_stats.delete_table_stats('SYS', 'COLTYPE' || s_TableName);
  418. 135    sys.dbms_stats.delete_table_stats('SYS', 'SUBCOLTYPE' || s_TableName);
  419. 136    sys.dbms_stats.delete_table_stats('SYS', 'NTAB' || s_TableName);
  420. 137    sys.dbms_stats.delete_table_stats('SYS', 'REFCON' || s_TableName);
  421. 138    sys.dbms_stats.delete_table_stats('SYS', 'OPQTYPE' || s_TableName);
  422. 139    sys.dbms_stats.delete_table_stats('SYS', 'ICOLDEP' || s_TableName);
  423. 140    sys.dbms_stats.delete_table_stats('SYS', 'TSQ' || s_TableName);
  424. 141    sys.dbms_stats.delete_table_stats('SYS', 'VIEWTRCOL' || s_TableName);
  425. 142    sys.dbms_stats.delete_table_stats('SYS', 'ATTRCOL' || s_TableName);
  426. 143    sys.dbms_stats.delete_table_stats('SYS', 'TYPE_MISC' || s_TableName);
  427. 144    sys.dbms_stats.delete_table_stats('SYS', 'LIBRARY' || s_TableName);
  428. 145    sys.dbms_stats.delete_table_stats('SYS', 'ASSEMBLY' || s_TableName);
  429. 146  
  430. 147    --
  431. 148    -- Gather Stats
  432. 149    --
  433. 150    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats OBJ' ||
  434. 151                                  s_TableName);
  435. 152    sys.dbms_stats.gather_table_stats('SYS', 'OBJ' || s_TableName,
  436. 153                                       estimate_percent => n_SampleSize,
  437. 154                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  438. 155    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats USER' ||
  439. 156                                  s_TableName);
  440. 157    sys.dbms_stats.gather_table_stats('SYS', 'USER' || s_TableName,
  441. 158                                       estimate_percent => n_SampleSize,
  442. 159                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  443. 160    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats COL' ||
  444. 161                                  s_TableName);
  445. 162    sys.dbms_stats.gather_table_stats('SYS', 'COL' || s_TableName,
  446. 163                                       estimate_percent => n_SampleSize,
  447. 164                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  448. 165    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats CLU' ||
  449. 166                                   s_TableName);
  450. 167    sys.dbms_stats.gather_table_stats('SYS', 'CLU' || s_TableName,
  451. 168                                       estimate_percent => n_SampleSize,
  452. 169                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  453. 170    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats CON' ||
  454. 171                                   s_TableName);
  455. 172    sys.dbms_stats.gather_table_stats('SYS', 'CON' || s_TableName,
  456. 173                                       estimate_percent => n_SampleSize,
  457. 174                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  458. 175    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats TAB' ||
  459. 176                                  s_TableName);
  460. 177    sys.dbms_stats.gather_table_stats('SYS', 'TAB' || s_TableName,
  461. 178                                       estimate_percent => n_SampleSize,
  462. 179                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  463. 180    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats IND' ||
  464. 181                                  s_TableName);
  465. 182    sys.dbms_stats.gather_table_stats('SYS', 'IND' || s_TableName,
  466. 183                                       estimate_percent => n_SampleSize,
  467. 184                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  468. 185    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats ICOL' ||
  469. 186                                  s_TableName);
  470. 187    sys.dbms_stats.gather_table_stats('SYS', 'ICOL' || s_TableName,
  471. 188                                       estimate_percent => n_SampleSize,
  472. 189                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  473. 190    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats LOB' ||
  474. 191                                   s_TableName);
  475. 192    sys.dbms_stats.gather_table_stats('SYS', 'LOB' || s_TableName,
  476. 193                                       estimate_percent => n_SampleSize,
  477. 194                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  478. 195    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats COLTYPE' ||
  479. 196                                  s_TableName);
  480. 197    sys.dbms_stats.gather_table_stats('SYS', 'COLTYPE' || s_TableName,
  481. 198                                       estimate_percent => n_SampleSize,
  482. 199                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  483. 200    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats SUBCOLTYPE' ||
  484. 201                                  s_TableName);
  485. 202    sys.dbms_stats.gather_table_stats('SYS', 'SUBCOLTYPE' || s_TableName,
  486. 203                                       estimate_percent => n_SampleSize,
  487. 204                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  488. 205    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats NTAB' ||
  489. 206                                  s_TableName);
  490. 207    sys.dbms_stats.gather_table_stats('SYS', 'NTAB' || s_TableName,
  491. 208                                       estimate_percent => n_SampleSize,
  492. 209                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  493. 210    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats REFCON' ||
  494. 211                                  s_TableName);
  495. 212    sys.dbms_stats.gather_table_stats('SYS', 'REFCON' || s_TableName,
  496. 213                                       estimate_percent => n_SampleSize,
  497. 214                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  498. 215    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats OPQTYPE' ||
  499. 216                                  s_TableName);
  500. 217    sys.dbms_stats.gather_table_stats('SYS', 'OPQTYPE' || s_TableName,
  501. 218                                       estimate_percent => n_SampleSize,
  502. 219                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  503. 220    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats ICOLDEP' ||
  504. 221                                  s_TableName);
  505. 222    sys.dbms_stats.gather_table_stats('SYS', 'ICOLDEP' || s_TableName,
  506. 223                                       estimate_percent => n_SampleSize,
  507. 224                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  508. 225    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats TSQ' ||
  509. 226                                  s_TableName);
  510. 227    sys.dbms_stats.gather_table_stats('SYS', 'TSQ' || s_TableName,
  511. 228                                       estimate_percent => n_SampleSize,
  512. 229                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  513. 230    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats VIEWTRCOL' ||
  514. 231                                  s_TableName);
  515. 232    sys.dbms_stats.gather_table_stats('SYS', 'VIEWTRCOL' || s_TableName,
  516. 233                                       estimate_percent => n_SampleSize,
  517. 234                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  518. 235    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats ATTRCOL' ||
  519. 236                                  s_TableName);
  520. 237    sys.dbms_stats.gather_table_stats('SYS', 'ATTRCOL' || s_TableName,
  521. 238                                       estimate_percent => n_SampleSize,
  522. 239                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  523. 240    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats TYPE_MISC' ||
  524. 241                                  s_TableName);
  525. 242    sys.dbms_stats.gather_table_stats('SYS', 'TYPE_MISC' || s_TableName,
  526. 243                                       estimate_percent => n_SampleSize,
  527. 244                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  528. 245    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats LIBRARY' ||
  529. 246                                  s_TableName);
  530. 247    sys.dbms_stats.gather_table_stats('SYS', 'LIBRARY' || s_TableName,
  531. 248                                       estimate_percent => n_SampleSize,
  532. 249                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  533. 250    sys.dbms_output.put_line('catrequtlmg: Gathering Table Stats ASSEMBLY' ||
  534. 251                                  s_TableName);
  535. 252    sys.dbms_stats.gather_table_stats('SYS', 'ASSEMBLY' || s_TableName,
  536. 253                                       estimate_percent => n_SampleSize,
  537. 254                                       method_opt=>'FOR ALL COLUMNS SIZE SKEWONLY');
  538. 255  
  539. 256  
  540. 257    --
  541. 258    -- Delete any previous entry that may have been stored in
  542. 259    -- sys.props$ table.
  543. 260    --
  544. 261    b_Props := sys.dbms_registry_sys.delete_props_data(c_POSTUPGRADE);
  545. 262    IF (b_Props) THEN
  546. 263           sys.dbms_output.put_line('catrequtlmg: delete_props_data: Success');
  547. 264    ELSE
  548. 265           sys.dbms_output.put_line('catrequtlmg: delete_props_data: No Props Data');
  549. 266    END IF;
  550. 267  
  551. 268  end;
  552. 269  /
  553. catrequtlmg: b_StatEvt           = TRUE
  554. catrequtlmg: b_SelProps    = FALSE
  555. catrequtlmg: b_UpgradeMode = FALSE
  556. catrequtlmg: b_InUtlMig    = FALSE

  557. PL/SQL procedure successfully completed.

  558. SQL>
  559. SQL> --
  560. SQL> -- Set serveroutput off
  561. SQL> --
  562. SQL> set serveroutput off;
  563. SQL>
  564. SQL> --
  565. SQL> -- Reset Package to be on the safe side for the
  566. SQL> -- case where we are running in catuppst.sql
  567. SQL> --
  568. SQL> execute dbms_session.reset_package;

  569. PL/SQL procedure successfully completed.

  570. SQL>
  571. SQL>
  572. SQL> Rem *********************************************************************
  573. SQL> Rem END catrequtlmg.sql
  574. SQL> Rem *********************************************************************
  575. SQL>
  576. SQL>
  577. SQL>
  578. SQL> Rem
  579. SQL> Rem Display End TimeStamp
  580. SQL> Rem
  581. SQL> SELECT sys.dbms_registry_sys.time_stamp('catreq_end') as timestamp from dual;

  582. TIMESTAMP
  583. --------------------------------------------------------------------------------
  584. COMP_TIMESTAMP CATREQ_END 2020-12-13 15:13:34

  585. SQL>
  586. SQL> Rem *********************************************************************
  587. SQL> Rem END catrequired.sql
  588. SQL> Rem *********************************************************************
  589. SQL>
  590. SQL>
  591. SQL> --
  592. SQL> -- These were created in utlmmig.sql but could not be dropped until now.
  593. SQL> -- Suppress "does not exist" errors.
  594. SQL> --
  595. SQL> set serveroutput on;
  596. SQL> begin
  597.   2    sys.dbms_output.put_line('catuppst: Dropping library DBMS_DDL_INTERNAL_LIB');
  598.   3    execute immediate 'drop library DBMS_DDL_INTERNAL_LIB';
  599.   4  exception
  600.   5    when others then
  601.   6    if sqlcode = -4043 then
  602.   7             null;
  603.   8    end if;
  604.   9  end;
  605. 10  /
  606. catuppst: Dropping library DBMS_DDL_INTERNAL_LIB

  607. PL/SQL procedure successfully completed.

  608. SQL>
  609. SQL> begin
  610.   2    sys.dbms_output.put_line('catuppst: Dropping view _CURRENT_EDITION_OBJ_MIG');
  611.   3    execute immediate 'drop view "_CURRENT_EDITION_OBJ_MIG"';
  612.   4  exception
  613.   5    when others then
  614.   6           if sqlcode = -942 then
  615.   7             null;
  616.   8           end if;
  617.   9  end;
  618. 10  /
  619. catuppst: Dropping view _CURRENT_EDITION_OBJ_MIG

  620. PL/SQL procedure successfully completed.

  621. SQL>
  622. SQL> begin
  623.   2    sys.dbms_output.put_line('catuppst: Dropping view _ACTUAL_EDITION_OBJ_MIG');
  624.   3    execute immediate 'drop view "_ACTUAL_EDITION_OBJ_MIG"';
  625.   4  exception
  626.   5    when others then
  627.   6           if sqlcode = -942 then
  628.   7             null;
  629.   8           end if;
  630.   9  end;
  631. 10  /
  632. catuppst: Dropping view _ACTUAL_EDITION_OBJ_MIG

  633. PL/SQL procedure successfully completed.

  634. SQL>
  635. SQL> set serveroutput off;
  636. SQL>
  637. SQL>
  638. SQL> Rem =======================================================================
  639. SQL> Rem Upgrade AWR Baseline information
  640. SQL> Rem =======================================================================
  641. SQL>
  642. SQL> @@awrblmig.sql
  643. SQL> Rem
  644. SQL> Rem $Header: awrblmig.sql 16-nov-2006.14:53:14 rburns Exp $
  645. SQL> Rem
  646. SQL> Rem awrblmig.sql
  647. SQL> Rem
  648. SQL> Rem Copyright (c) 2006, Oracle. All rights reserved.
  649. SQL> Rem
  650. SQL> Rem    NAME
  651. SQL> Rem         awrblmig.sql - AWR Baseline Migrate
  652. SQL> Rem
  653. SQL> Rem    DESCRIPTION
  654. SQL> Rem         This script is used to migrate the AWR Baseline data from
  655. SQL> Rem         the renamed BL tables back to the base tables.  This script is
  656. SQL> Rem         needed because the way the baselines are stored have been changed
  657. SQL> Rem         in 11g.  This script will
  658. SQL> Rem
  659. SQL> Rem    NOTES
  660. SQL> Rem         Run this script if you have AWR Baselines prior to the 11g release
  661. SQL> Rem         and have upgraded to the 11g release.
  662. SQL> Rem
  663. SQL> Rem    MODIFIED   (MM/DD/YY)
  664. SQL> Rem    rburns        11/16/06 - modify set statements
  665. SQL> Rem    mlfeng        06/18/06 - Script to migrate the AWR Baseline data
  666. SQL> Rem    mlfeng        06/18/06 - Created
  667. SQL> Rem
  668. SQL>
  669. SQL> set serveroutput on;
  670. SQL> exec dbms_output.enable(100000);

  671. PL/SQL procedure successfully completed.

  672. SQL>
  673. SQL> prompt

  674. SQL> prompt This script will migrate the Baseline data on a pre-11g database
  675. This script will migrate the Baseline data on a pre-11g database
  676. SQL> prompt to the 11g database.
  677. to the 11g database.
  678. SQL> prompt

  679. SQL>
  680. SQL> begin
  681.   2    dbms_swrf_internal.baseline_migrate(migrate_tables => TRUE,
  682.   3                                             drop_tables          => TRUE);
  683.   4  end;
  684.   5  /
  685. ...                                          ...
  686. ... Completed Moving the Baseline Data          ...
  687. ...                                          ...
  688. ... If there are no Move BL Data messages ...
  689. ... above, then there are no renamed          ...
  690. ... baseline tables in the system.          ...
  691. ...                                          ...
  692. ...                                          ...
  693. ... Completed the Dropping of the          ...
  694. ... Renamed Baseline Tables                  ...
  695. ...                                          ...
  696. ... If there are no Drop Table messages   ...
  697. ... above, then there are no renamed          ...
  698. ... baseline tables in the system.          ...
  699. ...                                          ...

  700. PL/SQL procedure successfully completed.

  701. SQL>
  702. SQL> set serveroutput off
  703. SQL>
  704. SQL> Rem =======================================================================
  705. SQL> Rem AWR inactive DBIDs check
  706. SQL> Rem =======================================================================
  707. SQL>
  708. SQL> set serveroutput on
  709. SQL>
  710. SQL> declare
  711.   2    cnt number;
  712.   3  begin
  713.   4    select count(*) into cnt
  714.   5           from sys.wrm$_wr_control
  715.   6          where bitand(status_flag, 4) = 4;
  716.   7    if (cnt > 0) then
  717.   8           dbms_output.put_line(
  718.   9             'AWR has data for ' || cnt || ' different DBID(s) that need updating.');
  719. 10           dbms_output.put_line(
  720. 11             'These are either imported AWR snapshots, or snapshots from before');
  721. 12           dbms_output.put_line(
  722. 13             'changing the DBID of the database. You will not be able to import');
  723. 14           dbms_output.put_line(
  724. 15             'additional data for those DBIDs until they are updated.');
  725. 16           dbms_output.put_line(
  726. 17             'Please use the rdbms/admin/awrupd12.sql script to update data for ' ||
  727. 18             'those DBIDs after the database has been upgraded.');
  728. 19    end if;
  729. 20  end;
  730. 21  /

  731. PL/SQL procedure successfully completed.

  732. SQL>
  733. SQL> set serveroutput off
  734. SQL>
  735. SQL> Rem =======================================================================
  736. SQL> Rem Upgrade ADDM task metadata
  737. SQL> Rem =======================================================================
  738. SQL>
  739. SQL> @@addmtmig.sql
  740. SQL> Rem
  741. SQL> Rem $Header: addmtmig.sql 26-feb-2007.04:29:23 sburanaw Exp $
  742. SQL> Rem
  743. SQL> Rem addmtmig.sql
  744. SQL> Rem
  745. SQL> Rem Copyright (c) 2007, Oracle. All rights reserved.
  746. SQL> Rem
  747. SQL> Rem    NAME
  748. SQL> Rem         addmtmig.sql - ADDM Task Migration
  749. SQL> Rem
  750. SQL> Rem    DESCRIPTION
  751. SQL> Rem         Post upgrade script for 11.1 release to fill new ADDM task
  752. SQL> Rem         metadata tables with derived information.
  753. SQL> Rem
  754. SQL> Rem    NOTES
  755. SQL> Rem         If this script is not included in post-upgrade, EM performance
  756. SQL> Rem         pages will not be able to display 10g ADDM tasks properly.
  757. SQL> Rem         There is no other effect on the database.
  758. SQL> Rem
  759. SQL> Rem    MODIFIED   (MM/DD/YY)
  760. SQL> Rem    sburanaw        02/23/07 - fix microsecond for wri$_adv_addm_task
  761. SQL> Rem    ushaft        02/05/07 - Created
  762. SQL> Rem
  763. SQL>
  764. SQL> Rem
  765. SQL> Rem Find the tasks that need to be upgraded.
  766. SQL> Rem
  767. SQL>
  768. SQL> insert into wri$_adv_addm_tasks
  769.   2  (TASK_ID,
  770.   3   DBID,
  771.   4   BEGIN_SNAP_ID,
  772.   5   END_SNAP_ID,
  773.   6   REQUESTED_ANALYSIS,
  774.   7   ACTUAL_ANALYSIS,
  775.   8   DATABASE_TIME)
  776.   9  select t.task_id,
  777. 10              to_number(p_dbid.parameter_value),
  778. 11              to_number(p_bid.parameter_value),
  779. 12              to_number(p_eid.parameter_value),
  780. 13              'INSTANCE', 'INSTANCE',
  781. 14              to_number(p_dbt.parameter_value)
  782. 15  from   dba_advisor_tasks t,
  783. 16              dba_advisor_parameters p_dbid,
  784. 17              dba_advisor_parameters p_bid,
  785. 18              dba_advisor_parameters p_eid,
  786. 19              dba_advisor_parameters p_dbt
  787. 20  where  t.advisor_name = 'ADDM'
  788. 21    and  t.status = 'COMPLETED'
  789. 22    and  p_dbid.task_id = t.task_id
  790. 23    and  p_dbid.parameter_name = 'DB_ID'
  791. 24    and  p_bid.task_id = t.task_id
  792. 25    and  p_bid.parameter_name = 'START_SNAPSHOT'
  793. 26    and  p_eid.task_id = t.task_id
  794. 27    and  p_eid.parameter_name = 'END_SNAPSHOT'
  795. 28    and  p_dbt.task_id = t.task_id
  796. 29    and  p_dbt.parameter_name = 'DB_ELAPSED_TIME'
  797. 30    and  t.task_id not in (select task_id from wri$_adv_addm_tasks);

  798. 0 rows created.

  799. SQL>
  800. SQL> commit;

  801. Commit complete.

  802. SQL>
  803. SQL> Rem
  804. SQL> Rem Add the estimated analysis version.
  805. SQL> Rem
  806. SQL>
  807. SQL> CREATE GLOBAL TEMPORARY TABLE addm$dbv (
  808.   2    exec_from         timestamp(3),
  809.   3    exec_to              timestamp(3),
  810.   4    db_version         varchar2(17)
  811.   5  )
  812.   6  ON COMMIT DELETE ROWS;

  813. Table created.

  814. SQL>
  815. SQL> insert into addm$dbv
  816.   2  select min(startup_time), null, version
  817.   3  from   wrm$_database_instance
  818.   4  where  dbid = (select dbid from v$database)
  819.   5  group by version;

  820. 2 rows created.

  821. SQL>
  822. SQL> update addm$dbv a
  823.   2  set    a.exec_from = (select cast(min(execution_end) as timestamp)
  824.   3                             from   dba_advisor_tasks)
  825.   4  where  a.exec_from =
  826.   5              (select min(exec_from)
  827.   6               from   addm$dbv);

  828. 1 row updated.

  829. SQL>
  830. SQL> update addm$dbv a
  831.   2  set    a.exec_to =
  832.   3             (select nvl(min(exec_from), cast(sysdate as timestamp))
  833.   4              from   addm$dbv b
  834.   5              where  b.exec_from > a.exec_from);

  835. 2 rows updated.

  836. SQL>
  837. SQL> update wri$_adv_addm_tasks t
  838.   2  set    t.analysis_version =
  839.   3              (select min(v.db_version)
  840.   4               from addm$dbv v, dba_advisor_tasks a
  841.   5               where  a.task_id = t.task_id
  842.   6                 and  cast(a.execution_end as timestamp) > v.exec_from
  843.   7                 and  cast(a.execution_end as timestamp) <= v.exec_to)
  844.   8  where  t.analysis_version IS NULL;

  845. 0 rows updated.

  846. SQL>
  847. SQL> drop table addm$dbv;

  848. Table dropped.

  849. SQL>
  850. SQL> commit;

  851. Commit complete.

  852. SQL>
  853. SQL>
  854. SQL> Rem
  855. SQL> Rem Add the database name, database version, snapshot end time.
  856. SQL> Rem
  857. SQL>
  858. SQL> update wri$_adv_addm_tasks t
  859.   2  set    (t.dbname, t.dbversion, t.end_time) =
  860.   3              (select min(d.db_name), min(d.version), min(s.end_interval_time)
  861.   4               from   wrm$_snapshot s, wrm$_database_instance d
  862.   5               where  s.dbid = t.dbid
  863.   6                 and  s.snap_id = t.end_snap_id
  864.   7                 and  d.dbid = t.dbid
  865.   8                 and  d.instance_number = s.instance_number
  866.   9                 and  d.startup_time = s.startup_time
  867. 10               )
  868. 11  where  t.analysis_version like '10.%'
  869. 12    and  t.dbname IS NULL
  870. 13    and  t.dbversion IS NULL
  871. 14    and  t.end_time IS NULL;

  872. 0 rows updated.

  873. SQL>
  874. SQL> commit;

  875. Commit complete.

  876. SQL>
  877. SQL> Rem
  878. SQL> Rem Add the snapshot begin time.
  879. SQL> Rem
  880. SQL>
  881. SQL> update wri$_adv_addm_tasks t
  882.   2  set    t.begin_time =
  883.   3              (select min(s.end_interval_time)
  884.   4               from   wrm$_snapshot s
  885.   5               where  s.dbid = t.dbid
  886.   6                 and  s.snap_id = t.begin_snap_id
  887.   7               )
  888.   8  where  t.analysis_version like '10.%'
  889.   9    and  t.begin_time IS NULL;

  890. 0 rows updated.

  891. SQL>
  892. SQL> commit;

  893. Commit complete.

  894. SQL>
  895. SQL> Rem
  896. SQL> Rem Add the active sessions
  897. SQL> Rem
  898. SQL>
  899. SQL> update wri$_adv_addm_tasks t
  900.   2  set    t.active_sessions =
  901.   3                 t.database_time /
  902.   4                  (extract(day          from t.end_time - t.begin_time) *24*60*60*1000000
  903.   5                   + extract(hour   from t.end_time - t.begin_time)    *60*60*1000000
  904.   6                   + extract(minute from t.end_time - t.begin_time)        *60*1000000
  905.   7                   + extract(second from t.end_time - t.begin_time)           *1000000 )
  906.   8  where  t.active_sessions IS NULL
  907.   9    and  t.begin_time IS NOT NULL
  908. 10    and  t.end_time IS NOT NULL
  909. 11    and  t.database_time IS NOT NULL
  910. 12    and  t.end_time > t.begin_time;

  911. 0 rows updated.

  912. SQL>
  913. SQL> commit;

  914. Commit complete.

  915. SQL>
  916. SQL>
  917. SQL> Rem
  918. SQL> Rem Add a row for each task into the wri$_adv_addm_inst table
  919. SQL> Rem
  920. SQL>
  921. SQL> insert into wri$_adv_addm_inst i
  922.   2  (TASK_ID,
  923.   3   INSTANCE_NUMBER,
  924.   4   INSTANCE_NAME,
  925.   5   HOST_NAME,
  926.   6   STATUS,
  927.   7   DATABASE_TIME,
  928.   8   ACTIVE_SESSIONS,
  929.   9   PERC_ACTIVE_SESS,
  930. 10   LOCAL_TASK_ID)
  931. 11  select t.task_id,
  932. 12              to_number(p.parameter_value),
  933. 13              d.instance_name,
  934. 14              d.host_name,
  935. 15              'ANALYZED',
  936. 16              t.database_time,
  937. 17              t.active_sessions,
  938. 18              100,
  939. 19              t.task_id
  940. 20  from   wri$_adv_addm_tasks t, dba_advisor_parameters p,
  941. 21              wrm$_snapshot s, wrm$_database_instance d
  942. 22  where  t.task_id not in (select task_id from wri$_adv_addm_inst)
  943. 23    and  t.analysis_version like '10.%'
  944. 24    and  t.actual_analysis = 'INSTANCE'
  945. 25    and  p.task_id = t.task_id
  946. 26    and  p.parameter_name = 'INSTANCE'
  947. 27    and  p.parameter_value IS NOT NULL
  948. 28    and  p.parameter_value <> 'UNUSED'
  949. 29    and  s.dbid = t.dbid
  950. 30    and  s.snap_id = t.end_snap_id
  951. 31    and  s.instance_number =
  952. 32              to_number(decode(p.parameter_value, 'UNUSED', NULL, p.parameter_value))
  953. 33    and  d.dbid = t.dbid
  954. 34    and  d.instance_number = s.instance_number
  955. 35    and  d.startup_time = s.startup_time;

  956. 0 rows created.

  957. SQL>
  958. SQL> commit;

  959. Commit complete.

  960. SQL>
  961. SQL>
  962. SQL> Rem
  963. SQL> Rem Add a row for each the findings
  964. SQL> Rem
  965. SQL>
  966. SQL> insert into wri$_adv_addm_fdg
  967.   2  (TASK_ID,
  968.   3   FINDING_ID,
  969.   4   DATABASE_TIME,
  970.   5   ACTIVE_SESSIONS,
  971.   6   PERC_ACTIVE_SESS,
  972.   7   IS_AGGREGATE
  973.   8  )
  974.   9  select t.task_id,
  975. 10              a.finding_id,
  976. 11              a.impact,
  977. 12              (a.impact * t.active_sessions) / t.database_time,
  978. 13              (a.impact * 100) / t.database_time,
  979. 14              'N'
  980. 15  from   wri$_adv_addm_tasks t, dba_advisor_findings a
  981. 16  where  (t.task_id, a.finding_id) not in
  982. 17                  (select task_id, finding_id from wri$_adv_addm_fdg)
  983. 18    and  t.analysis_version like '10.%'
  984. 19    and  t.actual_analysis = 'INSTANCE'
  985. 20    and  t.task_id = a.task_id
  986. 21    and  a.type in ('PROBLEM', 'SYMPTOM')
  987. 22    and  t.database_time > 0;

  988. 0 rows created.

  989. SQL>
  990. SQL> commit;

  991. Commit complete.

  992. SQL>
  993. SQL> Rem =======================================================================
  994. SQL> Rem If OLS in the database, run olstrig.sql to updated OLS policies
  995. SQL> Rem =======================================================================
  996. SQL>
  997. SQL> COLUMN :ols_name NEW_VALUE ols_file NOPRINT;
  998. SQL> VARIABLE ols_name VARCHAR2(30)
  999. SQL> DECLARE
  1000.   2  BEGIN
  1001.   3          IF dbms_registry.is_loaded('OLS') IS NOT NULL THEN
  1002.   4             :ols_name := '@olstrig.sql';   -- OLS installed in DB
  1003.   5          ELSE
  1004.   6             :ols_name := dbms_registry.nothing_script;        -- No OLS
  1005.   7          END IF;
  1006.   8  END;
  1007.   9  /

  1008. PL/SQL procedure successfully completed.

  1009. SQL> SELECT :ols_name FROM DUAL;




  1010. SQL> @&ols_file
  1011. SQL> Rem $Header: rdbms/admin/nothing.sql /st_rdbms_12.1/1 2014/06/03 11:24:49 aketkar Exp $
  1012. SQL> Rem
  1013. SQL> Rem
  1014. SQL> Rem BEGIN SQL_FILE_METADATA
  1015. SQL> Rem SQL_SOURCE_FILE: rdbms/admin/nothing.sql
  1016. SQL> Rem SQL_SHIPPED_FILE: rdbms/admin/nothing.sql
  1017. SQL> Rem SQL_PHASE: NOTHING
  1018. SQL> Rem SQL_STARTUP_MODE: NORMAL
  1019. SQL> Rem SQL_IGNORABLE_ERRORS: NONE
  1020. SQL> Rem SQL_CALLING_FILE: NONE
  1021. SQL> Rem END SQL_FILE_METADATA
  1022. SQL> Rem
  1023. SQL>
  1024. SQL>
  1025. SQL> Rem =======================================================================
  1026. SQL> Rem If EM in the database, run @emremove.sql to remove EM schema
  1027. SQL> Rem =======================================================================
  1028. SQL>
  1029. SQL> COLUMN :em_name NEW_VALUE em_file NOPRINT;
  1030. SQL> VARIABLE em_name VARCHAR2(30)
  1031. SQL> DECLARE
  1032.   2  BEGIN
  1033.   3          IF dbms_registry.is_loaded('EM') IS NOT NULL THEN
  1034.   4             :em_name := '@emremove.sql';   -- EM exists in DB
  1035.   5          ELSE
  1036.   6             :em_name := dbms_registry.nothing_script;   -- No EM
  1037.   7          END IF;
  1038.   8  END;
  1039.   9  /

  1040. PL/SQL procedure successfully completed.

  1041. SQL> SELECT :em_name FROM DUAL;




  1042. SQL> @&em_file
  1043. SQL> Rem $Header: rdbms/admin/nothing.sql /st_rdbms_12.1/1 2014/06/03 11:24:49 aketkar Exp $
  1044. SQL> Rem
  1045. SQL> Rem
  1046. SQL> Rem BEGIN SQL_FILE_METADATA
  1047. SQL> Rem SQL_SOURCE_FILE: rdbms/admin/nothing.sql
  1048. SQL> Rem SQL_SHIPPED_FILE: rdbms/admin/nothing.sql
  1049. SQL> Rem SQL_PHASE: NOTHING
  1050. SQL> Rem SQL_STARTUP_MODE: NORMAL
  1051. SQL> Rem SQL_IGNORABLE_ERRORS: NONE
  1052. SQL> Rem SQL_CALLING_FILE: NONE
  1053. SQL> Rem END SQL_FILE_METADATA
  1054. SQL> Rem
  1055. SQL>
  1056. SQL> Rem =======================================================================
  1057. SQL> Rem Network ACL migration status check
  1058. SQL> Rem =======================================================================
  1059. SQL>
  1060. SQL> set serveroutput on
  1061. SQL>
  1062. SQL> declare
  1063.   2    cnt number;
  1064.   3  begin
  1065.   4    select count(*) into cnt from dba_xs_acls
  1066.   5          where owner = 'SYS' and name like 'PRE_12_1_NETWORK_ACL_%';
  1067.   6    if (cnt > 0) then
  1068.   7           dbms_output.put_line(
  1069.   8             cnt || ' network access control lists (ACL) from releases earlier than');
  1070.   9           dbms_output.put_line(
  1071. 10             'Oracle Database 12.1 are not migrated. Please refer to the "Oracle');
  1072. 11           dbms_output.put_line(
  1073. 12             'Database Upgrade Guide" section titled "Configure Fine-Grained Access');
  1074. 13           dbms_output.put_line(
  1075. 14             'to External Network Services After Upgrading Oracle Database" for');
  1076. 15           dbms_output.put_line(
  1077. 16             'more information.');
  1078. 17    end if;
  1079. 18  end;
  1080. 19  /

  1081. PL/SQL procedure successfully completed.

  1082. SQL>
  1083. SQL> set serveroutput off
  1084. SQL>
  1085. SQL> Rem =======================================================================
  1086. SQL> Rem AQ post upgrade code start
  1087. SQL> Rem =======================================================================
  1088. SQL> set serveroutput on
  1089. SQL> -- create dequeue logs and recreate base views for old multiconsumer qtables
  1090. SQL> declare
  1091.   2    cursor qt_cur is select schema, name, flags from system.aq$_queue_tables;
  1092.   3  begin
  1093.   4    -- only execute the script if version is in 11.1 or 10.2
  1094.   5    for qt in qt_cur loop
  1095.   6           if (sys.dbms_aqadm_sys.mcq_8_1(qt.flags)) then
  1096.   7             begin
  1097.   8               if not sys.dbms_aqadm_sys.object_exists(qt.schema, 'AQ$_' || qt.name ||
  1098.   9                '_L', 'TABLE') then
  1099. 10                 sys.dbms_prvtaqim.create_dequeue_log(qt.schema, qt.name, qt.flags);
  1100. 11                 sys.dbms_prvtaqim.create_base_view(qt.schema, qt.name, qt.flags);
  1101. 12               end if;
  1102. 13             exception
  1103. 14               when others then
  1104. 15                 dbms_system.ksdwrt(dbms_system.alert_file,
  1105. 16                                'catuppst.sql: create dequeue log or recreate base' ||
  1106. 17                                ' view failed for ' || qt.schema || '.' || qt.name || ', error msg ' || SQLERRM);
  1107. 18             end;
  1108. 19           end if;
  1109. 20           -- validate queues in post upgrade only for scheduler queue
  1110. 21           if (qt.name = 'SCHEDULER$_EVENT_QTAB') then
  1111. 22             sys.dbms_aqadm_sys.validate_qtab_queues(qt.schema, qt.name);
  1112. 23             dbms_aqadm.start_queue(queue_name => 'scheduler$_event_queue');
  1113. 24           end if;
  1114. 25    end loop;
  1115. 26  end;
  1116. 27  /

  1117. PL/SQL procedure successfully completed.

  1118. SQL> set serveroutput off
  1119. SQL> Rem =======================================================================
  1120. SQL> Rem AQ post upgrade code end
  1121. SQL> Rem =======================================================================
  1122. SQL>
  1123. SQL>
  1124. SQL> Rem =======================================================================
  1125. SQL> Rem Bug 14258301 - Gather fixed objects stats IF NONE of the fixed object
  1126. SQL> Rem tables has stats
  1127. SQL> Rem =======================================================================
  1128. SQL>
  1129. SQL> set serveroutput on
  1130. SQL> declare
  1131.   2    has_stats_cnt  number := 0;  -- # of fixed object tables that have stats
  1132.   3  begin
  1133.   4    -- find # of fixed object tables that have had stats collected
  1134.   5    execute immediate
  1135.   6           'select count(*) ' ||
  1136.   7           'from sys.dba_tab_statistics ' ||
  1137.   8           ' where owner = ''SYS'' and table_name like ''X$%'' ' ||
  1138.   9           '         and last_analyzed is not null'
  1139. 10           into has_stats_cnt;
  1140. 11  
  1141. 12    -- if none of the fixed obj tables have had stats collected
  1142. 13    -- then gather fixed objects stats
  1143. 14    -- else do nothing
  1144. 15    if (has_stats_cnt = 0) then
  1145. 16           sys.dbms_output.put_line('catuppst: Gathering fixed objects stats now...');
  1146. 17           sys.dbms_stats.gather_fixed_objects_stats;
  1147. 18           sys.dbms_output.put_line('catuppst: Gathering fixed objects stats done.');
  1148. 19    end if;
  1149. 20  end;
  1150. 21  /

  1151. PL/SQL procedure successfully completed.

  1152. SQL> set serveroutput off
  1153. SQL>
  1154. SQL> Rem =======================================================================
  1155. SQL> Rem Gather Fixed Objects Stats end
  1156. SQL> Rem =======================================================================
  1157. SQL>
  1158. SQL>
  1159. SQL> Rem =======================================================================
  1160. SQL> Rem Signal 'end' of catuppst.sql before catbundle.sql is executed
  1161. SQL> Rem =======================================================================
  1162. SQL> SELECT dbms_registry_sys.time_stamp('POSTUP_END') as timestamp from dual;

  1163. TIMESTAMP
  1164. --------------------------------------------------------------------------------
  1165. COMP_TIMESTAMP POSTUP_END 2020-12-13 15:13:36

  1166. SQL>
  1167. SQL>
  1168. SQL> Rem Set errorlogging off
  1169. SQL> SET ERRORLOGGING OFF;
  1170. SQL>
  1171. SQL> Rem
  1172. SQL> Rem Set _ORACLE_SCRIPT to false
  1173. SQL> Rem
  1174. SQL> ALTER SESSION SET "_ORACLE_SCRIPT"=false;

  1175. Session altered.

  1176. SQL>
  1177. SQL>
  1178. SQL> Rem *********************************************************************
  1179. SQL> Rem END catuppst.sql
  1180. SQL> Rem *********************************************************************
  1181. SQL>
  1182. SQL>
复制代码
  1. SQL> @/u01/app/oracle/cfgtoollogs/rcat/preupgrade/postupgrade_fixups.sql
  2. SQL> REM Post Upgrade Script Generated on: 2020-12-10 21:07:56
  3. SQL> REM Generated by Version: 12.1.0.2 Build: 006
  4. SQL> SET ECHO OFF SERVEROUTPUT ON FORMAT WRAPPED TAB OFF LINESIZE 750;
  5. Post Upgrade Fixup Script Generated on 2020-12-10 21:07:56  Version: 12.1.0.2 Build: 006
  6. Beginning Post-Upgrade Fixups...

  7. **********************************************************************
  8. Check Tag:     OLD_TIME_ZONES_EXIST
  9. Check Summary: Check for use of older timezone data file
  10. Fix Summary:   Update the timezone using the DBMS_DST package after upgrade is complete.
  11. **********************************************************************
  12. Fixup Returned Information:
  13. INFORMATION: --> Older Timezone in use

  14.      Database is using a time zone file older than version 18.
  15.      After the upgrade, it is recommended that DBMS_DST package
  16.      be used to upgrade the 12.1.0.2.0 database time zone version
  17.      to the latest version which comes with the new release.
  18.      Please refer to My Oracle Support note number 977512.1 for details.
  19. **********************************************************************


  20. **********************************************************************
  21. Check Tag:     NOT_UPG_BY_STD_UPGRD
  22. Check Summary: Identify existing components that will NOT be upgraded
  23. Fix Summary:   This fixup does not perform any action.
  24. **********************************************************************
  25. Fixup Returned Information:
  26. This fixup does not perform any action.  
  27. If you want to upgrade those other components, you must do so manually.
  28. **********************************************************************


  29. **********************************************************************
  30.                      [Post-Upgrade Recommendations]
  31. **********************************************************************

  32.                         *****************************************
  33.                         ******** Fixed Object Statistics ********
  34.                         *****************************************

  35. Please create stats on fixed objects two weeks
  36. after the upgrade using the command:
  37.    EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

  38. ^^^ MANUAL ACTION SUGGESTED ^^^


  39.            **************************************************
  40.                 ************* Fixup Summary ************

  41. 2 fixup routines generated INFORMATIONAL messages that should be reviewed.

  42. *************** Post Upgrade Fixup Script Complete ********************

  43. PL/SQL procedure successfully completed.

复制代码


  1. SQL> EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-29 05:01 , Processed in 0.042698 second(s), 24 queries .

快速回复 返回顶部 返回列表