Oralce操作系列:Adrci命令使用实操
从Oracle 11g开始,Oralce引进了adrci工具,adrci(Automatic Diagnostic Repository Command Interpreter)管理诊断数据库的命令行工具,基本使用方式方法做如下记录。
--ADRCI使用
***********************************************************************************************
su - oracle
adrci --在oracle用户环境下或者grid用户环境下输入adrci
adrci> help --可以使用help命令查看具体如何使用adrci
adrci> host "ls -l"
adrci> host "pwd"
adrci> show home
adrci> set homepath diag/rdbms/xiaozc/xiaozc --设置环境变量
adrci> show problem --查看数据库近期问题
adrci> show problem -p "problem_id>50"--查看问题ID大于50的报错
adrci> select * from problem where "PROBLEM_KEY like '%600%'"
adrci> show incident --查看事件
adrci> show incident -mode detail -p "incident_id=456125"--查看事件的具体信息
adrci> select incident_id, create_time from incident where "incident_id > 1"
adrci> show alert -p "message_text like '%too%'"
adrci> show alert -p "ORIGINATING_TIMESTAMP>'2021-08-19 11:31:38' and ORIGINATING_TIMESTAMP<'2021-08-19 16:02:41'"
adrci> purge -age 1440 -type incident --删除一天前的事件
adrci> show incident
ADR Home = /u01/app/oracle/diag/rdbms/hisdb/HISDB1:
*************************************************************************
0 rows fetched
adrci> delete from problem where problem_id=1;
1 Row Deleted
adrci> delete from problem where problem_id>1; --删除id大于等于1的问题
61 Rows Deleted
adrci> show problem
ADR Home = /u01/app/oracle/diag/rdbms/hisdb/HISDB1:
*************************************************************************
0 rows fetched
adrci> PURGE -age 1440 -type ALERT --删除一天前的alert日志
adrci> purge -age 60 -type CDUMP --清除1小时前的cdump日志