ORACLE11G R2 升级到ORACLE12C 图文指南

附:oracle升级到oracle12C路线图,点击图片查看高清图片:

目前oracle提供以下支持的升级方式:
1) DBUA (Database Upgrade Assistant)
2) Manual upgrade
3) Export/Import
4) Data Copying
5) Golden Gate
以上升级方式对其他版本以及12C的支持具体升级方式请参考官方文档419550.1, 该文档包含各种方式升级文档ID号,方便查阅
本文主要演示使用DBUA配置助手升级oracle11.2.0.3.0到12C(12.1)

测试环境:win7+虚拟机

数据库源版本:oracle11gRelease 11.2.0.3.0
升级目标版本:oracle12CRelease 12.1.0.1.0
提示:升级时请保持磁盘空间有足够的剩余空间,升级前请做好数据库的备份!
1、环境检查:
oracle11gRelease 11.2.0.3.0:

[root@oracledba ~]# su - oracle
[oracle@oracledba ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Sep 26 12:16:25 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.

oracle12CRelease 12.1.0.1.0:

[oracle@oracledba ~]$ source .bash_profile12c 
[oracle@oracledba ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 12:17:54 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.

2、升级准备
使用源11G数据库环境执行预升级检查脚本preupgrd.sql,检查纠正升级环境中的配置问题,具体参考官方文档 884522.1,执行完成后生成检查日志和修复脚本,如下:

SQL> @/u02/app/product/12.1.0/db_1/rdbms/admin/preupgrd.sql
Loading Pre-Upgrade Package...
Executing Pre-Upgrade Checks...
Pre-Upgrade Checks Complete.
      ************************************************************

Results of the checks are located at:
 /u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade.log

Pre-Upgrade Fixup Script (run in source database environment):
 /u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql

Post-Upgrade Fixup Script (run shortly after upgrade):
 /u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql

      ************************************************************

	 Fixup scripts must be reviewed prior to being executed.

      ************************************************************

      ************************************************************
		   ====>> USER ACTION REQUIRED	<<====
      ************************************************************

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

 1) Check Tag:	  JOB_QUEUE_PROCESS
    Check Summary: Check JOB_QUEUE_PROCESSES value
    Fixup Summary:
     "Review and increase or remove the setting of job_queue_processes"
    +++ Source Database Manual Action Required +++

	    You MUST resolve the above error prior to upgrade

      ************************************************************

在源11g数据库环境执行修复脚本preupgrade_fixups.sql修复问题,查看检查日志preupgrade.log,完成检查日志中相关操作:
PS:检查日志的结果和你本身源数据库的各项配置有关,如果你的数据库比较正常,各项设置也设置的比较合理,可能需要的操作就比较少。请根据实际情况进行配置。由于是测试,这里得做以下操作:

[oracle@oracledba ~]$ emctl stop dbconsole
$>ALTER SYSTEM SET PROCESSES=300 SCOPE=SPFILE;
SQL> @/u02/app/product/12.1.0/db_1/rdbms/admin/emremove.sql
SQL>@/u01/app/oracle/product/11.2.0/db_1/olap/admin/catnoamd.sql
SQL> alter system set job_queue_processes=10 scope=spfile;
SQL> EXECUTE dbms_stats.gather_dictionary_stats;

3、开始升级
完成后基本就可以执行dbua配置助手执行升级了,执行dbua需要到12C环境运行,下面是整个过程的相关截图:和以前的升级还是有点区别

[oracle@oracledba ~]$ echo $ORACLE_SID
orcl12c
[oracle@oracledba ~]$ dbua

选择数据库升级,如下:

确认升级数据库的版本以及数据库的主目录:

升级环境检查,如有需要重新配置的选项可以看看下面的提示,按照提示执行即可:

升级选项:可以选择并行方式的升级,可以根据实际的服务器CPU个数进行选择,这是以前版本没有的一个功能,根据实际情况选择:

 

升级时是否需要移动数据文件:

监听选择:

 

是否备份,如果你之前已经备份了数据库可以选择 I have my own backup and restore strategy

 

整个升级配置的概览:

开始升级,整个过程根据你服务器情况而定,我这虚拟机跑了差不多5小时:
全部运行完成后界面:

点击Upgrade Results按钮 可以查看升级结果如图:

close后退出升级GUI窗口,同时shell窗口提示如下!

Database upgrade has been completed successfully, and the database is ready to use.
[oracle@oracledba ~]$

4、检查升级结果
查看源数据库的ORACLE_HOME是否更改成ORACLE12C的HOME目录
这里需要注意一下,如果升级完成后源数据库的ORACLE_HOME没有自动改成ORACLE12C的HOME目录,需要手动更改一下!否则使用原来的ORACLE_HOME已经不能打开数据库!
查看/etc/oratab,并连接数据库

[root@oracledba ~]# cat /etc/oratab | grep orcl
orcl:/u02/app/product/12.1.0/db_1:N
[root@oracledba ~]# 

[root@oracledba ~]# su - oracle
[oracle@oracledba ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 21:39:15 2013

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>  select * from v$version;

BANNER										     CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production		  0
PL/SQL Release 12.1.0.1.0 - Production							  0
CORE	12.1.0.1.0	Production							  0
TNS for Linux: Version 12.1.0.1.0 - Production						  0
NLSRTL Version 12.1.0.1.0 - Production

再回头看看第二步升级准备的时候执行的脚本日志里面有这个提示,需要执行脚本,可能有后续配置需要处理,有兴趣的可以看看执行结果:

Post-Upgrade Fixup Script (run shortly after upgrade):
 /u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql

SQL> @/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
Post Upgrade Fixup Script Generated on 2013-09-26 12:26:50  Version: 12.1.0.1 Build: 006
Beginning Post-Upgrade Fixups...

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

**********************************************************************
Check Tag:     INVALID_OBJECTS_EXIST
Check Summary: Check for invalid objects
Fix Summary:   Invalid objects are displayed and must be reviewed.
**********************************************************************
Fixup Returned Information:
WARNING: --> Database contains INVALID objects prior to upgrade

     The list of invalid SYS/SYSTEM objects was written to
     registry$sys_inv_objs.
     The list of non-SYS/SYSTEM objects was written to
     registry$nonsys_inv_objs unless there were over 5000.
     Use utluiobj.sql after the upgrade to identify any new invalid
     objects due to the upgrade.
**********************************************************************

PL/SQL procedure successfully completed.

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

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

PL/SQL procedure successfully completed.

**********************************************************************
                     [Post-Upgrade Recommendations]
**********************************************************************

PL/SQL procedure successfully completed.

                        *****************************************
                        ******** Fixed Object Statistics ********
                        *****************************************

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

^^^ MANUAL ACTION SUGGESTED ^^^

PL/SQL procedure successfully completed.

           **************************************************
                ************* Fixup Summary ************

 2 fixup routines generated INFORMATIONAL messages that should be reviewed.

PL/SQL procedure successfully completed.

*************** Post Upgrade Fixup Script Complete ********************

PL/SQL procedure successfully completed.

到此整个升级过程就完成了,整个过程还算顺利,建议升级之前最好相关备份,以备升级失败能正常恢复!升级有风险,操作需谨慎!o(∩_∩)o

你可能感兴趣的:(ORACLE,文档)