logo 广告
Loading...
 导航 所在位置:论坛首页 -> ┈┋电脑网络┋┈ -> 数据库技术 -> 按照顺序或依赖关系重新编译失效的对象
回复
标题:按照顺序或依赖关系重新编译失效的对象收藏 编辑 删除 楼主 | 上一篇 下一篇
有时也很傻
头像
等级:职业侠客
权限:普通用户
积分:75
金钱:6382
声望:124
经验:124
发帖数:1574
注册:2007年10月26日
资料 短消息2008-6-10 10:47:41
许多情况下,由于数据库的变更或迁移,会导致数据库中的对象失效。由于对象之间可能存在复杂的倚赖关系,所以手工编译通常无法顺利通过。 本文将详细将详细介绍Oracle提供的一个用于按照顺序/依赖关系重新编译失效对象的脚本。

脚本:

$ORACLE_HOME/rdbms/admin/utlrp.sql

其中会调用:

$ORACLE_HOME/rdbms/admin/utlrcmp.sql

在utlrp.sql脚本中,Oracle的注释:

Rem utlrp.sql - UTiLity script Recompile invalid Pl/sql modules

Rem

Rem DESCRIPTION

Rem This is a fairly general script that can be used at any time to

Rem recompile all existing invalid PL/SQL modules in a database.

Rem

Rem If run as one of the last steps during migration/upgrade/downgrade

Rem (see the README notes for your current release and the Oracle

Rem Migration book), this script will validate all PL/SQL modules

Rem (procedures, functions, packages, triggers, types, views, libraries)

Rem during the migration step itself.

Rem

Rem Although invalid PL/SQL modules get automatically recompiled on use,

Rem it is useful to run this script ahead of time (e.g. as one of the last

Rem steps in your migration), since this will either eliminate or

Rem minimize subsequent latencies caused due to on-demand automatic

Rem recompilation at runtime.

Rem

Rem Oracle highly recommends running this script towards the end of

Rem of any migration/upgrade/downgrade.

注:上面这个示例是一个通用脚本,可以在任意时候运行以重新编译数据库失效对象。通常我们会在Oracle的升级指导中看到这个脚本,Oracle强烈推荐在migration/upgrade/downgrade之后,通过运行此脚本编译失效对象。 但是注意,Oracle提醒,此脚本需要用SQLPLUS以SYSDBA身份运行,并且当时数据库中最好不要有活动事物或DDL操作,否则极容易导致死锁的出现(这是很容易理解的)。 只要仔细阅读一下utlrcmp.sql脚本,大家就会知道Oracle的具体操作方式了。

签名

2008-6-10 10:47:41 顶部
第1页 共页 共0个回复     <<    >>    
 快速回复
  • 支持UBB,HTML标签

  • 高级回复

  • 操作选项:评分 加精 解精 奖惩 设专题 设公告 解公告 固顶 总固顶 解固顶 结帖 解结帖 锁帖 解锁 移帖 删帖
      首页 | 购买指南 | 虚拟主机 | 特色介绍 | 下载中心 | 支付方式
    Copyright 2004-2008 BBSGood.com Powered By: BBSGood.Speed Version 5.0
      咨询电话:0575-85513832、0575-85513825(传真)、7*24小时咨询服务:13606552007 不良信息举报中心 浙ICP备05029817号
      业务QQ:38958768、客服QQ1:415896239、客服QQ2:343896043、MSN:jccsxx@hotmail.com