当前位置: 首页 > news >正文

Sql Server 性能分析1 –查看数据库的相关信息

Sql Server 性能分析1 –查看数据库的相关信息

1. 在一台sql server 上操作,我们要尽过能的知道数据的相关信息,这是性能分析的根本。

查看能Sql Server 的相关信息,我们可以用Serverproperty来得到数据库的相关信息,以下是ServerProperty 的相关使用说明:

SERVERPROPERTY

Returns property information about the server instance.

语法:

Syntax

SERVERPROPERTY ( propertyname )

Arguments

propertyname

Is an expression containing the property information to be returned for the server. propertyname can be one of these values.

数据库属性的相关参数

Property name

Values returned

Collation

The name of the default collation for the server.

Returns NULL if invalid input or error.

Base data type: nvarchar

Edition

The edition of the Microsoft® SQL Server™ instance installed on the server.

Returns:

'Desktop Engine'
'Developer Edition'
'Enterprise Edition'
'Enterprise Evaluation Edition'
'Personal Edition'
'Standard Edition'

Base data type: nvarchar(128)

Engine Edition

The engine edition of the SQL Server instance installed on the server.

1 = Personal or Desktop Engine
2 = Standard
3 = Enterprise (returned for Enterprise, Enterprise Evaluation, and Developer)

Base data type: int

InstanceName

The name of the instance to which the user is connected.

Returns NULL if the instance name is the default instance, or invalid input or error.

Base data type: nvarchar

IsClustered

The server instance is configured in a failover cluster.

1 = Clustered.
0 = Not Clustered.
NULL = Invalid input, or error.

Base data type: int

IsFullTextInstalled

The full-text component is installed with the current instance of SQL Server.

1 = Full-text is installed.
0 = Full-text is not installed.
NULL = Invalid input, or error.

Base data type: int

IsIntegratedSecurityOnly

The server is in integrated security mode.

1 = Integrated Security.
0 = Not Integrated Security.
NULL = Invalid input, or error.

Base data type: int

IsSingleUser

The server is in single user mode.

1 = Single User.
0 = Not Single User
NULL = Invalid input, or error.

Base data type: int

IsSyncWithBackup

The database is either a published database or a distribution database, and can be restored without disrupting transactional replication.

1 = True.
0 = False.

Base data type: int

LicenseType

Mode of this instance of SQL Server.

PER_SEAT = Per-seat mode
PER_PROCESSOR = Per-processor mode
DISABLED = Licensing is disabled.

Base data type: nvarchar(128)

MachineName

Windows NT computer name on which the server instance is running.

For a clustered instance, an instance of SQL Server running on a virtual server on Microsoft Cluster Server, it returns the name of the virtual server.

Returns NULL if invalid input or error.

Base data type: nvarchar

NumLicenses

Number of client licenses registered for this instance of SQL Server, if in per-seat mode.

Number of processors licensed for this instance of SQL Server, if in per-processor mode.

Returns NULL if the server is none of the above.

Base data type: int

ProcessID

Process ID of the SQL Server service. (ProcessID is useful in identifying which sqlservr.exe belongs to this instance.)

Returns NULL if invalid input or error.

Base data type: int

ProductVersion

The version of the instance of SQL Server, in the form of 'major.minor.build'.

Base data type: varchar(128)

ProductLevel

The level of the version of the SQL Server instance.

Returns:
'RTM' = shipping version.
'SPn' = service pack version
'Bn', = beta version.

Base data type: nvarchar(128).

ServerName

Both the Windows NT server and instance information associated with a specified instance of SQL Server.

Returns NULL if invalid input or error.

Base data type: nvarchar

例子:如要查询电脑名,Sql server 数据库实例名,数据库版本,数据类型,数据库级别(如升包等)

select

SERVERPROPERTY('MachineName') as N’Machine Name’,

serverproperty('Servername') as N’Server Name’,

SERVERPROPERTY('ProductVersion') N'Database Version',

SERVERPROPERTY ('Edition') N'Database Type',

SERVERPROPERTY('ProductLevel') N'Database Packs'

注意:@@Version 中的信息与 SERVERPROPERTY 中反映的信息是不一定相同的,查看Sql Server数据库的信息我们应该以SERVERPROPERTY 为准。

