0%

Oracle11.2.0.3升级到11.2.0.4

查看数据库信息

1
2
3
4
5
6
7
8
9
SQL> select DBID,NAME,LOG_MODE,PLATFORM_NAME,CURRENT_SCN,DB_UNIQUE_NAME from v$database;
            DBID NAME LOG_MODE PLATFORM_NAME CURRENT_SCN DB_UNIQUE_NAME
---------- --------- ------------ ------------------------------ ----------- ---------
3079346487 OGG ARCHIVELOG Linux x86 64-bit 1128003 ogg
  
SQL> select INSTANCE_NAME,HOST_NAME,VERSION,DATABASE_STATUS from v$instance;
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION DATABASE_STATUS
---------------- ------------------------------ ------------ ---------------
1 ogg OGG 11.2.0.3.0 ACTIVE

备份数据库

1
RMAN >backup database INCLUDE CURRENT CONTROLFILE PLUS ARCHIVELOG;

停止数据库相关服务

1
2
3
4
5
6
7
8
SQL> shutdown immediate  
Database closed.
Database dismounted.
ORACLE instance shut down.
  
[oracle@OGG database]$ emctl stop dbconsole
  
[oracle@OGG database]$ lsnrctl stop

安装11.2.0.4 DB软件

编辑响应文件(/解压路径/response/db_install.rsp)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
##安装类型
oracle.install.option=INSTALL_DB_SWONLY
##主机名称
ORACLE_HOSTNAME=adg
##用户组
UNIX_GROUP_NAME=oinstall
##清单目录
INVENTORY_LOCATION=/u01/app/oraInventory
##选择语言
SELECTED_LANGUAGES=en,zh_CN
##ORACLE_HOME
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
##ORACLE_BASE
ORACLE_BASE=/u01/app/oracle
##安装企业版
oracle.install.db.InstallEdition=EE
##不用安全更新
DECLINE_SECURITY_UPDATES=true
##DBA用户组
oracle.install.db.DBA_GROUP=dba
##oper用户组
oracle.install.db.OPER_GROUP=oper
##跳过更新
oracle.installer.autoupdates.option

执行安装

1
$ ./runInstaller -silent -force -ignorePrereq -noconfig -responseFile /u01/soft/database/response/db_install.rsp

根据提示root用户执行脚本

1
2
3
As a root user, execute the following script(s):
    1. /app/oracle/oraInventory/orainstRoot.sh
    2. /app/oracle/11g/product/11.2.0/db_1/root.sh

升级前配置

修改环境变量

1
2
$ vi ~/.bash_profile
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1

拷贝配置文件

1
$ cp -r /u01/app/oracle/product/11.2.0/db_1/network/admin/* $ORACLE_HOME/network/admin/

预升级脚本检查

1
2
SQL> startup upgrade;
SQL> @?/rdbms/admin/utlu112i.sql

创建数据库还原点

1
2
3
SQL> alter database flashback on;
SQL> create restore point before_update guarantee flashback database;
SQL> select * from v$restore_point;

执行升级

执行升级脚本

1
2
3
4
5
SQL> startup upgrade;
SQL> set echo on
SQL> spool /home/oracle/upgrade.log
SQL> set time on;
SQL>@?/rdbms/admin/catupgrd.sql

编译失效对象

1
2
SQL>startup
SQL> @?/rdbms/admin/utlrp.sql

查看组件信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
SQL> select comp_name,status,version from dba_server_registry;
  
COMP_NAME STATUS VERSION
---------------------------------------- ---------------------- ------------------------------
OWB VALID 11.2.0.3.0
Oracle Application Express VALID 3.2.1.00.12
Oracle Enterprise Manager VALID 11.2.0.4.0
OLAP Catalog VALID 11.2.0.4.0
Spatial VALID 11.2.0.4.0
Oracle Multimedia VALID 11.2.0.4.0
Oracle XML Database VALID 11.2.0.4.0
Oracle Text VALID 11.2.0.4.0
Oracle Expression Filter VALID 11.2.0.4.0
Oracle Rules Manager VALID 11.2.0.4.0
Oracle Workspace Manager VALID 11.2.0.4.0
  
COMP_NAME STATUS VERSION
---------------------------------------- ---------------------- ------------------------------
Oracle Database Catalog Views VALID 11.2.0.4.0
Oracle Database Packages and Types VALID 11.2.0.4.0
JServer JAVA Virtual Machine VALID 11.2.0.4.0
Oracle XDK VALID 11.2.0.4.0
Oracle Database Java Packages VALID 11.2.0.4.0
OLAP Analytic Workspace VALID 11.2.0.4.0
Oracle OLAP API VALID 11.2.0.4.0

查看失效对象

1
2
3
SQL> select * from dba_objects where status !='VALID';
  
no rows selected