Oracle Database Instance - Oracle 实例篇 6

来源:互联网 发布:淘宝上没有京东 编辑:程序博客网 时间:2024/05/29 15:18

前言:接上一篇Oracle Database Instance - Oracle实例篇5

Oracle Database Instance - Oracle 实例篇5  http://blog.csdn.net/nature_ann/article/details/10189567 

1.Diagnostic Files

<<----Oracle 11g FDI:解决代码Bug,源数据损坏,客户数据损坏等。主动检测问题;问题被检测到后,限制损坏和中断;减少问题的诊断消耗时间;简化客户与Oracle支持的交互。---->>

Oracle Database includes afault diagnosability infrastructure forpreventing,detecting, diagnosing, andresolving database problems. Problems include critical errors such ascode bugs,metadata corruption, andcustomer data corruption.

The goals of the advancedfault diagnosability infrastructureare the following:

>>Detecting problems proactively

>>Limiting damage and interruptions after a problem is detected

>>Reducing problem diagnostic and resolution time

>>Simplifying customer interaction with Oracle Support

1.1 Automatic Diagnostic Repository

<<----ADR 自动诊断库,是基于诊断文件的(诸如跟踪文件,警告文件,健康检测报告),主要特性包括:统计的诊断目录,一致的诊断数据格式,统一的工具箱。---->>

Automatic Diagnostic Repository(ADR) is afile-basedrepository that stores database diagnostic data such as trace files, thealert log, andHealth Monitor reports. Key characteristics of ADR include:

>>Unified directory structure

>>Consistent diagnostic data formats

>>Unified tool set

The preceding characteristics enablecustomers andOracle Support to correlate andanalyze diagnostic data across multiple Oracle instances,components, andproducts.

<<----ADR位于数据库的外面,当物理数据库不可用时,数据库是能访问和管理ADR,在数据库被创建之前,一个实例可以创建ADR---->>

ADR is located outside the database, which enables Oracle Database to access and manageADR when the physical database is unavailable. Aninstance can createADR before a database has been created.

1.1.1 Problems and Incidents

<<----ADR主动的跟踪问题,当关键错误发生时。(ora-600,其他的服务错误),每一个问题都有一个问题键值,它是一个文本的字符串。---->>

ADR proactively tracksproblems, which are critical errors in the database. Critical errors manifest as internal errors, such asORA-600, or other severe errors. Each problem has a problem key, which is atext string that describes the problem.

<<----当一个问题出现多次时,ADR会为每一个时间创建一个基于时间戳的事件。每一个事件都有一个唯一的标识事件ID当一个事件发生时,ADR会发送一个事件警告给企业管理器,通常诊断解析一个关键错误是伴随着一个事件警告。---->>

When a problem occurs multiple times, ADR creates a time-stampedincident for each occurrence. Anincident is uniquely identified by a numericincident ID. When an incident occurs, ADR sends anincident alert to Enterprise Manager. Diagnosis and resolution of a critical error usually starts with an incident alert.

<<----因为短时间之内会产生许多问题,当某一阀值达到后,ADR会应用flood control于事件的产生。一个flood-control事件产生一个警告日志条目,但是不产生事件dump。当ADR发通知给你有一个关键错误是发生的,但是诊断数据不会给系统带来压力。 ---->>

Because a problem could generate manyincidents in ashort time, ADR appliesflood control to incident generation after certainthresholds are reached. Aflood-controlled incident generates analert log entry, but does not generate incident dumps. In this way, ADR informs you that acritical error is ongoing without overloading the system with diagnostic data.

1.1.2 ADR Structure

<<---- ADR base –ADR root directory。一个ADR base能包含多个ADR home。每一个ADR home都有一个root directory,包含所有的诊断数据,诸如tracesdumpsalert log 等等。一个oracle产品或组件包含一个实例。比如oracle RAC,共享存储 ASM,每一个数据库实例,每一个ASM实例都有自己的ADR home---->>

