---
title: "Oracle升级"
author: "dayone"
date: "2009-06-23T10:54:16Z"
tags: []
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2011-04-28T17:11:10Z"
id: 413335
url: "https://dayone.iteye.com/blog/413335"
---

**Oracle升级10.0.2-3** 2009-5-22 15:53  
我的升级步骤是：  
1、解压p5337014\_10203\_WINNT.zip补丁包  
2、点击setup文件安装  
3、选择与Oracle10.2.0.1版本一致的目录，如：D:\\oracle\\product\\10.2.0\\db\_1  
4、默认安装即可

但是在打完补丁后，数据库无法连接，用Oracle的NewManage程序测试连接报错如下：  
ORA-12514：TNS：监听程序当前无法识别连接描述符中请求的服务。  
然后使用以下方案解决问题

以下方案经过测试，成功  
&lt;http://blog.csdn.net/ritchiezhuo/archive/2007/11/23/1899099.aspx&gt;（原文地址）  
\-------------------------------------------------------------------------------------------------  
这两天实在心有不甘，重新查找资料和试验，终于找到一个正确和简捷的办法，大概过程如下：  
注释：ZZR为数据库的实例名，如我的为MHDB  
1．首先删除旧的ORACLE服务：  
在命令行下执行如下命令：  
C:\\&gt;ORADIM -DELETE -SID ZZR

2．再重新建立ORACLE服务：  
C:\\&gt;ORADIM -NEW -SID ZZR -MAXUSERS 10 -STARTMODE AUTO -PFILE D:\\oracle\\product\\10.2.0\\db\_1\\database\\INITzzr.ORA  
我的服务地址：E:\\oracle\\product\\10.2.0\\db\_2\\database\\initmhdb.ora

3．用SYS帐户在SQLPLUS下连接，并在升级模式下启动ORACLE  
c:&gt;sqlplus  
username:system  
password:123456

SQL&gt; CONN  /  AS SYSDBA  
SQL&gt; STARTUP UPGRADE

4．运行升级脚本catupgrd.sql：  
SQL&gt; SPOOL upgrade.log  
SQL&gt; @ D:\\oracle\\product\\10.2.0\\db\_1\\RDBMS\\ADMIN\\catupgrd.sql  
SQL&gt; SPOOL OFF  
我的sql脚本路径：E:\\oracle\\product\\10.2.0\\db\_2\\RDBMS\\ADMIN\\catupgrd.sql  
此过程比较漫长，至少需要20分钟（我实际花费21分钟）

5．重新启动ORACLE：  
SQL&gt; shutdown immediate  
SQL&gt; startup pfile=D:\\oracle10g\\database\\INITzzr.ORA      
我的路径：pfile=E:\\oracle\\product\\10.2.0\\db\_2\\database\\initmhdb.ora

6．编译无效对象：  
SQL&gt; @ D:\\oracle\\product\\10.2.0\\db\_1\\RDBMS \\ADMIN\\utlrp.sql  
我的路径：E:\\oracle\\product\\10.2.0\\db\_2\\RDBMS\\ADMIN\\utlrp.sql

7．最后再查看是否还有无效对象：  
SQL&gt; SELECT count(\*) FROM dba\_objects WHERE status='INVALID';

如果结果显示为“0”，表示升级成功。如果大于0，则重新运行catupgrd.sql脚本，直至没有无效对象。  
这时再用ZZR连接ORACLE，正常连接。启动SDE，亦正常连接。至此，升级得以完美解决。

原作者的实际情况：  
前两天在客户那边，由于数据库升级，在打完10.2.0.2补丁后。Oralce服务和监听器均可以运行。但检查windows服务，发现ArcSDE服务未正常启动，手工启动亦无法正常运行。

进入SQLPLUS，用原有用户ZZR重新登录，运行如下命令：

SQL&gt;conn zzr/zzr

出现如下错误提示：  
ORA-12514：TNS：监听程序当前无法识别连接描述符中请求的服务。

用net manager测试服务，服务名和服务器名均正确填写，但亦出现此错误提示。尝试重新用net manager和net configuration assistant建立和配置服务，依然无法成功。

在网上查找到此错误原因：

Cause: The listener received a request to establish a connection to a database or other service. The connect descriptor received by the listener specified a service name for a service (usually a database service) that either has not yet dynamically registered with the listener or has not been statically configured for the listener. This may be a temporary condition such as after the listener has started, but before the database instance has registered with the listener.

Action: - Wait a moment and try to connect a second time.

\- Check which services are currently known by the listener by executing: lsnrctl services &lt;listener name&gt;

\- Check that the SERVICE\_NAME parameter in the connect descriptor of the net service name used specifies a service known by the listener.

\- If an easy connect naming connect identifier was used, check that the service name specified is a service known by the listener.

\- Check for an event in the listener.log file.

       由此分析，可能是升级后服务未重新注册到监听器，导致无法正常连接。于是在确认listener.ora和tnsnames.ora服务名和主机名配置正确后，重新启动监听器。但问题依然存在。

后来实在没招，只好在database configuration assistant把数据库删除再重新建立，才把问题解决。但用此解决方案，在数据库删除前需备份数据库，数据库重新建立后得重建表空间、用户，再重新导入数据（不知在备份和恢复数据这方面有没更好的解决办法？）。而当时客户那边系统数据库上还有个地价系统，当中至少建立了五个用户和对应的表空间，可以说整个备份和恢复过程即繁琐又容易出错，是个不值得提倡的解决办法。由于当时技术和经验的不足，在删除数据库之前未导出各个用户脚本，未做好充分的备份工作，导致整个地价系统的数据无法恢复。可以说这是一次失败的升级工作。