Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » 案列分析

adrci工具的使用

ADRCI:Automatic Diagnostic Repository Command Interpreter,这个是在11g引入的命令行工具。Automatic Diagnostic Repository包含所有的trace文件,core文件和alert文件,这些文件有序地放在一个结构化的目录中。从11g开始Database,ASM,CRS和其他Oracle产品或组件都把诊断数据存放在里面,并且每个产品或组件都有自己的ADR HOME。对support来说也可以快速的帮助他们完成打包、收集故障信息等。对DBA来说,这个工具非常实用和好用。

之前碰到过客户,200G的空间耗尽导致RAC宕机,后来通过adrci清除日志,清除后空间多了150G。重新启动后,数据库恢复正常


常用的命令
adrci> help
 HELP [topic]
   Available Topics:
        CREATE REPORT
        ECHO
        EXIT
        HELP
        HOST
        IPS
        PURGE
        RUN
        SET BASE
        SET BROWSER
        SET CONTROL
        SET ECHO
        SET EDITOR
        SET HOMES | HOME | HOMEPATH
        SET TERMOUT
        SHOW ALERT
        SHOW BASE
        SHOW CONTROL
        SHOW HM_RUN
        SHOW HOMES | HOME | HOMEPATH
        SHOW INCDIR
        SHOW INCIDENT
        SHOW LOG
        SHOW PROBLEM
        SHOW REPORT
        SHOW TRACEFILE
        SPOOL
        SELECT

查看保留策略
adrci> show control

ADR Home = /u01/oracle/diag/rdbms/cdb3/cdb3:
*************************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY         LAST_MOD_TIME                            LAST_AUTOPRG_TIME                        LAST_MANUPRG_TIME                        ADRDIR_VERSION       ADRSCHM_VERSION      ADRSCHMV_SUMMARY     ADRALERT_VERSION     CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1375300530           720                  8760                 2016-03-10 11:23:23.571634 +08:00                                                 2016-07-15 16:49:51.427905 +08:00        1                    2                    82                   1                    2016-03-10 11:23:23.571634 +08:00
1 rows fetched

adrci> help set control

  Usage: SET CONTROL (<purge_policy>=<value>, ...)

  Purpose: Set the purging policy.

  Arguments:
    <purge_policy>: The purging policy name. The current valid values are
    "SHORTP_POLICY" and "LONGP_POLICY".

    <value>: The purging time value in hours.

  Examples:
    set control (SHORTP_POLICY = 1440)

adrci>

adrci> show home
ADR Homes:
diag/tnslsnr/db1/listener
diag/clients/user_oracle/host_3135802894_82
diag/rdbms/upgr/upgr
diag/rdbms/cdb3/cdb3
diag/rdbms/cdb1/cdb1
adrci>

adrci> set home diag/rdbms/cdb3/cdb3
adrci> show incident -all
ADR Home = /u01/oracle/diag/rdbms/cdb3/cdb3:
*************************************************************************
INCIDENT_ID          PROBLEM_KEY                                                 CREATE_TIME
-------------------- ----------------------------------------------------------- ----------------------------------------
7273                 ORA 700 [kskvmstatact: excessive swapping observed]         2016-03-10 14:06:05.087000 +08:00
1 rows fetched

查看alert日志
ADRCI> show alert
adrci> show alert -tail 50         #这个命令很好用,尤其是在windows平台上(文件太大,导致很难打开)查看最后50行
2016-03-10 11:31:08.603000 +08:00
Successful mount of redo thread 1, with mount id 603439033
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE   MOUNT
ALTER DATABASE OPEN
Ping without log force is disabled
.
Starting background process TMON
TMON started with pid=23, OS id=7482
Thread 1 opened at log sequence 7
  Current log# 1 seq# 7 mem# 0: /oradata/cdb3/redo01.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
SMON: enabling cache recovery
[7480] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:4606834 end:4607004 diff:170 ms (0.2 seconds)
Verifying minimum file header compatibility (11g) for tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is AL32UTF8
Starting background process SMCO
SMCO started with pid=25, OS id=7487
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process AQPC
AQPC started with pid=28, OS id=7493
2016-03-10 11:31:10.096000 +08:00
Starting background process CJQ0
Completed: ALTER DATABASE OPEN
CJQ0 started with pid=30, OS id=7497
2016-03-10 11:31:14.879000 +08:00
Shared IO Pool defaulting to 8MB. Trying to get it from Buffer Cache for process 7464.
===========================================================
Dumping current patch information
===========================================================
No patches have been applied
===========================================================
2016-03-10 11:31:19.994000 +08:00
Resize operation completed for file# 4, old size 128000K, new size 133120K
Thread 1 advanced to log sequence 8 (LGWR switch)
  Current log# 2 seq# 8 mem# 0: /oradata/cdb3/redo02.log