Select

cast(SERVERPROPERTY('MachineName')as varchar(10)) as N'Machine Name',

cast(SERVERPROPERTY('Servername') as varchar(20)) as N'Server Name',

cast(SERVERPROPERTY('ProductVersion') as varchar(10)) N'Database Version',

cast(SERVERPROPERTY ('Edition') as varchar(10)) N'Database Type',

cast(SERVERPROPERTY('ProductLevel')as varchar(10)) N'Database Packs'

Machine Name Server Name Database Version Database Type Database Packs

------------ -------------------- ---------------- ------------- ----------

VS-HKMESDB VS-HKMESDB\HKDB 8.00.760 Enterprise SP3

select @@version

----------------------------------------------------------------------------------------------------------------------

Microsoft SQL Server 2000 - 8.00.760 (Intel IA-64)

Feb 6 2003 16:07:24

Copyright (c) 1988-2003 Microsoft Corporation

Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

上面两个Sql 都返回了一些sql server 数据库的信息,我们看到却有两个Service Pack,这里正确的Sql server server packe SP3 , @@version 中的Service Pack 2 sql server 所在电脑的windows service pack ,这个不能弄混了。

相关文章:

  • 某游戏公司的MYSQL配置文件
  • CentOS7 之系统优化方案
  • 存储过程中的行集作为子查询
  • CentOS6 下安装RabbitMQ和ErLang
  • MTK工作中可以使用的批处理脚本
  • PHP排列组合算法
  • 通信运营商如何理性应对带号转网(1)
  • 使用MySQL触发器自动生成日汇总表
  • C#使用DES加解密数据
  • Install nodejs on CentOS 7+
  • WindowsMobile上C#通过DirectShow控制摄像头
  • MACBOOK 调教指北
  • 关于Apache无法加载PHP 7.2 curl模块问题的解决办法
  • 墙脆脆?!
  • 在群晖DS218+上编译Fluffos的Docker镜像
  • 08.Android之View事件问题
  • android百种动画侧滑库、步骤视图、TextView效果、社交、搜房、K线图等源码
  • egg(89)--egg之redis的发布和订阅
  • JavaScript 奇技淫巧
  • JavaScript异步流程控制的前世今生
  • js写一个简单的选项卡
  • k8s 面向应用开发者的基础命令
  • Service Worker
  • vue-cli在webpack的配置文件探究
  • 阿里云购买磁盘后挂载
  • 百度小程序遇到的问题
  • 给第三方使用接口的 URL 签名实现
  • 和 || 运算
  • 欢迎参加第二届中国游戏开发者大会
  • 记一次和乔布斯合作最难忘的经历
  • 普通函数和构造函数的区别
  • 手写一个CommonJS打包工具(一)
  • 协程
  • ​​​​​​​Installing ROS on the Raspberry Pi
  • ​直流电和交流电有什么区别为什么这个时候又要变成直流电呢?交流转换到直流(整流器)直流变交流(逆变器)​
  • #14vue3生成表单并跳转到外部地址的方式
  • #我与Java虚拟机的故事#连载05:Java虚拟机的修炼之道
  • (7)STL算法之交换赋值
  • (四) Graphivz 颜色选择
  • (五) 一起学 Unix 环境高级编程 (APUE) 之 进程环境
  • (五)c52学习之旅-静态数码管
  • (一)UDP基本编程步骤
  • (转)PlayerPrefs在Windows下存到哪里去了?
  • (转)清华学霸演讲稿:永远不要说你已经尽力了
  • . ./ bash dash source 这五种执行shell脚本方式 区别
  • .NET 5.0正式发布,有什么功能特性(翻译)
  • .NET Core 控制台程序读 appsettings.json 、注依赖、配日志、设 IOptions
  • .NET Framework .NET Core与 .NET 的区别
  • .Net Winform开发笔记(一)
  • .NET关于 跳过SSL中遇到的问题
  • .NET项目中存在多个web.config文件时的加载顺序
  • /etc/sudoer文件配置简析
  • @font-face 用字体画图标
  • @SuppressWarnings注解
  • [1204 寻找子串位置] 解题报告