探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

dbhelper發表於2015-01-17

探索Oracle之資料庫升級六
11.2.0.4.3 Upgrade12c(12.2.0.1)

一、前言:

       Oracle 12c釋出距今已經一年有餘了,其最大亮點是一個可以插拔的資料庫(PDB),這是在之前版本沒有的;但是如果我們要將以前版本的資料庫升級到12c來,那麼也應順其自然的將其變成一個pdb,那麼我們的工作不僅包含了資料庫軟體的升級,同時也包含如何將一個NO-CDB的資料庫plug to CDB none

二、升級要求:
 

三、升級前準備:

3.1、檢視資料庫版本及補丁資訊
 
  1. SQL> select * from v$version;

  2. BANNER
  3. --------------------------------------------------------------------------------
  4. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  5. PL/SQL Release 11.2.0.4.0 - Production
  6. CORE 11.2.0.4.0 Production
  7. TNS for Linux: Version 11.2.0.4.0 - Production
  8. NLSRTL Version 11.2.0.4.0 – Production

  9. SQL> show parameter name;

  10. NAME TYPE VALUE
  11. ------------------------------------ ----------- ------------------------------
  12. cell_offloadgroup_name string
  13. db_file_name_convert string
  14. db_name string woo
  15. db_unique_name string woo
  16. global_names boolean FALSE
  17. instance_name string woo
  18. lock_name_space string
  19. log_file_name_convert string
  20. processor_group_name string
  21. service_names string woo

  22. SQL> set pagesize 500
  23. SQL> set line 300
  24. SQL> col comp_name format a40
  25. SQL> col comp_name format a35
  26. SQL> col version format a15
  27. SQL> col status format a7
  28. SQL> select comp_name,version,status from dba_registry;

  29. COMP_NAME VERSION STATUS
  30. ----------------------------------- --------------- -------
  31. Oracle Enterprise Manager 11.2.0.4.0 VALID
  32. OWB 11.2.0.3.0 VALID
  33. Oracle Application Express 3.2.1.00.12 VALID
  34. OLAP Catalog 11.2.0.4.0 VALID
  35. Spatial 11.2.0.4.0 VALID
  36. Oracle Multimedia 11.2.0.4.0 VALID
  37. Oracle XML Database 11.2.0.4.0 VALID
  38. Oracle Text 11.2.0.4.0 VALID
  39. Oracle Expression Filter 11.2.0.4.0 VALID
  40. Oracle Rules Manager 11.2.0.4.0 VALID
  41. Oracle Workspace Manager 11.2.0.4.0 VALID
  42. Oracle Database Catalog Views 11.2.0.4.0 VALID
  43. Oracle Database Packages and Types 11.2.0.4.0 VALID
  44. JServer JAVA Virtual Machine 11.2.0.4.0 VALID
  45. Oracle XDK 11.2.0.4.0 VALID
  46. Oracle Database Java Packages 11.2.0.4.0 VALID
  47. OLAP Analytic Workspace 11.2.0.4.0 VALID
  48. Oracle OLAP API 11.2.0.4.0 VALID

  49. 18 rows selected.

  50. [oracle@db01 OPatch]$ ./opatch lspatches
  51. 18522509;Database Patch Set Update : 11.2.0.4.3 (18522509)
3.2、備份資料庫

[oracle@db01 Phycal]$ pwd
/DBBackup/Phycal
[oracle@db01 Phycal]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Nov 20 04:41:01 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: WOO (DBID=4199532651)

RMAN> run{
2> allocate channel chan_name type disk;
3> backup database format '/DBBackup/Phycal/WOO%U.bak' TAG before_upgrade;
4> BACKUP CURRENT CONTROLFILE;
5> }

using target database control file instead of recovery catalog
allocated channel: chan_name
channel chan_name: SID=28 device type=DISK

Starting backup at 20-NOV-14
channel chan_name: starting full datafile backup set
channel chan_name: specifying datafile(s) in backup set
input datafile file number=00001 name=/DBData/woo/woo/system01.dbf
input datafile file number=00002 name=/DBData/woo/woo/sysaux01.dbf
input datafile file number=00003 name=/DBData/woo/woo/undotbs01.dbf
input datafile file number=00004 name=/DBData/woo/woo/users01.dbf
channel chan_name: starting piece 1 at 20-NOV-14
channel chan_name: finished piece 1 at 20-NOV-14
piece handle=/DBBackup/Phycal/WOO0apo2ar4_1_1.bak tag=BEFORE_UPGRADE comment=NONE
channel chan_name: backup set complete, elapsed time: 00:01:25
channel chan_name: starting full datafile backup set
channel chan_name: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel chan_name: starting piece 1 at 20-NOV-14
channel chan_name: finished piece 1 at 20-NOV-14
piece handle=/DBBackup/Phycal/WOO0bpo2atp_1_1.bak tag=BEFORE_UPGRADE comment=NONE
channel chan_name: backup set complete, elapsed time: 00:00:01
Finished backup at 20-NOV-14

