检查Oracle数据库软件是Enterprise Edition或Standard Edition的10种方法

我们在接手企业的产品数据库时首先总是要了解一下数据库的版本、版本号等信息。

Oracle数据库软件根据用户不同的需求分成多种版本(Database Edition),它们分为:

Oracle Database Standard Edition One  :delivers unprecedented ease of use, power, and performance for workgroup, department-level, and Web applications. From single-server environments for small business to highly distributed branch environments, Oracle Database Standard Edition One includes all the facilities necessary to build business-critical applications.

Oracle Database Standard Edition:delivers the unprecedented ease of . . . → Read More: 检查Oracle数据库软件是Enterprise Edition或Standard Edition的10种方法

Oracle中加速索引创建或重建的方法

Oracle中加速索引创建或重建的方法 View more documents from Maclean Liu

了解Oracle后台进程与数据库文件的读写关系

在pub上看到有人在提问关于Oracle后台进程与数据库文件读写关系的问题,一般来说在学习Oracle的启蒙阶段就会接触到哪个后台进程会写哪些数据库文件的基础知识,例如著名的DBWR是负责写数据文件的,LGWR是专门负责写重做日志文件的,如此种种。

但是却没有哪个文档将这些后台进程与数据库文件间读写的关系理清,这里我抛砖引玉,以表格的形式列出了LGWR、DBWR、CKPT、SMON、PMON等著名后台进程与数据库文件间的读写关系, 希望对学习Oracle的朋友有所帮助。

了解高水位与truncate

什么是High Water Mark 高水位?

“The high water mark starts at the first block of a newly created table. Ads data is inserted, the high water mark rises. And the HWM will remain at that level in spite of delete operations. The HWM matters since Oracle will scan all blocks below the HWM even when . . . → Read More: 了解高水位与truncate

Script:诊断Scheduler信息

以下脚本可以用于针对10g以后的Scheduler信息:

set long 400 set pagesize 1000 set linesize 120 column log_date format a37 column operation format a8 column status format a6 column additional_info format a400 column systimestamp format a37 column next_start_date format a40 column start_date format a40 column manual_open_time format a40 column manual_duration format a40 column duration format a40 column end_date format a40 column . . . → Read More: Script:诊断Scheduler信息

了解DBMS_OUTPUT包

DBMS_OUTPUT程序包是我们在Oracle开发过程中常用的一个包体,使用该包我们可以从存储过程、包或触发器发送信息(messages)。Oracle推荐在debug PL/SQL程序时使用该程序包,不推荐使用该包来做报表输出或其他格式化输出之用。

概述

DBMS_OUTPUT包主要用于调试PL/SQL程序,或者在SQL*PLUS命令中显示信息(displaying message)和报表,譬如我们可以写一个简单的匿名PL/SQL程序块,而该块出于某种目的使用DBMS_OUTPUT包来显示一些信息。

在该DBMS_OUTPUT包中存在2个存储过程,它们是PUT_LINE和PUT过程,使用这2个Procedure可以做到将信息存放到PL/SQL的Buffer中,以便其他的触发器、存储过程、程序包来读取。在独立的PL/SQL程序或匿名块中,我们还可以使用GET_LINES和GET这2个存储过程来将存放在PL/SQL Buffer中的信息输出(display)到屏幕。

如果该DBMS_OUTPUT包被禁用了,那么所有对其子程序(subprogram)的调用都将被忽略。这样用户可以设计应用程序,仅在客户端程序能够处理这些信息的时候启用这些子程序。

安全模型

必须使用SYS用户运行$ORACLE_HOME/rdbms/admin/dbmsotpt.sql,该脚本会为DBMS_OUTPUT创建同义词,并将该包的执行权限赋予PUBLIC角色。

操作提示

若不调用GET_LINE函数,或者不在SQL*PLUS中将信息(information)输出到屏幕的话,那么缓存的信息(buffered message)最终将被忽略。 SQL*PLUS会在SQL语句或匿名PL/SQL块调用结束后调用GET_LINES过程 在SQL*PLUS中输入SET SERVEROUTPUT ON,将启动下面语句的效果: DBMS_OUTPUT.ENABLE (buffer_size => NULL); 输出不再有限制(no limit on the output) 不推荐在应用程序代码中调用ENABLE或DISABLE过程,因为这将导致如SQL*PLUS这种外部工具无法正常控制输出与否。

注意使用DBMS_OUTPUT传送的message在实际执行该DBMS_OUTPUT的子程序或触发器执行完成之前都不会实际被发送。这也就导致了在整个运行过程中不会有信息被写出,所以用DBMS_OUTPUT包做日志输出的话只能等到整个子程序结束才会有日志出现。

程序异常

DBMS_OUTPUT子程序可能引发ORA-20000错误,同时其OUTPUT存储过程可能返回以下错误:

DBMS_OUTPUT 可能遇到的错误

错误号 描述 ORU-10027: Buffer缓存溢出 ORU-10028: 行长溢出

规则和限制

最大的单行长度是32767 bytes字节 默认的buffer大小时20000 bytes字节,最小的buffer为2000 bytes字节,最大没有限制

使用示例

示例1:在触发器生成输出

我们可以使用一个触发器来打印正在调试进程的一些信息,譬如你可以在触发器中调用以下代码:

DBMS_OUTPUT.PUT_LINE(‘I got here:’||:new.col||’ is the new . . . → Read More: 了解DBMS_OUTPUT包

Know Difference between Oracle Reserved Words and Keywords

与C和JAVA体系类似,Oracle中存在一些保留词(Reserved Words)或关键词(Keywords)以及少量的命名空间(Namespace)。

保留词(Reserved Words)是优先级最高的词汇,在Oracle中这些词都有着特殊的意义。所以这些词不允许被重定义 (redefine),换而言之就不是不允许用作对象的名字。以下为Oracle 10g中保留词的列表:

Oracle Reserved Words ACCESS ELSE MODIFY START ADD EXCLUSIVE NOAUDIT SELECT ALL EXISTS NOCOMPRESS SESSION ALTER FILE NOT SET AND FLOAT NOTFOUND SHARE ANY FOR NOWAIT SIZE ARRAYLEN FROM NULL SMALLINT AS GRANT NUMBER SQLBUF ASC GROUP OF SUCCESSFUL AUDIT HAVING OFFLINE SYNONYM BETWEEN IDENTIFIED ON SYSDATE BY IMMEDIATE . . . → Read More: Know Difference between Oracle Reserved Words and Keywords

Troubleshooting: AWR Snapshot Collection issues

Applies to:

Oracle Server – Enterprise Edition – Version: 10.2.0.4 to 11.2.0.2 – Release: 10.2 to 11.2 Information in this document applies to any platform. Oracle RDBMS Automatic Workload Repository

Purpose

The purpose of this document is to describe the diagnostic data that can be collected and the corrective steps that can be taken when . . . → Read More: Troubleshooting: AWR Snapshot Collection issues