oracle 10.1.0.2.0 升级到 10.2.0.5.0全过程(转)

oracle 10.1.0.2.0 升级到 10.2.0.5.0全过程(windows 32位)

http://www.ixpub.net/home.php?do=blog&id=413231&mod=space&uid=21256317

oracle 10.1.0.2.0 升级到 10.2.0.5.0全过程(windows 32位)

 

上周帮一个客户升级了oracle数据库,现将在本机实验的整个过程记录如下:

 

1 、背景

有一个客户需要将windows 32位机器上部署的单机oracle数据库oracle 10.1.0.2.0升级到10.2.0.5.0,公司领导将这个任务安排给了我,要求我通过网络联系客户负责人,全程参与,提供软件及补丁包等,并且答疑解惑。

2 、升级计划

原计划从10.1.0.2.0升级到10.2.0.1.0,然后升级到10.2.0.4.0,最后升级到10.2.0.5.0

 

以下是领导发邮件给我安排的任务,下载3个补丁:

客户XX数据库需升级,请下载3个补丁

1.windows 32  10.1.0.2 升级到10.2.0.1

2.windows 32  10.2.0.1升级到10.2.0.4

3.windows 32  10.2.0.1升级到10.2.0.5

 

接到任务后,我在metlink上找了很久,google、百度了很久,就是找不到第一个补丁;

后来在chinaunix发现一篇精华文章,才知道这个升级方案是有些问题的,不仅麻烦而且可能不具备可操作性(不知道是谁设计的这个升级方案);

http://bbs.chinaunix.net/viewthread.php?tid=1333330

文章标题为“oracle9.2.0.1 升级到 oracle10g R2”,现摘录极具参考意义的部分内容如下:

 

10.1.0.X.0 TO 10.2.0.4.0 
1. Install 10.2.0.1.0 software  
The software can be downloaded from the following link :  
http://www.oracle.com/technology/software/products/database/index.html 
Note 169706.1 : Oracle® Database Installation and Configuration Requirements Quick Reference (8.0.5 to 11.1)  

2. Install the 10.2.0.4.0 patchset on top of 10.2.0.1.0 ORACLE_HOME 
Patchset number is : 6810189 
http://updates.oracle.com/download/6810189.html 

3. Upgrade the database to 10.2.0.4.0  
Note 419550.1 : Different Upgrade Methods For Upgrading Your Database  
Note 316889.1 : Complete checklist for manual upgrades to 10gR2  

REFERENCE:  
List of fixes included in 10.2.0.4 Note 401436.1  
Known issues and alerts affecting 10.2.0.4 Note 555579.1

 

根据这篇文章的提示以及从官网下载的pdf文档《oracle 10.2 upgrate guide》,我向领导及客户提出如下升级方案,并获得通过:

第一步,安装软件10.2.0.1.0;第二步,打补丁10.2.0.5.0;第三步,升级数据库到10.2.0.5.0

 

3 、升级过程  3.1 、准备工作

1)  关闭数据库:

SQL> shutdown immediate;

2) 停止所有服务

C:\>emctl stop dbconsole

C:\>lsnrctl stop

C:\>sqlplus /nolog

SQL>conn / as sysdba

使用控制面板中的服务器关闭oracleserviceSID;

3) 备份数据库系统:

备份内容包括: Oracle Inventory, Oracle 10g home  Oracle 10g Database

3.2 、安装软件

将下载好的10201_database_win32.zip解压后,运行setup.exe,覆盖原来的目录、基本上一路直接下一步安装软件,非常顺利;

3.3 、打补丁

将从metlink上找到的补丁(补丁号为8202632)解压,运行setup.exe,下载地址为:

https://updates.oracle.com/Orion/Services/download/p8202632_10205_WINNT.zip?aru=12769968&patch_file=p8202632_10205_WINNT.zip

也是覆盖原来的目录、基本上一路直接下一步,一直到最后顺利完成;

3.4 、升级数据库

这一步最为关键,也碰到了诸多问题;如果只安装了升级包,没有进行数据库字典信息升级,启动数据库将报ORA-01092 ORACLE 例程终止。强行断开连接。

1)  运行数据库预升级检查:

C:\>sqlplus / as sysdba

SQL> startup upgrade

ORA-00821: Specified value of sga_target 164M is too small, needs to be at least

 168M

期间修改参数,有几次pfile和spfile的转换,具体过程我也记不起来了;

SQL> alter system set sga_target=300m scope=spfile;

SQL> alter system set sga_max_size=300m scope=spfile;

运行以上命令后,关闭数据库;

再次SQL> startup upgrade;不再报错ORA-00821顺利打开

SQL>spool upgrade_info.log

SQL> @F:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN\utlu102i.sql

Oracle Database 10.2 Upgrade Information Utility    08-24-2011 20:39:27

