set statistics io,time on; 查询语句消耗时间

2.设置内存大小

--开启数据库高级选项
exec sp_configure 'show advanced options',1
go
reconfigure with override
go

exec sp_configure 'max server memory (MB)',80000
go
reconfigure with override
go

3.sp_block 'r' 正在执行进程 sp_block 所有进程,包括缓存

 

4.

看表的行数

 sp_spaceused 表名
看表的索引
sp_helpindex 表名 
 
5.select @@Version 查看版本
6.开启调用xcmd插件

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
exec sp_configure 'xp_cmdshell',1
go
reconfigure with override
go

 

7.查询库使用情况

SELECT a.name as 逻辑文件名, size/128 [文件大小(兆)],
FILEPROPERTY(a.name, 'SpaceUsed')/128 [已用空间(兆)],
size/128 - FILEPROPERTY(a.name, 'SpaceUsed')/128 [未用空间(兆)],
FILEPROPERTY(a.name, 'SpaceUsed')*100.0/size [使用率(%)],
case when max_size=-1 then N'无限制' else convert(char(20),max_size/128) end [最大值(兆)]
, case when growth>100 then convert(varchar(20),growth/128) else CONVERT(varchar(20),growth)+'%'end 增长值MB,
case when is_percent_growth=0 then N'否'else N'是'end 是否百分比增长, physical_name 物理路径,b.*
FROM sys.database_files a cross join (select recovery_model_desc, log_reuse_wait,log_reuse_wait_desc,is_auto_shrink_on from sys.databases where name=DB_NAME())b

 

相关文章:

  • 2021-07-01
  • 2022-02-12
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-09-03
  • 2022-01-11
猜你喜欢
  • 2021-05-26
  • 2021-07-19
  • 2021-08-31
  • 2022-12-23
  • 2021-07-28
  • 2021-07-18
相关资源
相似解决方案