Starting backup at 20-NOV-14
channel chan_name: starting full datafile backup set
channel chan_name: specifying datafile(s) in backup set
including current control file in backup set
channel chan_name: starting piece 1 at 20-NOV-14
channel chan_name: finished piece 1 at 20-NOV-14
piece handle=/DBSoft/fast_recovery_area/WOO/backupset/2014_11_20/o1_mf_ncnnf_TAG20141120T044237_b6t05y5x_.bkp tag=TAG20141120T044237 comment=NONE
channel chan_name: backup set complete, elapsed time: 00:00:01
Finished backup at 20-NOV-14
released channel: chan_name

RMAN> list backupset;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    1.20G      DISK        00:01:24     20-NOV-14     
        BP Key: 9   Status: AVAILABLE  Compressed: NO  Tag: BEFORE_UPGRADE
        Piece Name: /DBBackup/Phycal/WOO0apo2ar4_1_1.bak
  List of Datafiles in backup set 9
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 3242521    20-NOV-14 /DBData/woo/woo/system01.dbf
  2       Full 3242521    20-NOV-14 /DBData/woo/woo/sysaux01.dbf
  3       Full 3242521    20-NOV-14 /DBData/woo/woo/undotbs01.dbf
  4       Full 3242521    20-NOV-14 /DBData/woo/woo/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10      Full    9.64M      DISK        00:00:02     20-NOV-14     
        BP Key: 10   Status: AVAILABLE  Compressed: NO  Tag: BEFORE_UPGRADE
        Piece Name: /DBBackup/Phycal/WOO0bpo2atp_1_1.bak
  SPFILE Included: Modification time: 12-NOV-14
  SPFILE db_unique_name: WOO
  Control File Included: Ckp SCN: 3242657      Ckp time: 20-NOV-14

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11      Full    9.61M      DISK        00:00:01     20-NOV-14     
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20141120T044237
        Piece Name: /DBSoft/fast_recovery_area/WOO/backupset/2014_11_20/o1_mf_ncnnf_TAG20141120T044237_b6t05y5x_.bkp
  Control File Included: Ckp SCN: 3242671      Ckp time: 20-NOV-14


  四、執行預升級指令碼:
4.1
根據Metalink ID:1503653 step 3中提到的到Metalink ID:556610.1下載預升級指令碼preupgrd.sql檢查是否滿足升級條件。  
  1. [oracle@db01 ~]$ sqlplus / as sysdba @preupgrd.sql

  2. SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 20 05:18:26 2014
  3. Copyright (c) 1982, 2013, Oracle. All rights reserved.

  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  6. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  7. Loading Pre-Upgrade Package...
  8. Executing Pre-Upgrade Checks...
  9. Pre-Upgrade Checks Complete.
  10.       ************************************************************

  11. Results of the checks are located at:
  12.  /DBSoft/cfgtoollogs/woo/preupgrade/preupgrade.log

  13. Pre-Upgrade Fixup Script (run in source database environment):
  14.  /DBSoft/cfgtoollogs/woo/preupgrade/preupgrade_fixups.sql

  15. Post-Upgrade Fixup Script (run shortly after upgrade):
  16.  /DBSoft/cfgtoollogs/woo/preupgrade/postupgrade_fixups.sql

  17.       ************************************************************

  18.          Fixup scripts must be reviewed prior to being executed.

  19.       ************************************************************

  20.       ************************************************************
  21.                    ====>> USER ACTION REQUIRED <<====
  22.       ************************************************************

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


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

  30.             You MUST resolve the above error prior to upgrade

  31.       ************************************************************

  32. SQL>

在這裡已經把需要修改的相關操作封裝到了preupgrade_fixups.sql指令碼中,執行該指令碼按照提示修復存在的問題即可。

 

4.2 主要需要修復如下問題:

       ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE;

       @$ORACLE_HOME/rdbms/admin/emremove.sql

       @$ORACLE_HOME/olap/admin/catnoamd.sql

        EXECUTE dbms_stats.gather_dictionary_stats;