.

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

Database:

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

--> name:       ZXH

--> version:    10.1.0.2.0

--> compatible: 10.1.0.2.0

--> blocksize:  8192

.

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

Tablespaces: [make adjustments in the current environment]

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

--> SYSTEM tablespace is adequate for the upgrade.

.... minimum required size: 571 MB

.... AUTOEXTEND additional space required: 91 MB

--> UNDOTBS1 tablespace is adequate for the upgrade.

.... minimum required size: 387 MB

.... AUTOEXTEND additional space required: 272 MB

--> SYSAUX tablespace is adequate for the upgrade.

.... minimum required size: 410 MB

.... AUTOEXTEND additional space required: 160 MB

--> TEMP tablespace is adequate for the upgrade.

.... minimum required size: 58 MB

.... AUTOEXTEND additional space required: 38 MB

--> EXAMPLE tablespace is adequate for the upgrade.

.... minimum required size: 81 MB

.

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

Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]

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

WARNING: --> "sga_target" needs to be increased to at least 402653184

WARNING: --> "session_max_open_files" needs to be increased to at least 20

.

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

Renamed Parameters: [Update Oracle Database 10.2 init.ora or spfile]

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

-- No renamed parameters found. No changes are required.

.

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

Obsolete/Deprecated Parameters: [Update Oracle Database 10.2 init.ora or spfile]

 

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

--> "log_archive_start"

--> "sql_trace"

.

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

Components: [The following database components will be upgraded or installed]

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

--> Oracle Catalog Views         [upgrade]  LOADED

--> Oracle Packages and Types    [upgrade]  LOADING

--> JServer JAVA Virtual Machine [upgrade]  VALID

...The 'JServer JAVA Virtual Machine' JAccelerator (NCOMP)

...is required to be installed from the 10g Companion CD.

--> Oracle XDK for Java          [upgrade]  VALID

--> Oracle Java Packages         [upgrade]  VALID

--> Oracle Text                  [upgrade]  VALID

--> Oracle XML Database          [upgrade]  VALID

--> Oracle Workspace Manager     [upgrade]  VALID

--> Oracle Data Mining           [upgrade]  VALID

--> OLAP Analytic Workspace      [upgrade]  VALID

--> OLAP Catalog                 [upgrade]  VALID

--> Oracle OLAP API              [upgrade]  VALID

--> Oracle interMedia            [upgrade]  VALID

...The 'Oracle interMedia Image Accelerator' is

...required to be installed from the 10g Companion CD.

--> Spatial                      [upgrade]  VALID

--> Oracle Ultra Search          [upgrade]

... To successfully upgrade Ultra Search, install it from

... the 10g Companion CD.

--> Expression Filter            [upgrade]  VALID

--> EM Repository                [upgrade]  VALID

.

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

Miscellaneous Warnings

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

WARNING: --> Deprecated CONNECT role granted to some user/roles.

.... CONNECT role after upgrade has only CREATE SESSION privilege.

WARNING: --> Database contains stale optimizer statistics.

.... Refer to the 10g Upgrade Guide for instructions to update

.... statistics prior to upgrading the database.

.... Component Schemas with stale statistics:

....   SYS

....   SYSMAN

WARNING: --> Database contains INVALID objects prior to upgrade.

.... USER WKSYS has 57 INVALID objects.

.... USER MDSYS has 23 INVALID objects.

.... USER DMSYS has 26 INVALID objects.

.... USER WK_TEST has 1 INVALID objects.

.... USER OLAPSYS has 186 INVALID objects.

.... USER PUBLIC has 513 INVALID objects.

.... USER CTXSYS has 25 INVALID objects.

.... USER HR has 2 INVALID objects.

.... USER EXFSYS has 41 INVALID objects.

.... USER OE has 2 INVALID objects.

.... USER SYSMAN has 94 INVALID objects.

.... USER ORDSYS has 2 INVALID objects.

.... USER SH has 3 INVALID objects.

.... USER XDB has 52 INVALID objects.

.... USER IX has 2 INVALID objects.

.... USER SYS has 642 INVALID objects.

.... USER WMSYS has 11 INVALID objects.

.

 

PL/SQL 过程已成功完成。

SQL>spool off

 

说明:红色警告信息,一开始没在意,于是后来的操作就碰到问题了

 

2)  进行数据库字典信息升级:

启动监听器:C:\>lsnrctl start

关闭数据库

SQL> startup upgrade;

ORACLE 例程已经启动。

Total System Global Area  314572800 bytes

Fixed Size                  1303068 bytes

Variable Size             281021924 bytes

Database Buffers           25165824 bytes

Redo Buffers                7081984 bytes

数据库装载完毕。

ORA-16038: 日志 3 sequence# 514 无法归档

