zoukankan      html  css  js  c++  java
  • sql知识点

    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

  • 相关阅读:
    linux之参数实用讲解
    Linux脚本中调用SQL,RMAN脚本
    shell for参数
    Linux Shell参数替换
    Python OOP(1)
    Python 不可变对象
    Python set
    Python tuple
    Python list,tuple,dict and set
    Python 可变长度函数参数
  • 原文地址:https://www.cnblogs.com/elsons/p/12464658.html
Copyright © 2011-2022 走看看