4.3 執行dbupgdiag.sql收集升級前資訊

    如果有異常參考Metalink ID:556610.1進行修改

  1. [oracle@db01 ~]$ ll dbupgdiag.sql
  2. -rwxr-xr-x 1 oracle oinstall 24140 Nov 20 04:52 dbupgdiag.sql

  3. [oracle@db01 ~]$ sqlplus / as sysdba @dbupgdiag.sql

  4. SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 20 05:04:47 2014
  5. Copyright (c) 1982, 2013, Oracle. All rights reserved.

  6. Connected to:
  7. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  8. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  9. Enter location for Spooled output:

  10. Enter value for 1:
  11. SP2-0137: DEFINE requires a value following equal sign

  12. 20_Nov_2014_0504 .log

  13. woo_
  14. Enter value for log_path: /home/oracle/diag/
  15. SP2-0606: Cannot create SPOOL file \"/home/oracle/woo_upgrade_diag.log/db_upg_diag_woo_20_Nov_2014_0504.log\"



  16.                           *** Start of LogFile ***

  17.   Oracle Database Upgrade Diagnostic Utility 11-20-2014 05:05:16

  18. ===============
  19. Hostname
  20. ===============

  21. db01

  22. ===============
  23. Database Name
  24. ===============

  25. WOO

  26. ===============
  27. Database Uptime
  28. ===============

  29. 00:34 20-NOV-14

  30. =================
  31. Database Wordsize
  32. =================

  33. This is a 64-bit database

  34. ================
  35. Software Version
  36. ================

  37. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  38. PL/SQL Release 11.2.0.4.0 - Production
  39. CORE 11.2.0.4.0 Production
  40. TNS for Linux: Version 11.2.0.4.0 - Production
  41. NLSRTL Version 11.2.0.4.0 - Production

  42. =============
  43. Compatibility
  44. =============

  45. Compatibility is set as 11.2.0.0.0

  46. ================
  47. Archive Log Mode
  48. ================

  49. Database log mode Archive Mode
  50. Automatic archival Enabled
  51. Archive destination USE_DB_RECOVERY_FILE_DEST
  52. Oldest online log sequence 151
  53. Next log sequence to archive 153
  54. Current log sequence 153

  55. ================
  56. Auditing Check
  57. ================


  58. NAME TYPE VALUE
  59. ------------------------------------ ----------- ------------------------------
  60. audit_file_dest string /DBSoft/admin/woo/adump
  61. audit_sys_operations boolean FALSE
  62. audit_syslog_level string
  63. audit_trail string DB

  64. ================
  65. Cluster Check
  66. ================

  67. NAME TYPE VALUE
  68. ------------------------------------ ----------- ------------------------------
  69. cluster_database boolean FALSE
  70. cluster_database_instances integer 1

  71. DOC>################################################################
  72. DOC>
  73. DOC> If CLUSTER_DATABASE is set to TRUE, change it to FALSE before
  74. DOC> upgrading the database
  75. DOC>
  76. DOC>################################################################
  77. DOC>#

  78. ===========================================
  79. Tablespace and the owner of the aud$ table
  80. ===========================================

  81. OWNER TABLESPACE_NAME
  82. ------------ ------------------------------
  83. SYS SYSTEM

  84. ============================================================================
  85. count of records in the sys.aud$ table where dbid is null- Standard Auditing
  86. ============================================================================


  87.          0


  88. ============================================================================================
  89. count of records in the system.aud$ when dbid is null, Std Auditing with OLS or DV installed
  90. ============================================================================================
  91. select count(*) from system.aud$ where dbid is null
  92.                             *
  93. ERROR at line 1:
  94. ORA-00942: table or view does not exist




  95. =============================================================================
  96. count of records in the sys.fga_log$ when dbid is null, Fine Grained Auditing
  97. =============================================================================

  98.          0



  99. ==========================================
  100. Oracle Label Security is installed or not
  101. ==========================================

  102. Oracle Label Security is NOT installed at database level

  103. ================
  104. Number of AQ Records in Message Queue Tables
  105. ================

  106. SYS - ALERT_QT - 58
  107. SYS - AQ$_MEM_MC - 0
  108. SYS - AQ_EVENT_TABLE - 0
  109. SYS - AQ_PROP_TABLE - 0
  110. SYS - KUPC$DATAPUMP_QUETAB - 0
  111. SYS - SCHEDULER$_EVENT_QTAB - 0
  112. SYS - SCHEDULER$_REMDB_JOBQTAB - 0
  113. SYS - SCHEDULER_FILEWATCHER_QT - 0
  114. SYS - SYS$SERVICE_METRICS_TAB - 0
  115. SYSMAN - MGMT_LOADER_QTABLE - 0
  116. SYSMAN - MGMT_NOTIFY_INPUT_QTABLE - 0
  117. SYSMAN - MGMT_NOTIFY_QTABLE - 0
  118. SYSMAN - MGMT_PAF_MSG_QTABLE_1 - 0
  119. SYSMAN - MGMT_PAF_MSG_QTABLE_2 - 0
  120. SYSMAN - MGMT_TASK_QTABLE - 28
  121. SYSTEM - DEF$_AQCALL - 0
  122. SYSTEM - DEF$_AQERROR - 0
  123. WMSYS - WM$EVENT_QUEUE_TABLE - 0

  124. ================
  125. Time Zone version
  126. ================


  127.         14

  128. ================
  129. Local Listener
  130. ================




  131. ================
  132. Default and Temporary Tablespaces By User
  133. ================


  134. USERNAME TEMPORARY_TABLESPACE DEFAULT_TABLESPACE
  135. ---------------------------- ---------------------- ----------------------
  136. MGMT_VIEW TEMP SYSTEM
  137. SYS TEMP SYSTEM
  138. SYSTEM TEMP SYSTEM
  139. DBSNMP TEMP SYSAUX
  140. SYSMAN TEMP SYSAUX
  141. OUTLN TEMP SYSTEM
  142. FLOWS_FILES TEMP SYSAUX
  143. MDSYS TEMP SYSAUX
  144. ORDSYS TEMP SYSAUX
  145. EXFSYS TEMP SYSAUX
  146. WMSYS TEMP SYSAUX
  147. APPQOSSYS TEMP SYSAUX
  148. APEX_030200 TEMP SYSAUX
  149. OWBSYS_AUDIT TEMP SYSAUX
  150. ORDDATA TEMP SYSAUX
  151. CTXSYS TEMP SYSAUX
  152. ANONYMOUS TEMP SYSAUX
  153. XDB TEMP SYSAUX
  154. ORDPLUGINS TEMP SYSAUX
  155. OWBSYS TEMP SYSAUX
  156. SI_INFORMTN_SCHEMA TEMP SYSAUX
  157. OLAPSYS TEMP SYSAUX
  158. SCOTT TEMP USERS
  159. ORACLE_OCM TEMP USERS
  160. XS$NULL TEMP USERS
  161. MDDATA TEMP USERS
  162. DIP TEMP USERS
  163. APEX_PUBLIC_USER TEMP USERS
  164. SPATIAL_CSW_ADMIN_USR TEMP USERS
  165. SPATIAL_WFS_ADMIN_USR TEMP USERS


  166. ================
  167. Component Status
  168. ================

  169. Comp ID Component Status Version Org_Version Prv_Version
  170. ------- ---------------------------------- --------- -------------- -------------- --------------
  171. AMD OLAP Catalog VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  172. APEX Oracle Application Express VALID 3.2.1.00.12
  173. APS OLAP Analytic Workspace VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  174. CATALOG Oracle Database Catalog Views VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  175. CATJAVA Oracle Database Java Packages VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  176. CATPROC Oracle Database Packages and Types VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  177. CONTEXT Oracle Text VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  178. EM Oracle Enterprise Manager VALID 11.2.0.4.0
  179. EXF Oracle Expression Filter VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  180. JAVAVM JServer JAVA Virtual Machine VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  181. ORDIM Oracle Multimedia VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  182. OWB OWB VALID 11.2.0.3.0
  183. OWM Oracle Workspace Manager VALID 11.2.0.4.0 11.2.0.3.0
  184. RUL Oracle Rules Manager VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  185. SDO Spatial VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  186. XDB Oracle XML Database VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  187. XML Oracle XDK VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0
  188. XOQ Oracle OLAP API VALID 11.2.0.4.0 11.2.0.3.0 11.2.0.3.0



  189. ======================================================
  190. List of Invalid Database Objects Owned by SYS / SYSTEM
  191. ======================================================


  192. Number of Invalid Objects
  193. ------------------------------------------------------------------
  194. There are no Invalid Objects

  195. DOC>################################################################
  196. DOC>
  197. DOC> If there are no Invalid objects below will result in zero rows.
  198. DOC>
  199. DOC>################################################################
  200. DOC>#


  201. no rows selected


  202. ================================
  203. List of Invalid Database Objects
  204. ================================


  205. Number of Invalid Objects
  206. ------------------------------------------------------------------
  207. There are no Invalid Objects

  208. DOC>################################################################
  209. DOC>
  210. DOC> If there are no Invalid objects below will result in zero rows.
  211. DOC>
  212. DOC>################################################################
  213. DOC>#


  214. no rows selected


  215. ======================================================
  216. Count of Invalids by Schema
  217. ======================================================

  218. ==============================================================
  219. Identifying whether a database was created as 32-bit or 64-bit
  220. ==============================================================

  221. DOC>###########################################################################
  222. DOC>
  223. DOC> Result referencing the string \'B023\' ==> Database was created as 32-bit
  224. DOC> Result referencing the string \'B047\' ==> Database was created as 64-bit
  225. DOC> When String results in \'B023\' and when upgrading database to 10.2.0.3.0
  226. DOC> (64-bit) , For known issue refer below articles
  227. DOC>
  228. DOC> Note 412271.1 ORA-600 [22635] and ORA-600 [KOKEIIX1] Reported While
  229. DOC> Upgrading Or Patching Databases To 10.2.0.3
  230. DOC> Note 579523.1 ORA-600 [22635], ORA-600 [KOKEIIX1], ORA-7445 [KOPESIZ] and
  231. DOC> OCI-21500 [KOXSIHREAD1] Reported While Upgrading To 11.1.0.6
  232. DOC>
  233. DOC>###########################################################################
  234. DOC>#


  235. Metadata Initial DB Creation Info
  236. -------- -----------------------------------
  237. B047 Database was created as 64-bit

  238. ===================================================
  239. Number of Duplicate Objects Owned by SYS and SYSTEM
  240. ===================================================

  241. Counting duplicate objects ....


  242.   COUNT(1)
  243. ----------
  244.          0

  245. =========================================
  246. Duplicate Objects Owned by SYS and SYSTEM
  247. =========================================

  248. Querying duplicate objects ....


  249. DOC>
  250. DOC>################################################################################
  251. DOC>
  252. DOC> If any objects found please follow below article.
  253. DOC> Note 1030426.6 How to Clean Up Duplicate Objects Owned by SYS and SYSTEM schema
  254. DOC> Read the Exceptions carefully before taking actions.
  255. DOC>
  256. DOC>################################################################################
  257. DOC>#

  258. ========================
  259. Password protected roles
  260. ========================

  261. DOC>
  262. DOC>################################################################################
  263. DOC>
  264. DOC> In version 11.2 password protected roles are no longer enabled by default so if
  265. DOC> an application relies on such roles being enabled by default and no action is
  266. DOC> performed to allow the user to enter the password with the set role command, it
  267. DOC> is recommended to remove the password from those roles (to allow for existing
  268. DOC> privileges to remain available). For more information see:
  269. DOC>
  270. DOC> Note 745407.1 : What Roles Can Be Set as Default for a User?
  271. DOC>
  272. DOC>################################################################################
  273. DOC>#

  274. Querying for password protected roles ....


  275. Password protected Role Assigned by default to user
  276. ------------------------------ ------------------------------
  277. OWB$CLIENT OWBSYS

  278. ================
  279. JVM Verification
  280. ================


  281. ================================================
  282. Checking Existence of Java-Based Users and Roles
  283. ================================================

  284. DOC>
  285. DOC>################################################################################
  286. DOC>
  287. DOC> There should not be any Java Based users for database version 9.0.1 and above.
  288. DOC> If any users found, it is faulty JVM.
  289. DOC>
  290. DOC>################################################################################
  291. DOC>#


  292. User Existence
  293. ---------------------------
  294. No Java Based Users

  295. DOC>
  296. DOC>###############################################################
  297. DOC>
  298. DOC> Healthy JVM Should contain Six Roles.
  299. DOC> If there are more or less than six role, JVM is inconsistent.
  300. DOC>
  301. DOC>###############################################################
  302. DOC>#


  303. Role
  304. ------------------------------
  305. There are 6 JAVA related roles

  306. Roles


  307. ROLE
  308. ------------------------------
  309. JAVA_DEPLOY
  310. JAVAUSERPRIV
  311. JAVAIDPRIV
  312. JAVASYSPRIV
  313. JAVADEBUGPRIV
  314. JAVA_ADMIN

  315. =========================================
  316. List of Invalid Java Objects owned by SYS
  317. =========================================

  318. There are no SYS owned invalid JAVA objects

  319. DOC>
  320. DOC>#################################################################
  321. DOC>
  322. DOC> Check the status of the main JVM interface packages DBMS_JAVA
  323. DOC> and INITJVMAUX and make sure it is VALID.
  324. DOC>
  325. DOC> If there are no Invalid objects below will result in zero rows.
  326. DOC>
  327. DOC>#################################################################
  328. DOC>#


  329. no rows selected


  330. DOC>
  331. DOC>#################################################################
  332. DOC>
  333. DOC> If the JAVAVM component is not installed in the database (for
  334. DOC> example, after creating the database with custom scripts), the
  335. DOC> next query will report the following error:
  336. DOC>
  337. DOC> select dbms_java.longname(\'foo\') \"JAVAVM TESTING\" from dual
  338. DOC> *
  339. DOC> ERROR at line 1:
  340. DOC> ORA-00904: \"DBMS_JAVA\".\"LONGNAME\": invalid identifier
  341. DOC>
  342. DOC> If the JAVAVM component is installed, the query should succeed
  343. DOC> with \'foo\' as result.
  344. DOC>
  345. DOC>#################################################################
  346. DOC>#


  347. JAVAVM TESTING
  348. ---------------
  349. foo

  350. ===================================
  351. Oracle Multimedia/InterMedia status
  352. ===================================

  353. .
  354. Oracle Multimedia/interMedia is installed and listed with the following version: 11.2.0.4.0 and status: VALID
  355. .
  356. Checking for installed Database Schemas...
  357. ORDSYS user exists.
  358. ORDPLUGINS user exists.
  359. MDSYS user exists.
  360. SI_INFORMTN_SCHEMA user exists.
  361. ORDDATA user exists.
  362. .
  363. Checking for Prerequisite Components...
  364. JAVAVM installed and listed as valid
  365. XDK installed and listed as valid
  366. XDB installed and listed as valid
  367. Validating Oracle Multimedia/interMedia...(no output if component status is valid)

  368. PL/SQL procedure successfully completed.


  369.                             *** End of LogFile ***

  370. not spooling currently

  371. Enter value for log_path: /home/oracle/diag/

  372. Upload db_upg_diag_woo_20_Nov_2014_0504.log from \"/home/oracle/diag\" directory

  373. SQL> exit

4.4 升級前檢查無效物件:
 
  1. [oracle@db01 ~]$ cd $ORACLE_HOME/rdbms/admin
  2. [oracle@db01 admin]$ sqlplus / as sysdba @utlrp.sql

  3. SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 20 06:13:55 2014

  4. Copyright (c) 1982, 2013, Oracle. All rights reserved.


  5. Connected to:
  6. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  7. With the Partitioning, OLAP, Data Mining and Real Application Testing options


  8. TIMESTAMP
  9. --------------------------------------------------------------------------------
  10. COMP_TIMESTAMP UTLRP_BGN 2014-11-20 06:13:56

  11. DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
  12. DOC> objects in the database. Recompilation time is proportional to the
  13. DOC> number of invalid objects in the database, so this command may take
  14. DOC> a long time to execute on a database with a large number of invalid
  15. DOC> objects.
  16. DOC>
  17. DOC> Use the following queries to track recompilation progress:
  18. DOC>
  19. DOC> 1. Query returning the number of invalid objects remaining. This
  20. DOC> number should decrease with time.
  21. DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
  22. DOC>
  23. DOC> 2. Query returning the number of objects compiled so far. This number
  24. DOC> should increase with time.
  25. DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
  26. DOC>
  27. DOC> This script automatically chooses serial or parallel recompilation
  28. DOC> based on the number of CPUs available (parameter cpu_count) multiplied
  29. DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
  30. DOC> On RAC, this number is added across all RAC nodes.
  31. DOC>
  32. DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
  33. DOC> recompilation. Jobs are created without instance affinity so that they
  34. DOC> can migrate across RAC nodes. Use the following queries to verify
  35. DOC> whether UTL_RECOMP jobs are being created and run correctly:
  36. DOC>
  37. DOC> 1. Query showing jobs created by UTL_RECOMP
  38. DOC> SELECT job_name FROM dba_scheduler_jobs
  39. DOC> WHERE job_name like \'UTL_RECOMP_SLAVE_%\';
  40. DOC>
  41. DOC> 2. Query showing UTL_RECOMP jobs that are running
  42. DOC> SELECT job_name FROM dba_scheduler_running_jobs
  43. DOC> WHERE job_name like \'UTL_RECOMP_SLAVE_%\';
  44. DOC>#

  45. PL/SQL procedure successfully completed.


  46. TIMESTAMP
  47. --------------------------------------------------------------------------------
  48. COMP_TIMESTAMP UTLRP_END 2014-11-20 06:14:06

  49. DOC> The following query reports the number of objects that have compiled
  50. DOC> with errors.
  51. DOC>
  52. DOC> If the number is higher than expected, please examine the error
  53. DOC> messages reported with each object (using SHOW ERRORS) to see if they
  54. DOC> point to system misconfiguration or resource constraints that must be
  55. DOC> fixed before attempting to recompile these objects.
  56. DOC>#

  57. OBJECTS WITH ERRORS
  58. -------------------
  59.                   0

  60. DOC> The following query reports the number of errors caught during
  61. DOC> recompilation. If this number is non-zero, please query the error
  62. DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
  63. DOC> are due to misconfiguration or resource constraints that must be
  64. DOC> fixed before objects can compile successfully.
  65. DOC>#

  66. ERRORS DURING RECOMPILATION
  67. ---------------------------
  68.                           0


  69. Function created.


  70. PL/SQL procedure successfully completed.


  71. Function dropped.


  72. PL/SQL procedure successfully completed.

  73. SQL>

五、開始安裝ORACLE 12C軟體

   5.1 建立12c 安裝所需目錄

  1. [oracle@db01 DBSoft]$ mkdir -p /DBSoft/Product/12.1.0/db_1
  2. [oracle@db01 DBSoft]$ chown -R oracle:oinstall /DBSoft/Product/12.1.0
  3. [oracle@db01 DBSoft]$ chmod -R 755 /DBSoft/Product/12.1.0
  4. [oracle@db01 DBSoft]$ cd /DBSoft/Product/12.1.0

       5.2
修改使用者環境變數:
  1. [oracle@db01 Product]$ vi ~/.bash_profile
  2. export PATH
  3. export EDITOR=vi
  4. export ORACLE_SID=woo
  5. export ORACLE_BASE=/DBSoft
  6. export ORACLE_HOME=$ORACLE_BASE/Product/12.1.0/db_1
  7. export LD_LIBRARY_PATH=$ORACLE_HOME/lib
  8. export PATH=$ORACLE_HOME/bin:$PATH
  9. umask 022

     5.3 解壓縮軟體:
  1. [oracle@db01 ~]$ unzip linuxamd64_12c_database_1of2.zip
  2. [oracle@db01 ~]$ unzip linuxamd64_12c_database_2of2.zip
六、開始安裝12c軟體:
     6.1 進入解壓目錄
執行./runInstaller 開啟12c安裝程式
探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)
探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

