Oracle数据库异机升级
环境:
A机:RHEL5.5 + Oracle 10.2.0.4
B机:RHEL5.5
需求:
A机10.2.0.4数据库,在B机升级到11.2.0.4,应用最新PSU补丁程序。
目录:
一、 确认是否可以直接升级
二、 B机安装11g软件,打好PSU补丁
三、 B机环境变量检查
四、 B机创建需要的目录
五、 A机原库升级前检查
六、 A机备份原库
七、 B机恢复数据库
八、 B机升级数据库
九、 B机升级后操作
- 9.1 创建spfile文件
- 9.2 执行EXECUTE dbms_stats.gather_dictionary_stats;
- 9.3 重新编译
- 9.4 查看失效对象
- 9.5 运行升级后检查脚本
- 9.6 数据库层面应用PSU
一、 确认是否可以直接升级
本次需求:Oracle 10.2.0.4 -> 11.2.0.4.7
从下图中看到,可以直接升级。
![](http://images.cnblogs.com/cnblogs_com/jyzhao/652804/o_oracle_upgrade2.png)
二、 B机安装11g软件,打好PSU补丁
安装11g软件(不需要建库)可参考:[http://www.cnblogs.com/jyzhao/p/3891769.html](http://www.cnblogs.com/jyzhao/p/3891769.html)
打PSU补丁(补丁随带的readme必须看)可参考:[http://www.cnblogs.com/jyzhao/p/4145273.html](http://www.cnblogs.com/jyzhao/p/4145273.html)
三、 B机环境变量检查
```
echo $ORACLE_BASE
echo $ORACLE_HOME
echo $ORACLE_SID
echo $PATH
```
四、 B机创建需要的目录
B机建议先创建以下目录,其中scripts不是必须的,对于bdump,udump在11g不再需要了,这点从后面的升级前检查脚本的输出结果也可看到。
```
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/dpdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/scripts
```
五、 A机原库升级前检查
将B机11.2.0.4的`utlu112i.sql`,scp到A机上,进行升级检查。
5.1 从B机上传utlu112i.sql脚本到A机
```
$ scp $ORACLE_HOME/rdbms/admin/utlu112i.sql 192.168.xx.xx:/home/oracle
```
5.2 A机执行utlu112i.sql进行升级前检查
```
[oracle@oracle10g oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Dec 26 06:46:46 2014
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> spool upgrade.info
SQL> @/home/oracle/utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 08-28-2015 10:02:57
Script Version: 11.2.0.4.0 Build: 007
.
Database:
--> name: VAS
--> version: 10.2.0.4.0
--> compatible: 10.2.0.3.0
--> blocksize: 8192
--> platform: Linux x86 64-bit
--> timezone file: V4
.
Tablespaces: [make adjustments in the current environment]
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 991 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 790 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
.
Flashback: OFF
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
-- No renamed parameters found. No changes are required.
.
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
--> background_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest"
--> user_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest"
.
Components: [The following database components will be upgraded or installed]
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Data Mining [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
.
Miscellaneous Warnings
WARNING: --> Database is using a timezone file older than version 14.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 10.2.0.4.0 database timezone version
.... to the latest version which comes with the new release.
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.
.... Use utluiobj.sql after the upgrade to identify any new invalid
.... objects due to the upgrade.
.... USER CRNOPHQOA has 2 INVALID objects.
WARNING: --> EM Database Control Repository exists in the database.
.... Direct downgrade of EM Database Control is not supported. Refer to the
.... Upgrade Guide for instructions to save the EM data prior to upgrade.
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
WARNING: --> JOB_QUEUE_PROCESS value must be updated
.... Your current setting of "10" is too low.
.... Starting with Oracle Database 11g Release 2 (11.2), setting
.... JOB_QUEUE_PROCESSES to 0 causes both DBMS_SCHEDULER and
.... DBMS_JOB jobs to not run. Previously, setting JOB_QUEUE_PROCESSES
.... to 0 caused DBMS_JOB jobs to not run, but DBMS_SCHEDULER jobs were
.... unaffected and would still run. This parameter must be updated to
.... a value greater than 32 (default value is 1000) prior to upgrade.
.... Not doing so will affect the running of utlrp.sql after the upgrade
.
Recommendations
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
SQL> spool off
<h2 id="5.3">5.3 根据检查结果调整A机数据库</h2>
### 5.3.1 表空间对比满足条件 ###
select file_name,tablespace_name,maxbytes/1024/1024 from dba_data_files
where tablespace_name in('SYSTEM','UNDOTBS1','SYSAUX')
union all
select file_name,tablespace_name,maxbytes/1024/1024 from dba_temp_files;
### 5.3.2 A机创建pfile文件 ###
SQL> create pfile='/home/oracle/orcl10.pfile' from spfile;
### 5.3.3 A机scp pfile文件到B机 ###
$ scp /home/oracle/orcl10.pfile 192.168.xx.xx:/home/oracle
### 5.3.4 B机上编辑pfile文件 ###
注意下sga和pga的设定是否符合目的机器的配置
.sga_target=629145600
.pga_aggregate_target=25165824
将.background_dump_dest和.user_dump_dest删除
加上 *.diagnostic_dest='$ORACLE_BASE'
注:参数文件的修改不用多说,但需要注意其他各参数的值是否符合需求。
修改后复制一份到$ORACLE_HOME/dbs/init$ORACLE_SID.ora
$ cp /home/oracle/orcl10.pfile $ORACLE_HOME/dbs/init$ORACLE_SID.ora
### 5.3.5 A机运行utlrp.sql 脚本,重新编译无效对象 ###
重新编译SYS 和SYSTEM 中的无效对象
记录无效对象:
col OWNER for a10;
col OBJECT_NAME for a30;
col OBJECT_TYPE for a10;
select * from registry$nonsys_inv_objs; //非sys/system的失效对象
select * from registry$sys_inv_objs; //sys/system的失效对象
SQL> @?/rdbms/admin/utlrp.sql;
重新执行 @/home/oracle/utlu112i.sql,查看是否重新编译,
### 5.3.6 A机执行PURGE DBA_RECYCLEBIN ###
SQL> PURGE DBA_RECYCLEBIN;
DBA Recyclebin purged.
### 5.3.7 A机收集系统信息EXECUTE dbms_stats.gather_dictionary_stats; ###
在升级前收集字典统计信息,否则预升级工具( utlu102i.sql)会花费更长时间
SQL> EXECUTE dbms_stats.gather_dictionary_stats;
PL/SQL procedure successfully completed.
注意:升级之后执行utluiobj.sql
<h1 id="6">六、 A机备份原库 </h1>
为了不影响业务的网络带宽,可采用DCN网络进行NFS的搭建,同时不必再传送备份文件。
NFS配置参考:[http://www.cnblogs.com/jyzhao/p/3809078.html](http://www.cnblogs.com/jyzhao/p/3809078.html)
A机备份原库可参考:[http://www.cnblogs.com/jyzhao/p/4806434.html#1](http://www.cnblogs.com/jyzhao/p/4806434.html#1)
<h1 id="7">七、 B机恢复数据库 </h1>
B机恢复数据库可参考:[http://www.cnblogs.com/jyzhao/p/4806434.html#2](http://www.cnblogs.com/jyzhao/p/4806434.html#2)
**注意:**这里恢复完成不要直接尝试打开数据库。因为我们是要升级!需要open resetlogs upgrade(在下一个步骤说明)。
<h1 id="8">八、 B机升级数据库 </h1>
<h2 id="8.1">8.1 修改恢复后的数据库为非归档模式</h2>
为预防升级测试过程中默认的归档空间不够,这里升级先把库开启为非归档模式。
SQL> select status from v$instance;
STATUS
MOUNTED
SQL> alter database noarchivelog;
Database altered.
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 27
Current log sequence 29
<h2 id="8.2">8.2 alter database open resetlogs upgrade;</h2>
SQL> alter database open resetlogs upgrade;
<h2 id="8.3">8.3 执行升级脚本</h2>
SQL> spool upgrade.log
SQL> @?/rdbms/admin/catupgrd.sql
本次升级经验值:
测试库此步骤升级运行时间:37分钟。
生产库此步骤升级运行时间:61分钟。
<h1 id="9">九、 B机升级后操作 </h1>
<h2 id="9.1">9.1 创建spfile文件</h2>
SQL> startup pfile='$ORACLE_HOME/dbs/init$ORACLE_SID.ora'
SQL> create spfile from pfile='$ORACLE_HOME/dbs/init$ORACLE_SID.ora';
<h2 id="9.2">9.2 执行EXECUTE dbms_stats.gather_dictionary_stats;</h2>
SQL> exec dbms_stats.gather_dictionary_stats;
PL/SQL procedure successfully completed.
<h2 id="9.3">9.3 重新编译</h2>
SQL> @?/rdbms/admin/utlrp.sql
<h2 id="9.4">9.4 查看失效对象 </h2>
SQL> SELECT count(*) FROM dba_invalid_objects;
如果失效对象为升级之前的失效对象,升级过程中没有使对象失效。
<h2 id="9.5">9.5 运行升级后检查脚本</h2>
SQL> @?/rdbms/admin/utlu112s.sql
.
Oracle Database 11.2 Post-Upgrade Status Tool 08-31-2015 16:13:55
.
Component Current Version Elapsed Time
Name Status Number HH:MM:SS
.
Oracle Server
. VALID 11.2.0.4.0 00:07:44
JServer JAVA Virtual Machine
. VALID 11.2.0.4.0 00:05:02
Oracle Workspace Manager
. VALID 11.2.0.4.0 00:00:21
OLAP Analytic Workspace
. VALID 11.2.0.4.0 00:00:20
OLAP Catalog
. VALID 11.2.0.4.0 00:00:30
Oracle OLAP API
. VALID 11.2.0.4.0 00:00:15
Oracle Enterprise Manager
. VALID 11.2.0.4.0 00:05:23
Oracle XDK
. VALID 11.2.0.4.0 00:01:48
Oracle Text
. VALID 11.2.0.4.0 00:00:30
Oracle XML Database
. VALID 11.2.0.4.0 00:02:42
Oracle Database Java Packages
. VALID 11.2.0.4.0 00:00:08
Oracle Multimedia
. VALID 11.2.0.4.0 00:02:21
Spatial
. VALID 11.2.0.4.0 00:03:32
Oracle Expression Filter
. VALID 11.2.0.4.0 00:00:06
Oracle Rules Manager
. VALID 11.2.0.4.0 00:00:05
Final Actions
. 00:00:25
Total Upgrade Time: 00:31:21
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.09
<h2 id="9.6">9.6 数据库层面应用PSU</h2>
cd $ORACLE_HOME/rdbms/admin/
SQL> @catbundle.sql psu apply
### 检查opatch补丁相关信息: ###
./opatch lspatches
./opatch lsinventory
### 查询dba_registry_history: ###
SQL> select * from dba_registry_history;
到此,已完成数据库异机升级操作。
Oracle数据库异机升级的更多相关文章
- Oracle 数据库异机恢复(归档模式)
操作必须在服务器上进行(在192.168.12.71上执行) 0.按需要恢复的日期,把距恢复日期最近的全部备份和全部备份日期后的日志备份一同拷贝到需要恢复的机器上: 1.用RMAN登陆 C:\User ...
- RMAN数据库异机迁移步骤
--RMAN数据库异机迁移步骤----------------------------2013/09/28 测试环境:AIX+ora11g 一. source数据库准备. 1.获取数据文件编号 ...
- 基于RMAN从活动数据库异机克隆(rman duplicate from active DB)
Oracle 11g RMAN能够实现基于活动数据库进行异机克隆,从而省去需要先备份再ftp到辅助服务器的过程.这一切可以全部交给Oracle来搞定.在克隆期间,Oracle会读取Target DB的 ...
- oracle rman异机恢复
Oracle源主机 Oracle目标主机 主机平台 CentOS6.2(final) CentOs6.2(FInal) 主机名 vick rman IP地址 192.168.1.11 192.16 ...
- Oracle 11g 异机恢复参考文档
原库 目标库 操作系统 CentOS 6.4 CentOS 6.4 主机名 sht-sgmhadoopnn-01 sht-sgmhadoopnn-02 IP 172.16.101.55 172.1 ...
- Oracle RMAN 异机恢复一例
背景介绍:本例需求是将NBU备份的oracle数据库恢复到另一主机上. NBU环境配置.异机上的Oracle软件安装配置忽略,下面只介绍OracleDB恢复的过程. ----------------- ...
- KingbaseES R6 单节点数据库异机恢复案例
数据库运行硬件或系统环境如果发生了不可恢复的故障,这时只能采用异机恢复的方式恢复数据库.以下通过例子介绍异机恢复的过程. 一.硬件环境 192.168.237.101 数据库运行源主机 192.168 ...
- RMAN数据库异机迁移
本文讲述如何用rman将一个库迁移到另一个服务器上. 服务器A:linux es4 + oracle9204 (源)服务器B:linux es4 + oracle9204 (目标) 一.创建目录 为了 ...
- Oracle数据库升级(10.2.0.4->11.2.0.4)
环境: RHEL5.4 + Oracle 10.2.0.4 目的: 在本机将数据库升级到11.2.0.4 之前总结的Oracle数据库异机升级:http://www.cnblogs.com/jyzha ...
随机推荐
- wepack+sass+vue 入门教程(二)
六.新建webpack配置文件 webpack.config.js 文件整体框架内容如下,后续会详细说明每个配置项的配置 webpack.config.js直接放在项目demo目录下 module.e ...
- webapi - 使用依赖注入
本篇将要和大家分享的是webapi中如何使用依赖注入,依赖注入这个东西在接口中常用,实际工作中也用的比较频繁,因此这里分享两种在api中依赖注入的方式Ninject和Unity:由于快过年这段时间打算 ...
- 闲来无聊,研究一下Web服务器 的源程序
web服务器是如何工作的 1989年的夏天,蒂姆.博纳斯-李开发了世界上第一个web服务器和web客户机.这个浏览器程序是一个简单的电话号码查询软件.最初的web服务器程序就是一个利用浏览器和web服 ...
- 一看就懂的ReactJs入门教程-精华版
现在最热门的前端框架有AngularJS.React.Bootstrap等.自从接触了ReactJS,ReactJs的虚拟DOM(Virtual DOM)和组件化的开发深深的吸引了我,下面来跟我一起领 ...
- Visaul Studio 常用快捷键的动画演示
从本篇文章开始,我将会陆续介绍提高 VS 开发效率的文章,欢迎大家补充~ 在进行代码开发的时候,我们往往会频繁的使用键盘.鼠标进行协作,但是切换使用两种工具会影响到我们的开发速度,如果所有的操作都可以 ...
- 和 Thrift 的一场美丽邂逅
一. 与 Thrift 的初识 也许大多数人接触 Thrift 是从序列化开始的.每次搜索 “java序列化” + “方式”.“对比” 或 “性能” 等关键字时,搜索引擎总是会返回一大堆有关各种序列化 ...
- redis 学习笔记(2)
redis-cluster 简介 redis-cluster是一个分布式.容错的redis实现,redis-cluster通过将各个单独的redis实例通过特定的协议连接到一起实现了分布式.集群化的目 ...
- ZKWeb网页框架1.3正式发布
本次更新的内容有 更新引用包版本 Microsoft.AspNetCore.Hosting.Abstractions 1.1.0 Microsoft.AspNetCore.Http.Abstracti ...
- SharePoint 2016 入门视频教程
之前一直有朋友让自己录一些SharePoint的入门视频,之前没有太多时间,一个巧合的机会收到CSDN学院的邮件,可以在CSDN上发布视频教程,自己就录了一些.说起录视频也是蛮辛苦的,每天下班吃完饭要 ...
- 好用的Markdown编辑器一览 readme.md 编辑查看
https://github.com/pandao/editor.md https://pandao.github.io/editor.md/examples/index.html Editor.md ...