#ORACLE12.2 升級之路 之 07(11.2.0.4本機升級12.2.0.1)
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL>
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ---------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string MPACC
db_unique_name string MPACC
global_names boolean FALSE
instance_name string MPACC
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string MPACC
SQL>
set pagesize 500
set line 300
col comp_name format a40
col comp_name format a35
col version format a15
col status format a7
SQL> select comp_name,version,status from dba_registry;
COMP_NAME VERSION STATUS
----------------------------------- --------------- -------
Oracle Enterprise Manager 11.2.0.4.0 VALID
OLAP Catalog 11.2.0.4.0 VALID
Spatial 11.2.0.4.0 VALID
Oracle Multimedia 11.2.0.4.0 VALID
Oracle XML Database 11.2.0.4.0 VALID
Oracle Text 11.2.0.4.0 VALID
Oracle Data Mining 11.2.0.4.0 VALID
Oracle Expression Filter 11.2.0.4.0 VALID
Oracle Rule Manager 11.2.0.4.0 VALID
Oracle Workspace Manager 11.2.0.4.0 VALID
Oracle Database Catalog Views 11.2.0.4.0 VALID
Oracle Database Packages and Types 11.2.0.4.0 VALID
JServer JAVA Virtual Machine 11.2.0.4.0 VALID
Oracle XDK 11.2.0.4.0 VALID
Oracle Database Java Packages 11.2.0.4.0 VALID
OLAP Analytic Workspace 11.2.0.4.0 VALID
Oracle OLAP API 11.2.0.4.0 VALID
17 rows selected.
[oracle@XAG140 OPatch]$ pwd
/u01/app/oracle/product/11.2.0/db_1/OPatch
[oracle@XAG140 OPatch]$
[oracle@XAG140 OPatch]$ ./opatch lspatches
27923163;OJVM PATCH SET UPDATE 11.2.0.4.180717
27734982;Database Patch Set Update : 11.2.0.4.180717 (27734982)
OPatch succeeded.
-----------------------------------------
关闭数据库实例及相关进程 (静态监听、动态监听、EOM、相关服务)
-root下
mkdir -p /u02/app/oracle/product/12.2.0/db_1
chown -R oracle:oinstall /u02/app
chmod -R 775 /u02/app
mkdir -p /u02/setup
chown -R oracle:oinstall /u02/setup
chmod -R 775 /u02/setup
yum -y install smartmontools
rpm -Va pdksh-5.2.14-37.el5_8.1.i386
yum -y install ksh
7. 修改环境变量
然后,再修改oracle用户的.bash_profile
ORACLE_BASE=/u02/app/oracle;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
然后source ~/.bash_profile
-------开始安装ORACLE 12C软件(選擇 Upgrade an existing database)------------------------------
archive log list;
shutdown immediate;
startup mount;
select status from v$instance;
alter database noarchivelog;
alter database open;
archive log list;
8. 登录查看,升级后版本
[oracle@11g ~]$ sqlplus / as sysdba
set linesize 150;
set pagesize 9999;
col comp_name format a40;
SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
SQL> select count(*) from dba_objects where status<>'VALID';
COUNT(*)
----------
0
SQL> select * from utl_recomp_errors;
no rows selected
------------------------------------------------------------------------
编译失效对象(如存在失效對象,則運行如下腳本)
SQL>@$ORACLE_HOME/rdbms/admin/catuppst.sql
Session altered.
--多次执行utlrp.sql,失效对象数量不再变化
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
--------------------------------------------------------------------------
col owner for a20;
col object_name for a32;
col object_type for a16;
col status for a8;
select owner, object_name, object_type, status
from dba_objects
where status='INVALID'
order by 1,2,3;
9. 修改compatible参数,若修改完成,此次升级操作就无法回退,一定要在应用经过测试之后修改。
SQL> show parameter compatible;
SQL> alter system set compatible='12.2.0.1.0' scope=spfile;
SQL>
shutdown immediate;
startup;
show parameter compatible;
SQL>
set linesize 150;
set pagesize 9999;
col comp_name format a40;
SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
----------------------------------升級完成----------------------------------------------------------------