執行DBUA 對資料庫進行升級操作。
探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)
探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

探索Oracle之資料庫升級六 11.2.0.4.3 Upgrade12c(12.2.0.1)

至此,用於升級的12c軟體包已經安裝完成。


六、執行升級檢查

  1. SQL> select banner from v$version;

  2. BANNER
  3. --------------------------------------------------------------------------------
  4. Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
  5. PL/SQL Release 12.1.0.1.0 - Production
  6. CORE 12.1.0.1.0 Production
  7. TNS for Linux: Version 12.1.0.1.0 - Production
  8. NLSRTL Version 12.1.0.1.0 – Production

  9. SQL> set pagesize 500
  10. SQL> set line 300
  11. SQL> col comp_name format a40
  12. SQL> col comp_name format a35
  13. SQL> col version format a15
  14. SQL> col status format a7
  15. SQL> select comp_name,version,status from dba_registry;

  16. COMP_NAME VERSION STATUS
  17. ----------------------------------- --------------- -------
  18. Oracle Application Express 4.2.0.00.27 VALID
  19. OWB 11.2.0.3.0 VALID
  20. OLAP Catalog 11.2.0.4.0 OPTION
  21.                                                     OFF
  22. Spatial 12.1.0.1.0 VALID
  23. Oracle Multimedia 12.1.0.1.0 VALID
  24. Oracle XML Database 12.1.0.1.0 VALID
  25. Oracle Text 12.1.0.1.0 VALID
  26. Oracle Workspace Manager 12.1.0.1.0 VALID
  27. Oracle Database Catalog Views 12.1.0.1.0 VALID
  28. Oracle Database Packages and Types 12.1.0.1.0 VALID
  29. JServer JAVA Virtual Machine 12.1.0.1.0 VALID
  30. Oracle XDK 12.1.0.1.0 VALID
  31. Oracle Database Java Packages 12.1.0.1.0 VALID
  32. OLAP Analytic Workspace 12.1.0.1.0 VALID
  33. Oracle OLAP API 12.1.0.1.0 VALID

  34. 15 rows selected.

