安全管理-权限日志,如何统计空间使用情况

1 问题描述
如何知晓系统使用权限日志,占用了多少数据库磁盘空间?
2 解决方法
使用数据库客户端,在日志库进行查询。
MYSQL库
查出权限日志所有表(包含索引)占用空间:
select concat(round(sum(data_length/1024/1024),2),'MB') as '数据+索引容量(MB)' from information_schema.tables where table_schema='ptest_biz_baseline_log' and table_name like 't_perm_log%';
查看权限日志各表占用空间:
select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)', (truncate(data_length/1024/1024, 2) + truncate(index_length/1024/1024, 2)) as '总容量(MB)' from information_schema.tables where table_schema='ptest_biz_baseline_log' and table_name like 't_perm_log%' order by (truncate(data_length/1024/1024, 2) + truncate(index_length/1024/1024, 2)) desc;
PS:ptest_biz_baseline_log 为 数据库的库名。
PostgrelSQL
查出权限日志所有表(包含索引)占用空间:
select pg_size_pretty(sum(t.size)) from (
SELECT pg_total_relation_size('"' || table_schema || '"."' || table_name || '"')AS size
FROM information_schema.tables
where table_name like 't_perm_log%' or table_name like 't_permlog%'
) t;查
安全管理-权限日志,如何统计空间使用情况
1 问题描述如何知晓系统使用权限日志,占用了多少数据库磁盘空间?2 解决方法使用数据库客户端,在日志库进行查询。MYSQL库查出权限日志...
点击下载文档文档为doc格式
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
上一篇
已经是第一篇



