日期:2014-05-18 浏览次数:20450 次
exec sp_MSforeachtable@command1="print '?' exec sp_MStablespace '?'"
------解决方案--------------------
DECLARE @tablespaceinfo TABLE ( nameinfo varchar(50), rowsinfo int, reserved varchar(20), datainfo varchar(20), index_size varchar(20), unused varchar(20) ) DECLARE @tablename varchar(255); DECLARE Info_cursor CURSOR FOR SELECT [name] FROM sys.tables WHERE type='U'; OPEN Info_cursor FETCH NEXT FROM Info_cursor INTO @tablename WHILE @@FETCH_STATUS = 0 BEGIN insert into @tablespaceinfo exec sp_spaceused @tablename FETCH NEXT FROM Info_cursor INTO @tablename END CLOSE Info_cursor DEALLOCATE Info_cursor SELECT * FROM @tablespaceinfo ORDER BY Cast(Replace(reserved,'KB','') as INT) DESC
------解决方案--------------------
压缩日志? 网上一大把
------解决方案--------------------
http://www.cnblogs.com/downmoon/archive/2009/12/13/1623004.html
------解决方案--------------------
MSSQL2008及以上:
exec sp_helpdb '数据库名' --查看指定数据库
exec sp_databases --查看全部数据库