TheADR base is the ADRroot directory. The ADR base can contain multipleADR homes, where eachADR home is theroot directory for all diagnostic data—traces,dumps, the alert log, and so on—for an instance of an Oracle product or component. For example, in anOracle RAC environmentwith shared storage and ASM, each database instance and each ASM instance has itsown ADR home.

如下图1 ADR目录层次:illustrates the ADRdirectory hierarchy for a database instance. Other ADR homes for other Oracle products or components, such as ASM or Oracle Net Services, can exist within this hierarchy, under the same ADR base

              

                 图1 ADR Directory Structure for an Oracle Database Instance

 

实验:

ADR的路径被称为ADR BASE,这个位置由一个初始化参数DIAGNOSTIC_DEST决定。

SQL> show parameter DIAGNOSTIC_DEST                        

 

NAME                                TYPE        VALUE

------------------------------------ ----------- ------------------------------

diagnostic_dest                     string      /u01

下面是我测试机的ADR-base目录结构:

[root@lin19 u01]# tree -d diag/

diag/

|-- rdbms

|   |-- ann

|   |   `-- ann

|   |       |-- alert

|   |       |-- cdump

|   |       |-- hm

|   |       |-- incident

|   |       |-- incpkg

|   |       |-- ir

|   |       |-- lck

|   |       |-- metadata

|   |       |-- stage

|   |       |-- sweep

|   |       `-- trace

|   `-- unknown

|       `-- ann

|           |-- alert

|           |-- cdump

|           |-- hm

|           |-- incident

|           |-- incpkg

|           |-- ir

|           |-- lck

|           |-- metadata

|           |-- stage

|           |-- sweep

