您的位置:首页 > 其它

怎样查询磁盘的可用空间,数据文件及日志文件大小及利用率

2008-04-26 20:27 507 查看
1.Tocheckthe availablediskspace,youmay usetheundocumentedsystemextendedstoredprocedurexp_fixeddrives, whichcanreturntheavailablefreespace(MB)foreachfixeddrive.Youcanrunitasfollows:

Execmaster.dbo.xp_fixeddrives

2.Asforthedatabasedatafileandtransactionlogspaceallocationandutilization,youmayusethefollowingquerytoquerythis:

1)Youmaycheckthefilesize(inMB)byquerythesysfilestableasfollows:

selectname,convert(float,size)*(8192.0/1024.0)/1024.fromdbo.sysfiles

2)Tochecktheutilization,youmayusesp_spaceused:

Execsp_spaceused

Thedatabase_sizecolumnisthesumofdatafilesandlogfiles,andthe"unallocatedspace"columnisthetotalunallocatedspaceinthedatabase.

Tocheckthelogfile'sutilization,youmayuse:

DBCCSQLPERF(LOGSPACE)

Formoreinformationregardingthesysfilestable,dbccsqlperf(logspace)andsp_spaceused,pleaserefertoBooksOnline.

Infact,youcanviewthesimilarinformationinSQLEnterpriseManager:inEnterpriseManager,rightclickthedatabase,clickView->Taskpad,thenyoucanseethedataandlogfilessizeandutilizationattheright
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