如何清理Oracle11g RAC日志文件
1个回答
2017-10-09 · 知道合伙人软件行家
关注
展开全部
一、查看文件系统使用率
db:/home/oracle$ df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 2.00 0.49 76% 14384 11% /
/dev/hd2 8.00 4.75 41% 77263 7% /usr
/dev/hd9var 2.00 1.03 49% 13269 6% /var
/dev/hd3 10.00 9.49 6% 2237 1% /tmp
/dev/hd1 6.00 4.00 34% 2995 1% /home
/dev/hd11admin 0.50 0.50 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 0.50 0.30 41% 9075 12% /opt
/dev/livedump 0.50 0.50 1% 4 1% /var/adm/ras/livedump
/dev/bnmslv 2.00 0.82 60% 42605 19% /bnms
/dev/db7_oraclelv 99.50 15.18 85% 377711 10% /oracle
二、切换到grid用户
db:/home/oracle$ su - grid
grid's Password:
db:/home/grid$ cd $ORACLE_BASE
db:/oracle/app/oracle$ ls
Clusterware db diag db osw osw.tar tfa
db:/oracle/app/oracle$ cd diag
db:/oracle/app/oracle/diag$ ls
asm rdbms tnslsnr
db:/oracle/app/oracle/diag$ cd tns*
db:/oracle/app/oracle/diag/tnslsnr$ ls
db
db:/oracle/app/oracle/diag/tnslsnr$ cd *
db:/oracle/app/oracle/diag/tnslsnr/db$ ls
listener listener_2 listener_3 listener_scan1
db:/oracle/app/oracle/diag/tnslsnr/db$ du -sg *
9.52 listener
16.79 listener_2
3.44 listener_3
0.00 listener_scan1
db:/oracle/app/oracle/diag/tnslsnr/db$ cd listener
db:/oracle/app/oracle/diag/tnslsnr/db/listener$ cd trace
db:/oracle/app/oracle/diag/tnslsnr/db/listener/trace$ ls -l
total 6802512
-rw-r----- 1 grid oinstall 3482428458 Jun 08 09:56 listener.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener/trace$ >listener.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener/trace$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db/listener$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db$ cd listener_2
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2$ cd trace
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2/trace$ ls -l
total 12964296
-rw-r----- 1 grid oinstall 6637075895 Jun 08 09:56 listener_2.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2/trace$ >listener_2.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2/trace$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db$ cd listener_3
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3$ cd trace
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3/trace$ ls -l
total 2497368
-rw-r----- 1 grid oinstall 1278425004 Jun 08 09:57 listener_3.log
-rw-r----- 1 grid oinstall 0 Apr 20 00:55 ora_66915652_1.trc
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3/trace$ >listener_3.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3/trace$ cd
三、清理文件监听alert日志
db:/home/grid$ adrci
ADRCI: Release 11.2.0.3.0 - Production on Wed Jun 8 09:57:56 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
ADR base = "/oracle/app/oracle"
adrci> show home
ADR Homes:
diag/asm/+asm/+ASM5
diag/rdbms/dbsale/dbsaleinst5
diag/tnslsnr/db/listener
diag/tnslsnr/db/listener_2
diag/tnslsnr/db/listener_3
diag/tnslsnr/db/listener_scan1
adrci> set home diag/tnslsnr/db/listener
adrci> purge -age 0 -type alert
adrci> set home diag/tnslsnr/db/listener_2
adrci> purge -age 0 -type alert
adrci> set home diag/tnslsnr/db/listener_3
adrci> purge -age 0 -type alert
adrci>
adrci>
adrci> exit
四、确认清理后的大小
db:/home/grid$ df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 2.00 0.49 76% 14384 11% /
/dev/hd2 8.00 4.75 41% 77263 7% /usr
/dev/hd9var 2.00 1.03 49% 13269 6% /var
/dev/hd3 10.00 9.49 6% 2237 1% /tmp
/dev/hd1 6.00 4.00 34% 2995 1% /home
/dev/hd11admin 0.50 0.50 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 0.50 0.30 41% 9075 12% /opt
/dev/livedump 0.50 0.50 1% 4 1% /var/adm/ras/livedump
/dev/bnmslv 2.00 0.82 60% 42611 19% /bnms
/dev/db7_oraclelv 99.50 44.88 55% 375759 4% /oracle
db:/home/grid$
如果查出来的结果还是很大。就切换到oracle用户。进入$ORACLE_BASE/diag/rdbms/db_name/instance_name/trace
清理一些trc文件或者alert日志。
db:/home/oracle$ df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 2.00 0.49 76% 14384 11% /
/dev/hd2 8.00 4.75 41% 77263 7% /usr
/dev/hd9var 2.00 1.03 49% 13269 6% /var
/dev/hd3 10.00 9.49 6% 2237 1% /tmp
/dev/hd1 6.00 4.00 34% 2995 1% /home
/dev/hd11admin 0.50 0.50 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 0.50 0.30 41% 9075 12% /opt
/dev/livedump 0.50 0.50 1% 4 1% /var/adm/ras/livedump
/dev/bnmslv 2.00 0.82 60% 42605 19% /bnms
/dev/db7_oraclelv 99.50 15.18 85% 377711 10% /oracle
二、切换到grid用户
db:/home/oracle$ su - grid
grid's Password:
db:/home/grid$ cd $ORACLE_BASE
db:/oracle/app/oracle$ ls
Clusterware db diag db osw osw.tar tfa
db:/oracle/app/oracle$ cd diag
db:/oracle/app/oracle/diag$ ls
asm rdbms tnslsnr
db:/oracle/app/oracle/diag$ cd tns*
db:/oracle/app/oracle/diag/tnslsnr$ ls
db
db:/oracle/app/oracle/diag/tnslsnr$ cd *
db:/oracle/app/oracle/diag/tnslsnr/db$ ls
listener listener_2 listener_3 listener_scan1
db:/oracle/app/oracle/diag/tnslsnr/db$ du -sg *
9.52 listener
16.79 listener_2
3.44 listener_3
0.00 listener_scan1
db:/oracle/app/oracle/diag/tnslsnr/db$ cd listener
db:/oracle/app/oracle/diag/tnslsnr/db/listener$ cd trace
db:/oracle/app/oracle/diag/tnslsnr/db/listener/trace$ ls -l
total 6802512
-rw-r----- 1 grid oinstall 3482428458 Jun 08 09:56 listener.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener/trace$ >listener.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener/trace$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db/listener$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db$ cd listener_2
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2$ cd trace
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2/trace$ ls -l
total 12964296
-rw-r----- 1 grid oinstall 6637075895 Jun 08 09:56 listener_2.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2/trace$ >listener_2.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2/trace$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db/listener_2$ cd ..
db:/oracle/app/oracle/diag/tnslsnr/db$ cd listener_3
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3$ cd trace
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3/trace$ ls -l
total 2497368
-rw-r----- 1 grid oinstall 1278425004 Jun 08 09:57 listener_3.log
-rw-r----- 1 grid oinstall 0 Apr 20 00:55 ora_66915652_1.trc
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3/trace$ >listener_3.log
db:/oracle/app/oracle/diag/tnslsnr/db/listener_3/trace$ cd
三、清理文件监听alert日志
db:/home/grid$ adrci
ADRCI: Release 11.2.0.3.0 - Production on Wed Jun 8 09:57:56 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
ADR base = "/oracle/app/oracle"
adrci> show home
ADR Homes:
diag/asm/+asm/+ASM5
diag/rdbms/dbsale/dbsaleinst5
diag/tnslsnr/db/listener
diag/tnslsnr/db/listener_2
diag/tnslsnr/db/listener_3
diag/tnslsnr/db/listener_scan1
adrci> set home diag/tnslsnr/db/listener
adrci> purge -age 0 -type alert
adrci> set home diag/tnslsnr/db/listener_2
adrci> purge -age 0 -type alert
adrci> set home diag/tnslsnr/db/listener_3
adrci> purge -age 0 -type alert
adrci>
adrci>
adrci> exit
四、确认清理后的大小
db:/home/grid$ df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 2.00 0.49 76% 14384 11% /
/dev/hd2 8.00 4.75 41% 77263 7% /usr
/dev/hd9var 2.00 1.03 49% 13269 6% /var
/dev/hd3 10.00 9.49 6% 2237 1% /tmp
/dev/hd1 6.00 4.00 34% 2995 1% /home
/dev/hd11admin 0.50 0.50 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 0.50 0.30 41% 9075 12% /opt
/dev/livedump 0.50 0.50 1% 4 1% /var/adm/ras/livedump
/dev/bnmslv 2.00 0.82 60% 42611 19% /bnms
/dev/db7_oraclelv 99.50 44.88 55% 375759 4% /oracle
db:/home/grid$
如果查出来的结果还是很大。就切换到oracle用户。进入$ORACLE_BASE/diag/rdbms/db_name/instance_name/trace
清理一些trc文件或者alert日志。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
今至电子科技有限公司
2024-08-23 广告
2024-08-23 广告
数据库备份是确保数据安全与业务连续性的关键环节。我们上海今至电子科技有限公司高度重视数据保护,定期执行全面的数据库备份策略。这包括使用先进工具和技术,对关键业务数据进行自动化备份,并存储在安全可靠的外部存储介质或云端。通过定期验证备份的完整...
点击进入详情页
本回答由今至电子科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询