16.2  從上面我們可以看到有些元件的狀態是不對的,這是老版本的元件,不能直接通過升級上12c,需要執行如下SQL進行刪除。
  1. SQL> @$ORACLE_HOME/rdbms/admin/emremove.sql
  2. SQL> @$ORACLE_HOME/olap/admin/catnoamd.sql
  3. SQL> EXECUTE dbms_stats.gather_dictionary_stats;
 再次檢視就沒有問題了:

  1. SQL> select comp_name,version,status from dba_registry;

  2. COMP_NAME VERSION STATUS
  3. ----------------------------------- --------------- -------
  4. Oracle Application Express 4.2.0.00.27 VALID
  5. OWB 11.2.0.3.0 VALID
  6. Spatial 12.1.0.1.0 VALID
  7. Oracle Multimedia 12.1.0.1.0 VALID
  8. Oracle XML Database 12.1.0.1.0 VALID
  9. Oracle Text 12.1.0.1.0 VALID
  10. Oracle Workspace Manager 12.1.0.1.0 VALID
  11. Oracle Database Catalog Views 12.1.0.1.0 VALID
  12. Oracle Database Packages and Types 12.1.0.1.0 VALID
  13. JServer JAVA Virtual Machine 12.1.0.1.0 VALID
  14. Oracle XDK 12.1.0.1.0 VALID
  15. Oracle Database Java Packages 12.1.0.1.0 VALID
  16. OLAP Analytic Workspace 12.1.0.1.0 VALID
  17. Oracle OLAP API 12.1.0.1.0 VALID

  18. 14 rows selected.

