70 likes | 89 Views
介绍 dbms_registry PL/SQL 程序包. 刘相兵 (Maclean Liu) liu.maclean@gmail.com. www.oracledatabase12g.com. dbms_registry 包的过去. 最早在 9iR2 中引入了该 dbms_registry$ PL/SQL 程序包,引入该程序包的目的是为了更好地管理 Oracle 数据库中日益增加的特性组件 (component ,如 Oracle Workspace Manager 或 Oracle Text); 通过使用 dbms_registry$ 统一管理这些组件的版本、状态以及升级流程。
E N D
介绍dbms_registry PL/SQL程序包 刘相兵(Maclean Liu)liu.maclean@gmail.com www.oracledatabase12g.com
dbms_registry 包的过去 • 最早在9iR2中引入了该dbms_registry$ PL/SQL程序包,引入该程序包的目的是为了更好地管理Oracle数据库中日益增加的特性组件(component,如Oracle Workspace Manager或Oracle Text);通过使用dbms_registry$统一管理这些组件的版本、状态以及升级流程。 • 该包由以下部分构成: • $ORACLE_HOME/rdbms/admin/catcr.sql CATalog Component Registry -构建组件信息注册用表 • $ORACLE_HOME/rdbms/admin/dbmscr.sql DBMS_Registry package specs and views -构建package body • 该包可以用来辅助升级进程,在数据库升级过程中持续跟踪各组建的最新状态 www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com
如何使用dbms_registry 包? • 为什么需要用到该包? 当数据库中执行一些组件安装SQL脚本(例如运行了catqm.sql脚本以安装XML DB)后,可以通过注册该组件记录以帮助跟踪该部分组件的状态和版本,同时为今后的组件升级提供统一、灵活的接口。 • 如何使用该程序包? • 程序包中的存储过程和函数介绍: http://psoug.org/reference/dbms_registry.html • 使用示例: begin dbms_registry.update_schema_list('CATPROC', dbms_registry.schema_list_t('SYSTEM', 'OUTLN', 'DBSNMP')); dbms_registry.loaded('CATPROC'); dbms_registry_sys.validate_catproc; dbms_registry_sys.validate_catalog; End; --检查catproc组件的有效性 www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com
如何使用dbms_registry 包? • 该程序包提供了灵活的接口 • 如果需要,那么组件升级过程中可以使用相关存储过程来更新registry$组件注册信息基表中该组件的状态信息 • dbms_registry.set_progress_value('MYCOMP'...); • 同时允许设置重启标记 • dbms_registry.startup_required('MYCOMP'); 以上语句将更新相关组件在组件注册基表中的信息,表明升级该组件需要重启。 www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com
dbms_registry$ 提供的详细状态报告 My Oracle Support文档How To Diagnose Components With NON VALID Status In DBA_REGISTRY After an Upgrade [ID 753041.1]介绍了registry$基表中状态代码的基本含义 可以通过执行如下SQL语句了解组件状态信息: select substr(comp_name,1,30) comp_name, substr(comp_id,1,10) comp_id, substr(version,1,12) version, status from dba_registry Note:472937.1 Information On Installed Database Components Note:753041.1 How to diagnose Components with NON VALID status www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com
dbms_registry$ 提供的报告 • 调用$ORACLE_HOME/rdbms/admin/utlusts.sql( UTiLity Upgrade StatuS Presents Post-upgrade Status in either TEXT or XML)脚本 • 可以得到数据库升级后的第一手组件升级状态报告: SQL> @?/rdbms/admin/utlusts text Oracle Database 11.1 Post-Upgrade Status Tool 03-16-2011 21:38:40 Component Status Version HH:MM:SS Oracle Server . VALID 11.1.0.7.0 00:13:17 JServer JAVA Virtual Machine . VALID 11.1.0.7.0 00:00:00 Oracle Workspace Manager . VALID 11.1.0.7.0 00:00:00 OLAP Analytic Workspace . VALID 11.1.0.7.0 00:00:00 Gathering Statistics . 00:03:16 Total Upgrade Time: 00:17:41 PL/SQL procedure successfully completed. www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com
更多关于dbms_registry有用的信息 [How To Diagnose Components With NON VALID Status In DBA_REGISTRY After an Upgrade]: https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=753041.1 UTLU102S.SQL, UTLU111S.SQL and UTLU112S.SQL May Show Different Results Than Select From DBA_REGISTRY [ID 456845.1]: https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=456845.1 Information On Installed Database Components and Schemas [ID 472937.1]: https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=472937.1 Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql) [ID 556610.1]: https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=556610.1 CATPROC - Packages and Types Invalid in Dba_registry [ID 457861.1]: https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=HOWTO&id=457861.1 www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com