Resize operation completed for file# 4, old size 133120K, new size 138240K
2016-03-10 11:46:10.615000 +08:00
Default pga_aggregate_limit value is too high for the
amount of physical memory in the system
pga_aggregate_limit is 2048 MB
limit based on physical memory and SGA usage is 1413 MB
2016-03-10 12:01:11.307000 +08:00
Resize operation completed for file# 3, old size 665600K, new size 696320K
2016-03-10 14:06:05.017000 +08:00
WARNING: Heavy swapping observed on system in last 5 mins.
pct of memory swapped in [1.23%] pct of memory swapped out [0.88%].
Please make sure there is no memory pressure and the SGA and PGA
are configured correctly. Look at DBRM trace file for more details.
Errors in file /u01/oracle/diag/rdbms/cdb3/cdb3/trace/cdb3_dbrm_7444.trc  (incident=7273):
ORA-00700: soft internal error, arguments: [kskvmstatact: excessive swapping observed], [], [], [], [], [], [], [], [], [], [], []
Incident details in: /u01/oracle/diag/rdbms/cdb3/cdb3/incident/incdir_7273/cdb3_dbrm_7444_i7273.trc
2016-03-10 14:06:06.926000 +08:00
Dumping diagnostic data in directory=[cdmp_20160310140606], requested by (instance=1, osid=7444 (DBRM)), summary=[incident=7273].
2016-03-10 14:06:08.856000 +08:00
Sweep [inc][7273]: completed
Sweep [inc2][7273]: completed
2016-03-10 14:36:27.828000 +08:00
Shutting down instance (immediate)
Stopping background process SMCO
2016-03-10 14:36:28.851000 +08:00
Shutting down instance: further logons disabled
Stopping background process CJQ0
Stopping background process MMNL
Stopping background process MMON
2016-03-10 14:36:30.883000 +08:00
License high water mark = 3
All dispatchers and shared servers shutdown
ALTER DATABASE CLOSE NORMAL
SMON: disabling tx recovery
Stopping Emon pool
Stopping Emon pool
SMON: disabling cache recovery
Shutting down archive processes
Archiving is disabled
Thread 1 closed at log sequence 8
Successful close of redo thread 1
Completed: ALTER DATABASE CLOSE NORMAL
ALTER DATABASE DISMOUNT
Shutting down archive processes
Archiving is disabled
Completed: ALTER DATABASE DISMOUNT
2016-03-10 14:36:33.009000 +08:00
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Stopping background process VKTM
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
2016-03-10 14:36:42.372000 +08:00
Instance shutdown complete
adrci>       

清除日志
如果上面有多个数据库,在运行命令之前先设定home
purge -age 1440(删除1天之前的日志,purge默认的是分钟)
adrci> purge -age 1440
DIA-48448: This command does not support multiple ADR homes
adrci> show home
ADR Homes:
diag/tnslsnr/db1/listener
diag/clients/user_oracle/host_3135802894_82
diag/rdbms/upgr/upgr
diag/rdbms/cdb3/cdb3
diag/rdbms/cdb1/cdb1
adrci> set home diag/rdbms/cdb3/cdb3
adrci> purge -age 1440
adrci>


Reference

http://docs.oracle.com/cd/E11882_01/server.112/e22490/adrci.htm

http://docs.oracle.com/database/121/SUTIL/GUID-DC5744C7-FAC0-436B-99D5-DBD45B66930B.htm#SUTIL700



关键词:utility oracle 

相关文章

关于Java的那些事
Vagrant with oracle
Install Oracle Database 19c on X86
Install oracle products on docker
一图了解Oracle GoldenGate实现Oracle到Oracle复制的前世今生
Exadata最权威最完整的学习资料
Oracle数据库C函数解析
MySQL Cookbook for Oracle DBA
Full Transportable Export/Import(fxtts)
Oracle自治数据仓库云
expdp on physical standby
Oracle Database 12c之后DataGuard环境中的PDB操作
Top