16.3 /etc/oratab 資訊對比
  1. ---升級前
  2. [root@db01 ~]# grep DBSoft /etc/oratab
  3. woo:/DBSoft/Product/11.2.0/db_1:N

  4. ---升級後
  5. [root@db01 ~]# grep DBSoft /etc/oratab
  6. woo:/DBSoft/Product/12.1.0/db_1:N

注意:這部分不需要我們手工去修改/etc/oratab記錄,執行升級會自動完成修改。

16.4 執行升級後postupgrade_fixups.sql檢查:

  1. SQL> @/DBSoft/cfgtoollogs/woo/preupgrade/postupgrade_fixups.sql
  2. Post Upgrade Fixup Script Generated on 2014-11-20 05:18:29 Version: 12.1.0.1 Build: 007
  3. Beginning Post-Upgrade Fixups...

  4. PL/SQL procedure successfully completed.
  5. PL/SQL procedure successfully completed.

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

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

  19. PL/SQL procedure successfully completed.

  20. **********************************************************************
  21.                      [Post-Upgrade Recommendations]
  22. **********************************************************************

  23. PL/SQL procedure successfully completed.

  24.                         *****************************************
  25.                         ******** Fixed Object Statistics ********
  26.                         *****************************************

  27. Please create stats on fixed objects two weeks
  28. after the upgrade using the command:
  29.    EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

  30. ^^^ MANUAL ACTION SUGGESTED ^^^

  31. PL/SQL procedure successfully completed.

  32.            **************************************************
  33.                 ************* Fixup Summary ************

  34.  1 fixup routine generated an INFORMATIONAL message that should be reviewed.


  35. PL/SQL procedure successfully completed.

  36. *************** Post Upgrade Fixup Script Complete ********************

  37. PL/SQL procedure successfully completed.

  38. SQL>
