linux下怎么清除db2数据库的日志

linux下怎么清除db2数据库的日志,第1张

如要清除日志直接删掉不就行了,找到log文件后直接删除

log 的存放路径用下边的命令查看:

db2 get db cfg for dbname

其中有Path to log files 一行显示了log 的存放路径

Linux的文件系统比Windows的要优秀,不会产生碎片,对于长时间运行的服务器来说尤为重要,而且Linux系统本身也不会像Windows一样产生大量的垃圾文件。不知道这个说法有没有可信度!至少我们可以确定的是linux系统的文件系统是比较优秀的!

错误

rm -f logfile

原因

应用已经打开文件句柄,直接删除会造成:

1.应用无法正确释放日志文件和写入

2.显示磁盘空间未释放

正确

cat /dev/null >logfile

把一下代码保存为.sh后缀脚本来运行即可清除Linux系统日志

#!/bin/sh

cat /dev/null >/var/log/syslog

cat /dev/null >/var/adm/sylog

cat /dev/null >/var/log/wtmp

cat /dev/null >/var/log/maillog

cat /dev/null >/var/log/messages

cat /dev/null >/var/log/openwebmail.log

cat /dev/null >/var/log/maillog

cat /dev/null >/var/log/secure

cat /dev/null >/var/log/httpd/error_log

cat /dev/null >/var/log/httpd/ssl_error_log

cat /dev/null >/var/log/httpd/ssl_request_log

cat /dev/null >/var/log/httpd/ssl_access_log

另外清理linux系统垃圾还有以下命令

sudo apt-get autoclean 清理旧版本的软件缓存

sudo apt-get clean 清理所有软件缓存

sudo apt-get autoremove 删除系统不再使用的孤立软件


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/10038514.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-04
下一篇 2023-05-04

发表评论

登录后才能评论

评论列表(0条)

保存