ORA-19809: 超出了恢复文件数的限制

ORA-00312: 联机日志 3 线程 1: 'F:\ORACLE\PRODUCT\10.1.0\ORADATA\ZXH\REDO03.LOG'

 

原来是没空间用来归档了,于是修改动态参数db_recovery_file_dest_size4G:

SQL> alter system set db_recovery_file_dest_size=4G;

并且用rman删除所有过期的归档日志:

crosscheck archivelog all;delete expired archivelog all;

 

关闭后重新启动,不再报同样的错误,顺利打开;

SQL> startup upgrade;

SQL>spool patch.log

SQL>@F:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN\catupgrd.sql

这一步出现很多类似如下的报错信息 ora-04031

 

create or replace public synonym TRANSPORTABLE_EXPORT_PATHS

*

第 1 行出现错误:

ORA-04031: 无法分配 4064 字节的共享内存 ("shared pool","unknown object","sga

heap(1,0)","kglsim heap")

 

 

grant select on TRANSPORTABLE_EXPORT_PATHS to public

*

 1 行出现错误:

ORA-04031: 无法分配 3936 字节的共享内存 ("shared pool","grant select on

TRANSPORTABL...","sga heap(1,0)","kglsim object batch")

 

 

 from sys.metaxslparam$

          *

 4 行出现错误:

ORA-04031: 无法分配 4064 字节的共享内存 ("shared pool","unknown object","sga

heap(1,0)","kglsim heap")

 

。。。。

以及后来碰到的:

 

ORA-04031: unable to allocate 3936 bytes of shared memory ("shared pool","SEL

 PARAM_ID, AUDIT_TRAIL...","sga heap(1,0)","kglsim object batch")

ORA-00604: error occurred at recursive SQL level 1

ORA-04031: unable to allocate 3936 bytes of shared memory ("shared pool","sel

 value$ from props$ wh...","sga heap(1,0)","kglsim object batch")

ORA-00604: error occurred at recursive SQL level 1

ORA-04031: unable to allocate 3936 bytes of shared memory ("shared pool","sel

 value$ from props$ wh...","sga heap(1,0)","kglsim object batch")

 

查找文档,找到解决方法:

再次增大sgashared_poo,large_pool,顺便修改参数session_max_open_files

SQL> alter system set sga_target=512m scope=spfile;

系统已更改。

SQL> alter system set sga_max_size=512m scope=spfile;

系统已更改。

SQL> alter system set shared_pool_size=256m scope=spfile;

系统已更改。

SQL> alter system set large_pool_size=100m scope=both;

系统已更改。

SQL> alter system set session_max_open_files=20 scope=spfile;

系统已更改。

 

SQL> shutdown immediate;

数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

 

SQL> startup upgrade;

SQL> spool patch1.log

SQL> @F:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN\catupgrd.sql(不再报错 ora04031

SQL>spool off

检查patch.log 文件,如果有问题,重新运行catupgrd.sql

 

3) 关闭数据库后,重新编译失效PL/SQL对象

SQL>shutdown immediate;

SQL>startup

SQL> @F:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN\utlrp.sql

4)检查所有组件是否升级成功

SQL> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;

所有输出为VALID表示升级成功.

4) 设置参数COMPATIBLE(不是必须,一旦设置不可回退)

SQL> ALTER SYSTEM SET COMPATIBLE = '10.2.0.5.0' SCOPE=SPFILE;

5)如果使用Oracle Recovery Manager catalog, 需要对catalog进行升级,如下:

C:\> rman catalog username/password@alias

RMAN> UPGRADE CATALOG;

 

6)对数据库再次做全备份

 

4 、检查

检查基本的数据库工具可用性

对数据库中的用户进行EXPIMP操作,对数据库用RMAN进行备份和恢复操作。确认备份恢复没问题。

 

5 、总结

做好充分准备工作

弄清楚原理

保证操作可行

仔细阅读联机文档

碰到问题多思考,然后查找资料

举一反三、将知识点融会贯通

 

参考文档:

www.freeskydba.com Oracle 10.2.0.4PatchSetfor Windows升级步骤.pdf

http://bbs.chinaunix.net/viewthread.php?tid=1333330

http://leekwen.wordpress.com/category/oracle-database/

http://www.oracle.com/pls/db102/to_pdf?pathname=server.102%2Fb14238.pdf&remark=portal+%28Getting+Started%29 oracle 10.2 upgrate guide.pdf

补丁包程序自带文档 patch_note.htm  README.htm

metlink文档:

ORA-04031 Unable to Allocate xxxx Bytes Shared Memory Even After SHARED_POOL Is Increased During Upgrade to 10gR2 [ID 444074.1]

Unable to Archive Due to flash_recovery_area full [ID 249452.1]

你可能感兴趣的:(oracle)