16.5 檢查DST
     從升級後的檢查結果來看,
DST目前是18,說明不需要人工處理了,如果不是需要手工來處理,參考Metalink ID: 977512.1 或者參考Metalink ID 1585343.1

  1. SQL> r
  2.   1 SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
  3.   2 FROM DATABASE_PROPERTIES
  4.   3 WHERE PROPERTY_NAME LIKE \'DST_%\'
  5.   4* ORDER BY PROPERTY_NAME

  6. PROPERTY_NAME VALUE
  7. ---------------------------------------- ------------------------------------------------------------------------------------------------------------------------
  8. DST_PRIMARY_TT_VERSION 18
  9. DST_SECONDARY_TT_VERSION 0
  10. DST_UPGRADE_STATE NONE

  11. SQL> select * from v$timezone_file;

  12. FILENAME VERSION CON_ID
  13. -------------------- ---------- ----------
  14. timezlrg_18.dat 18 0

  15. SQL> select TZ_VERSION from registry$database;

  16. TZ_VERSION
  17. ----------
  18.         18

6.6 字符集檢查:

檢查國家字符集,如果是以下字符集則不需要做操作:

如果返回結果是 UTF8 或者 AL16UTF16,那麼什麼都不需要做了。
如果返回結果不是 UTF8 或者 AL16UTF16,那麼請參考下面的文件:

