Sybase DB사용량
select t.HOST명, t.디바이스명, t.물리적디바이스명, t.DB명, t.할당, t.가용, t.사용율, t.SegMap설명, t.crdate
from
(
SELECT
"HOST명"=@@servername,
"디바이스명" = substring(d.name, 1, 20),
"물리적디바이스명"=d.phyname,
"DB명" = db_name(u.dbid),
"할당" = round(u.size /(512.0/(@@maxpagesize/@@pagesize)),2),
"가용"= round(curunreservedpgs(u.dbid,u.lstart,u.unreservedpgs)/ (512.0/(@@maxpagesize/@@pagesize)),2) ,
"사용율"= round( ((u.size-curunreservedpgs(u.dbid,u.lstart,u.unreservedpgs))*100.0/u.size),2) ,
"SegMap설명" = case segmap when 4 then "LOG"
else "DATA" end,
convert(varchar(8),u.crdate,112) as crdate,1 col
FROM
master.dbo.sysdevices d,
master.dbo.sysusages u
WHERE u.vdevno = d.vdevno
and d.phyname not in ('/dev/rmt4','/dev/rst0')
and db_name(u.dbid) not in ('master','sybsystemdb','sybsystemprocs','tempdb','tempdb2')
union all
SELECT
"HOST명"=@@servername,
"디바이스명" = substring(d.name, 1, 20),
"물리적디바이스명"=d.phyname,
"DB명" = db_name(u.dbid),
"할당" = round(u.size /(512.0/(@@maxpagesize/@@pagesize)),2),
"가용"= round(curunreservedpgs(u.dbid,u.lstart,u.unreservedpgs)/ (512.0/(@@maxpagesize/@@pagesize)),2) ,
"사용율"= round( ((u.size-curunreservedpgs(u.dbid,u.lstart,u.unreservedpgs))*100.0/u.size),2) ,
"SegMap설명" = case segmap when 4 then "LOG"
else "DATA" end,
convert(varchar(8),u.crdate,112) as crdate, 2 col
FROM
master.dbo.sysdevices d,
master.dbo.sysusages u
WHERE u.vdevno = d.vdevno
and d.phyname not in ('/dev/rmt4','/dev/rst0')
and db_name(u.dbid) in ('master','sybsystemdb','sybsystemprocs','tempdb','tempdb2')
) t
ORDER BY col, DB명
sybase 15.7 기준