监控Sybase日志空间 的使用率

来源:互联网 发布:c语言错误代码大全 编辑:程序博客网 时间:2024/05/22 00:49

isql -Usa -P

1>; use MBFEWKDB
2>; go
1>; dbcc checktable(syslogs)
2>; go
Checking syslogs
The total number of data pages in this table is 86043.
*** NOTICE:  Space used on the log segment is 168.05 Mbytes, 84.03%.
*** NOTICE:  Space free on the log segment is 31.95 Mbytes, 15.97%.
Table has 1361739 data rows.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.

也可写个脚本 check_log.sh,将结果输出到一文件中!
$ cat check_log.sh
dbpasswd='yourpassword'
isql -Usa -P$dbpasswd -i checklog -o checklog_result.txt

$ cat checklog
use MBFEWKDB
go
dbcc checktable(syslogs)
go

 

修改一下,把显示的结果用M显示。

我对比了 Sybase Central 12.5 的输出结果,选数据库---段

以下语句是对的。

十分感谢 yyhll



select s.name, (select max(convert(int,t.status & 1))
from YOUR_DATABASE.dbo.systhresholds t
where s.segment=t.segment) status, sum(u.size)*2 size,
sum(u.size - curunreservedpgs(u.dbid, u.lstart, u.unreservedpgs))*2.000/1024 used,
@@thresh_hysteresis hysteresis
from YOUR_DATABASE.dbo.syssegments s, master.dbo.sysusages u
where 1 = 1 and
((u.segmap / ((s.segment & 1) + 1)) / power(2, (s.segment & 30))) & 1 = 1 and
u.dbid = db_id('YOUR_DATABASE') and s.name like '%'
group by s.name order by 1
 

原创粉丝点击