Note 276914.1 The National Character Set ( NLS_NCHAR_CHARACTERSET ) in Oracle 9i, 10g , 11g and 12c (文件 ID 276914.1)

  1. SQL> select value from nls_database_parameters where parameter=\'NLS_NCHAR_CHARACTERSET\';

  2. VALUE
  3. --------------------------------------------------------------------------------
  4. AL16UTF16
 

6.7 修改引數檔案中的版本號:

  1. SQL> show parameter compatible

  2. NAME TYPE VALUE
  3. ------------------------------------ ----------- ------------------------------
  4. compatible string 11.2.0.0.0
  5. noncdb_compatible boolean FALSE

  6. SQL> alter system set compatible = \'12.1.0.1.0\' scope=spfile;
  7. System altered.

  8. SQL> startup force;
  9. ORACLE instance started.

  10. Total System Global Area 2772574208 bytes
  11. Fixed Size 2292240 bytes
  12. Variable Size 2533361136 bytes
  13. Database Buffers 218103808 bytes
  14. Redo Buffers 18817024 bytes
  15. Database mounted.
  16. Database opened.
  17. SQL>
  18. SQL> show parameter compatible

  19. NAME TYPE VALUE
  20. ------------------------------------ ----------- ------------------------------
  21. compatible string 12.1.0.1.0
  22. noncdb_compatible boolean FALSE
  23. SQL>



至此,經過漫長而辛苦的升級,我們已經將11.2.0.4順利升級到了12.1.0.1,整個升級過程雖然有點長,但還是比較順利的。故需再生產環境中升級請大家務必預留好可用於升級的時間視窗,升級時間確實是非常的長。









來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29439655/viewspace-1373046/,如需轉載,請註明出處,否則將追究法律責任。

相關文章