■■查看设备的空闲空间,是采用sp_spaceused还是sp_helpdb?
syabse 中,查看设备的空闲空间,是采用sp_spaceused还是sp_helpdb?采用这两个命令得到的结果不一致?
1> use DIRWAYSDB
2> go
1> sp_spaceused
2> go
database_name database_size
------------------------------ -------------
DIRWAYSDB 6132.0 MB
reserved data index_size unused
--------------- --------------- --------------- ---------------
851120 KB 54048 KB 764464 KB 32608 KB
(return status = 0)
1> sp_helpdb DIRWAYSDB
2> go
name db_size owner dbid created
status
------------------------ ------------- ------------------------ ------ --------------
------------------------------------------------------------------------------------------------------
DIRWAYSDB 6132.0 MB sa 4 Sep 16, 2010
select into/bulkcopy/pllsort, trunc log on chkpt
(1 row affected)
device_fragments size usage created free kbytes
------------------------------ ------------- -------------------- ------------------- ------------------------------
dir1 2044.0 MB data only Sep 17 2010 12:34AM 1343632
dir2 2044.0 MB data only Sep 17 2010 12:34AM 1971264
dirlog 2044.0 MB log only Sep 17 2010 12:34AM not applicable
--------------------------------------------------------------
log only free kbytes = 2084864
1> use DIRWAYSDB
2> go
1> sp_spaceused
2> go
database_name database_size
------------------------------ -------------
DIRWAYSDB 6132.0 MB
reserved data index_size unused
--------------- --------------- --------------- ---------------
851120 KB 54048 KB 764464 KB 32608 KB
(return status = 0)
1> sp_helpdb DIRWAYSDB
2> go
name db_size owner dbid created
status
------------------------ ------------- ------------------------ ------ --------------
------------------------------------------------------------------------------------------------------
DIRWAYSDB 6132.0 MB sa 4 Sep 16, 2010
select into/bulkcopy/pllsort, trunc log on chkpt
(1 row affected)
device_fragments size usage created free kbytes
------------------------------ ------------- -------------------- ------------------- ------------------------------
dir1 2044.0 MB data only Sep 17 2010 12:34AM 1343632
dir2 2044.0 MB data only Sep 17 2010 12:34AM 1971264
dirlog 2044.0 MB log only Sep 17 2010 12:34AM not applicable
--------------------------------------------------------------
log only free kbytes = 2084864
作者: mango10000 发布时间: 2011-03-14
其实都可以,spaceused更明细,速度慢,特别是大数据库的时候能慢死,helpdb能看个大概,速度快。其实还有一个命令,sp_helpsegment,你去查查命令手册。
作者: jarjar 发布时间: 2011-03-15