|           `-- trace

`-- tnslsnr

    `-- lin19

        `-- listener

            |-- alert

            |-- cdump

            |-- incident

            |-- incpkg

            |-- lck

            |-- metadata

            |-- stage

            |-- sweep

            `-- trace

Oracle可以通过视图v$diag_info来查询自动诊断库的信息:

SQL> SELECT NAME, VALUE FROM V$DIAG_INFO

NAME                          VALUE

------------------------------ --------------------------------------------------

Diag Enabled                  TRUE

ADR Base                    /u01

ADR Home                   /u01/diag/rdbms/ann/ann

Diag Trace                    /u01/diag/rdbms/ann /ann/trace

Diag Alert                       /u01/diag/rdbms/ann/ann/alert

Diag Incident                 /u01/diag/rdbms/ann/ann/incident

Diag Cdump                  /u01/diag/rdbms/ann/ann/cdump

Health Monitor                /u01/diag/rdbms/ann/ann/hm

Default Trace File            /u01/diag/rdbms/ann/ann/trace/ann_ora_4233.trc

Active Problem Count          0

Active Incident Count            0

 

1.2 Alert log

<<----每一个数据库都有一个警告日志,它是一个XML文件,包含着按时间排序的数据库的信息和错误日志。主要包含以下的内容:1.所有的内核错误,坏块,死锁。2.管理操作,诸如DDL语句,SQl*Plus命令(startupshutdownarchivelogrecover)。3.调度进程、共享服务功能相关的一些信息和错误。4.自动刷新物化视图期间的错误。警告日志作为一种替代方法,在企业管理器GUI中显示信息。如果管理操作是成功的,Oracle数据库会向警告日志写入一个带有时间戳的,completed标识的信息。---->>

Each database has an alert log, which is an XML filecontaining a chronological log ofdatabase messages anderrors. The alert log contents include the following:

>>All internal errors(ORA-600),block corruption errors (ORA-1578), anddeadlockerrors(ORA-60)

>>Administrative operations such asDDL statements and the SQL*Plus commandsSTARTUP,SHUTDOWN,ARCHIVE LOG, andRECOVER

>>Several messages and errors relating to thefunctions of shared server anddispatcher processes

>>Errors during the automatic refresh of amaterialized view

Oracle Database uses thealert log as an alternative to displaying information in the Enterprise Manager GUI. If an administrative operation is successful, then Oracle Database writes a message to the alert log as "completed" along with a time stamp.

--测试机警告日志的内容

[oracle@lin19~]$tail -f /u01/diag/rdbms/ann/ann/trace/alert_ann.log 

CJQ0 started with pid=25, OS id=4252

Mon Aug 26 04:57:56 2013

db_recovery_file_dest_size of 3852 MB is 0.00% used. This is a

user-specified limit on the amount of space that will be used by this

database for recovery-related files, and does not reflect the amount of

space available in the underlying filesystem or ASM diskgroup.

Mon Aug 26 05:02:49 2013

Starting background process SMCO

Mon Aug 26 05:02:49 2013

SMCO started with pid=19, OS id=4369

1.3 Trace Files

<<----跟踪文件是一个管理文件,它包括诊断数据被用来研究解决问题。并且,也可以为优化应用或一个实例提供指导。---->>

A trace file is anadministrative file that containdiagnostic data used to investigate problems. Also, trace files can provide guidance for tuning applications or an instance.

1.3.1  Types of Trace Files

<<----每一个服务和后台进程能定期的写入到相关联的跟踪文件里。包含进程环境,状态,活动,错误等。---->>

Each server andbackground process can periodically write to an associatedtrace file. The files information on theprocess environment,status,activities, anderrors.

<<----SQL跟踪工具也能创建跟踪文件,它能提供有关个别的sql语句的性能信息。还能跟踪客户端标识符,服务,模块,事件,会话,实例或数据库,但是你需要执行适当的程序包DBMS_MONITORor使用企业管理器。--->>

The SQL trace facility also creates trace files, which provide performance information onindividual SQL statements. To enable tracing for aclient identifier,service,module, action,session,instance, or database, you must execute theappropriate procedures in the DBMS_MONITOR package or useOracle Enterprise Manager.

<<----DUMP是跟踪文件的特殊类型,然而trace更倾向于持续输出诊断数据,dump则是典型的一次性输出诊断数据来相应一次event,比如incident。当一个incident发生时,数据库会写一个或多个dumpincident目录创建一个incidentIncident dumps也包含incident编号在文件名称里面。--->>

A dump is a special type of trace file. Whereas a trace tends to be continuous output of diagnostic data, a dump is typically aone-time output ofdiagnostic data in response to an event (such as anincident). When an incident occurs, the database writes one or moredumps to the incident directorycreated for theincident. Incident dumps also contain the incident number in the file name.

1.3.2 Locations of Trace files

<<---- ADR存储跟踪文件在跟踪子目录里面。见上图1所示。跟踪文件的名字依赖于平台并以.trc为后缀。典型的,数据库后台进程跟踪文件名,包含Oracle SID,后台进程名字,操作系统进程号,举一个例子,reco进程的跟踪文件:ann_reco_10355.trc.  服务进程跟踪文件包含Oracle SID,字符串ora,操作系统进程号,比如:ann_ora_10356.trc有时一个跟踪文件还有一个相应的以.trm为结尾的跟踪映射文件,这些文件包含有关跟踪文件和被使用的搜索导航的一下而已结构信息。--->>

ADR stores trace files in the trace subdirectory,见上图1. Trace file names areplatform-dependent and use the extension.trc .

Typically, database background processtrace file names contain theOracle SID,the background process name, andthe operating system process number. An example of a trace file for the RECO process isann_reco_10355.trc.

Server process trace file names contain theOracle SID, the string ora, and theoperating system process number. An example of a server process trace file name isann_ora_10356.trc.

Sometimes trace files have correspondingtrace map ( .trm) files. These files contain structural information abouttrace files and are used forsearching and navigation.

 

At this point,the oracle database instance is end.