1、oracle获取日志1 日志获取方法1.1 Oracle数据库日志针对Oracle数据库出现的各种问题,为了全方位的定位问题,当遇到oracle数据库异常时,需要获取如下日志信息。1.1.1 bdump/udump日志获取$ORACLE_BASE/admin/$SID/bdump, $ORACLE_BASE/admin/$SID/udump 当天的日志。如:今天是6月16日,/u01/app/oracle/admin/test/bdump目录下:-rw-r- 1 oracle oinstall 205370 Jun 13 10:59 alert_test1.log-rw-r- 1 oracle
2、 oinstall 8153 Jun 13 10:59 test1_lgwr_16208.trc-rw-r- 1 oracle oinstall 2791 Jun 13 23:20 test1_m000_25387.trc-rw-r- 1 oracle oinstall 2791 Jun 14 23:21 test1_m000_20972.trc-rw-r- 1 oracle oinstall 2790 Jun 15 23:22 test1_m000_14356.trc-rw-r- 1 oracle oinstall 166589 Jun 16 10:23 test1_lmd0_16196.t
3、rc/u01/app/oracle/admin/test/udump 目录下当天的日志文件。1.1.2 Crs日志crs log目录下crs的相关日志信息,如:/u01/app/oracle/product/10.2.0/crs/log/hp101 drwxr-x- 2 oracle oinstall 96 May 15 14:21 admindrwxr-x- 2 oracle oinstall 96 May 15 14:22 evmddrwxr-x- 2 root oinstall 96 May 15 14:22 crsddrwxr-x- 5 oracle oinstall 8192 May
4、 15 14:38 cssddrwxrwxr-t 5 oracle oinstall 8192 May 21 17:17 racg-rw-rw-r- 1 root oinstall 7750 Jun 3 16:46 alerthp101.logdrwxr-x- 2 oracle oinstall 114688 Jun 16 14:06 client这些目录下当天的日志文件。1.1.3 监听器日志监听器$ORACLE_HOME/network/log当天的日志信息:/u01/app/oracle/product/10.2.0/db/network/log$ lltotal 249696-rw-r
5、-r- 1 oracle oinstall 126028387 Jun 16 14:14 listener.log-rw-r-r- 1 oracle oinstall 1743147 May 22 10:15 listener_hp101.log-rw-r-r- 1 oracle oinstall 3902 Jun 5 21:26 sqlnet.log1.1.4 Awr报告故障发生阶段一个小时的awr报告,获取方法如下。生成awr report执行:SQL ?/rdbms/admin/awrrpt.sqlCurrent InstanceDB Id DB Name Inst Num Instan
6、ce - - - - 1939003356 TEST 1 test1 Specify the Report TypeWould you like an HTML report, or a plain text report?Enter html for an HTML report, or text for plain textDefaults to htmlEnter value for report_type: htmlType Specified: html (此处建议输入html)Specify the number of days of snapshots to choose fro
7、mEntering the number of days (n) will result in the most recent(n) days of snapshots being listed. Pressing withoutspecifying a number lists all completed snapshots.Enter value for num_days: 1 (输入多少天以来,例子输入是1天)Listing the last 30 days of Completed Snapshots SnapInstance DB Name Snap Id Snap Started
8、Level- - - - -test1 TEST 1 09 12月 2007 17:26 1 2 09 12月 2007 17:35 1 3 09 12月 2007 17:35 1 4 09 12月 2007 17:35 1 5 09 12月 2007 17:35 1Specify the Begin and End Snapshot IdsEnter value for begin_snap: 4 (输入快照ID)Begin Snapshot Id specified: 1Enter value for end_snap: 5 (输入快照ID)End Snapshot Id specifie
9、d: 5Specify the Report NameThe default report file name is awrrpt_1_4_5.html. To use this name,press to continue, otherwise enter an alternative.Enter value for report_name: awrrpt_test1_20071209.html (输入报告名)1.1.5 Ash报告故障发生阶段的ash报告(时间段越短越好,一般在5-30分钟之间),具体获取发放如下。Ash报告生成:SQL ?/rdbms/admin/ashrpt.sqlCu
10、rrent InstanceDB Id DB Name Inst Num Instance- - - - 1952945692 TEST 1 test1Specify the Report TypeEnter html for an HTML report, or text for plain textDefaults to htmlEnter value for report_type: htmlType Specified: html (此处建议输入html)Instances in this Workload Repository schema DB Id Inst Num DB Nam
11、e Instance Host- - - - - 1952945692 2 TEST test2 hp102* 1952945692 1 TEST test1 hp101Defaults to current databaseUsing database id: 1952945692Defaults to current instanceUsing instance number: 1ASH Samples in this Workload Repository schemaOldest ASH sample available: 08-Jun-08 23:00:33 11000 mins i
12、n the pastLatest ASH sample available: 16-Jun-08 14:20:02 0 mins in the pastSpecify the timeframe to generate the ASH reportEnter begin time for report:- Valid input formats:- To specify absolute begin time:- MM/DD/YY HH24:MI:SS- Examples: 02/23/03 14:30:15- 02/23 14:30:15- 14:30:15- 14:30- To speci
13、fy relative begin time: (start with - sign)- -HH24:MI- Examples: -1:15 (SYSDATE - 1 Hr 15 Mins)- -25 (SYSDATE - 25 Mins)Defaults to -15 minsEnter value for begin_time: 06/16/08 13:10:00 (输入报告开始时间,输入的时候注意时间格式)Report begin time specified: 06/16/08 13:10:00Enter duration in minutes starting from begin
14、time:Defaults to SYSDATE - begin_timePress Enter to analyze till current timeEnter value for duration:10 (输入时间长度,这里输入的是10分钟)Report duration specified: 10 Using 16-Jun-08 13:10:00 as report begin timeUsing 16-Jun-08 13:20:00 as report end timeSpecify Slot Width (using ashrpti.sql) for Activity Over T
15、ime section- Explanation:- In the Activity Over Time section of the ASH report,- the analysis period is divided into smaller slots- and top wait events are reported in each of those slots.- Default:- The analysis period will be automatically split upto 10 slots- complying to a minimum slot width of-
16、 1 minute, if the source is V$ACTIVE_SESSION_HISTORY or- 5 minutes, if the source is DBA_HIST_ACTIVE_SESS_HISTORY.Specify Slot Width in seconds to use in the Activity Over Time section:Defaults to a value as explained above:Slot Width specified:Specify Report Targets (using ashrpti.sql) to generate
17、the ASH report- Explanation:- ASH Report can accept Report Targets,- like a particular SQL statement, or a particular SESSION,- to generate the report on. If one or more report targets are- specified, then the data used to generate the report will only be- the ASH samples that pertain to ALL the spe
18、cified report targets.- Default:- If none of the report targets are specified,- then the target defaults to all activity in the database instance.Specify SESSION_ID (eg: from V$SESSION.SID) report target:Defaults to NULL:SESSION report target specified:Specify SQL_ID (eg: from V$SQL.SQL_ID) report t
19、arget:Defaults to NULL: (% and _ wildcards allowed)SQL report target specified:Specify WATI_CLASS name (eg: from V$EVENT_NAME.WAIT_CLASS) report target:Enter CPU to investigate CPU usageDefaults to NULL: (% and _ wildcards allowed)WAIT_CLASS report target specified:Specify SERVICE_HASH (eg: from V$A
20、CTIVE_SERVICES.NAME_HASH) report target:Defaults to NULL:SERVICE report target specified:Specify MODULE name (eg: from V$SESSION.MODULE) report target:Defaults to NULL: (% and _ wildcards allowed)MODULE report target specified:Specify ACTION name (eg: from V$SESSION.ACTION) report target:Defaults to
21、 NULL: (% and _ wildcards allowed)ACTION report target specified:Specify CLIENT_ID (eg: from V$SESSION.CLIENT_IDENTIFIER) report target:Defaults to NULL: (% and _ wildcards allowed)CLIENT_ID report target specified:Specify PLSQL_ENTRY name (eg: SYS.DBMS_LOB.*) report target:Defaults to NULL: (% and
22、_ wildcards allowed)PLSQL_ENTRY report target specified:Specify the Report NameThe default report file name is ashrpt_1_0616_1320.html. To use this name,press to continue, otherwise enter an alternative.Enter value for report_name: /home/oracle/ash0616_1.html (输入报告名称)生成的报告会保存在/home/oracle/ 目录下。1.2 金
23、融基础件1.0日志分析处理运维人员要养成定期检查AR、AS中间件、管理客户端功能日志信息的习惯,从中有时可能会尽早发现一些异常和错误的线索,为预防问题和解决问题提供帮助。1.2.1 AR/AS日志的获取方法记录AR日志的方法:AR配置文件中需进行配置:a. 配置插件fsc_data_capture_ht,语句为:b. 中enable需要设置为yes该文件的查看方法:可以使用ct工具,将DC_csas_20110329.dc放到workspace目录下,然后进入workspace目录,运行:/home/whb/linux.i386/Bin/ct 然后运行gen DC_csas_20110329就
24、可以了,会把该文件转换为DC_csas_20110329.xml。记录AS日志的方法:a. hs_log.xml必须在workspace目录。b. 在AS的配置文件中需要加载 syslog插件,语句为:c. 在workspace目录必须有log的文件夹。日志文件放在工作目录的log子目录下,此子目录需要手工创建。日志文件按日期存放,文件名格式:组名_yyyymmdd.logFBASE日志记录了:当前日志所属日志信息的编号、发生时间、所属模块、发生位置、详细信息;通过日志文件,可以了解到AS/AR的启动/退出时间,启动时是否存在错误,比如数据库连接失败,内存数据库初始化异常。在运行过程中,还会记
25、录数据库操作的异常等。1.2.2 通信异常日志 rudp.log位于工作目录之下,由通信库记录其检测到的通信非正常断开的情况。1.2.3 AR捕获异常数据包日志日常运维中,需要增加对于AR的工作目录下ardiscard.log文件的关注,如果在工作目录下存在该文件,且文件大小非0,说明至少有一个应用发送了非法报文,据此定位是哪个应用发送了非法报文,是什么原因发送出来的,以避免问题扩大。1.2.4 管理客户端监控日志当核心AR/AS监控,发现请求压积告警时,会自动保存管理客户端Admin目录下的core-yyyymmdd.txt文件中。在核心监控日志文件中,请求积压告警消息的中主要信息有:监测到
26、压积的时间戳、AS组名、AS编号、请求积压个数、各线程当前处理请求信息(每一个线程一项,每项内容为:最后处理的请求功能号,处理状态,已处理请求数)例如:2006-12-21 10:18:52:提示:ASas_nbop编号1请求积压809个! 各线程当前处理请求为:12548,2,2073022001,2,3028523702,2,3014422001,2,2977122001,2,2934022001,2,303971202,2,3027622001,2,30191500000,2,29537500000,2,3034822001,2,304181202,2,3020722003,2,2996
27、622001,2,2986522001,2,30008 一般请求出现积压的情况,会在多个AS节点同时发生,所以在分析核心监控日志文件时,先要按时间顺序,把同一个AS节点的压积告警消息挑出来,作对比。然后对比同一个AS各处理线程的请求处理情况,即检查相邻检测点上,同一个处理线程所处理的请求是否发生变化,已处理请求数是否发生变化、功能号是否发生变化。特别要注意同一处理线程,在二个相邻检测点上,已处理请求数不变的情况,说明当前请求的处理时已超过了一个检测间隔(几秒),这一般是非正常情况,可能后台数据库处理该功能有异常。在分析核心监控日志中的请求压积信息时,可以结合当时的功能统计数据,分析是该时段哪些
28、功能被执行过,执行性能是否有异常。1.2.5 管理客户端功能统计日志在本机时间11:35及15:05分或出现AS请求积压告警时自动获取,采集所有核心AS上的功能处理统计数据,保存在管理客户端工作目录下,文件名:AS组名_编号_mmddhhnn.csv,可通过该文件分析AS对功能的处理情况。上述数据日志文件为规则二维表,均可用Excel打开进行排序和运算操作,第一行为字段名,其余各行为每个功能号的相关统计数据;主要字段(列)说明:func_no功能号func_caption功能说明enable功能是否启用,1启用,0禁用file_name功能所在的业务组件库名total功能被执行的次数(自AS启动以来)time功能执行累计耗时,单位毫秒ave_time平均执行时间,即time/total。max_time最长的一次执行时间min_time
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1