SQL Server专用管理员连接(Dedicated Admin Connection(DAC))

SQL Server专用管理员连接(Dedicated Admin Connection(DAC))

只有 SQL Server sysadmin 角色的成员可以使用 DAC 连接。默认情况下,只能从服务器上运行的客户端建立连接。

打开SSMS,在“Connect to Server”窗口,选择“Cancel”,然后选择File菜单,下拉菜单选择“New”、“Database Engine Query”。

输入“admin:.”,点击“Connect”。

默认不允许使用网络连接DAC,需要通过sp_configure配置“remote admin connections”选项。

先来看看配置的默认值:

SELECT * FROM sys.configurations where name = ‘remote admin connections‘

或者

sp_configure ‘remote admin connections‘

Value默认为0,指明仅允许本地连接使用 DAC。Maximum为1,表明只运行一个远程管理连接。

--启用远程DAC连接
sp_configure ‘remote admin connections‘, 1;
GO
RECONFIGURE;
GO

输出:

Configuration option ‘remote admin connections‘ changed from 0 to 1. Run the RECONFIGURE statement to install.

然后开启SQL Server Browser服务,防火墙允许TCP 1434端口的访问。

我们通过另一台服务器上的SSMS建立DAC查询连接,选择File菜单,下拉菜单选择“New”、“Database Engine Query”。

输入域名或IP即可。

DAC在SSMS连接时,只能通过建立查询窗口的方式打开。当SQL Server因系统资源不足,或其它异常导致无法建立数据库连接时, 可以使用系统预留的DAC连接到数据库,进行一些问题诊断和故障排除。DAC只能使用有限的资源。请勿使用DAC运行需要消耗大量资源的查询,否则可能发生严重的阻塞。

另一种打开方式是在命令行界面通过SqlCMD使用特殊的管理员开关(-A),提供对DAC的支持。

本地DAC连接:

远程DAC连接:

《SQL Server 2012 Internals》有这么一段话:

SQL Server maintains a set of tables that store information about all objects, data types, constraints,confguration options, and resources available to SQL Server. In SQL Server 2012, these tables are called the system base tables. Some of the system base tables exist only in the master database and contain system-wide information; others exist in every database (including master) and contain information about the objects and resources belonging to that particular database. Beginning with SQL Server 2005, the system base tables aren’t always visible by default, in master or any other database. You won’t see them when you expand the tables node in the Object Explorer in SQL Server Management Studio, and unless you are a system administrator, you won’t see them when you execute the sp_help system procedure. If you log on as a system administrator and select from the catalog view called sys.objects (discussed shortly), you can see the names of all the system tables. For example, the following query returns 74 rows of output on my SQL Server 2012 instance:

USE master;

SELECT name FROM sys.objects

WHERE type_desc = ‘SYSTEM_TABLE‘;

But even as a system administrator, if you try to select data from one of the tables returned by the preceding query, you get a 208 error, indicating that the object name is invalid. The only way to see the data in the system base tables is to make a connection using the dedicated administrator connection (DAC), which Chapter 2, “The SQLOS,” explains in the section titled “The scheduler.” Keep in mind that the system base tables are used for internal purposes only within the Database Engine and aren’t intended for general use. They are subject to change, and compatibility isn’t guaranteed. In SQL Server 2012, three types of system metadata objects are intended for general use: Compatibility Views, Catalog Views, and Dynamic Management Objects.

例如,在SSMS中连接普通查询连接,输入:

SELECT * FROM sys.sysrmtlgns;

输出:

Msg 208, Level 16, State 1, Line 1

Invalid object name ‘sys.sysrmtlgns‘.

建立DAC连接,输入:

SELECT net_transport,auth_scheme,client_net_address FROM sys.dm_exec_connections WHERE [email protected]@spid;
SELECT * FROM sys.sysrmtlgns;
SELECT * FROM sys.syslnklgns;

时间: 2024-04-28 15:31:19

SQL Server专用管理员连接(Dedicated Admin Connection(DAC))的相关文章

SQL Server ->> DAC(Dedicated Administrator Connection)专用管理员连接

专用管理员连接是一种特殊的SQL Server服务器诊断性质的连接,用于在正常或者说标准连接形式无法连接SQL Server服务器的情况下连接到服务器进行服务器性能或者错误诊断.DAC同样支持安全加密而且只能是sysadmin服务器角色组的成员才有权限使用DAC.默认情况是不允许从服务器以外的客户端开启DAC连接的,除非以及通过sp_configure设置了允许remote admin connections.DAC的监听端口是1434. 通过SSMS使用DAC 在输入服务器名字的时候在服务器实

启用SQL Server 2008的专用管理员连接(DAC)

参考:http://technet.microsoft.com/zh-cn/library/ms178068(v=SQL.105).aspx 问题: 一个在我们公司实习的DBA向我询问如何开启SQL Server 2008的DAC.起初我想直接告诉他,但更明智的选择是将文档选项共享.本文将向你讲述如何在SQL Server 2008中打开DAC. 解决方案: 微软在SQL Server 2005中添加了DAC新特性.数据库管理员可以在数据库无法响应正常连接时使用该特性连接数据库.连接以后,DBA

9.4 专用管理员连接

9.4  专用管理员连接 9.4.1 专用管理员连接的概念 在 SQL Server 不再响应标准的连接请求时,管理员需要执行诊断查询并解决问题,但是此时已经无法通过普通的连接请求访问 SQL Server. SQL Server 提供了专用管理员连接(Dedicated Administrator Connection,简称 DAC).即使服务器对其他客户端连接停止响应,管理员也可以使用 DAC 访问正在运行的 SQL Server 数据库引擎实例来排除服务器上的故障.SQL Server 尽

处于同一域中的两台SQL Server 实例无法连接

处于同一个域中的两台Sql server 实例无法连接,报的错误信息如下: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is

问题:sqlserver 跨服务器连接;结果:Sql Server 跨服务器连接

Sql Server 跨服务器连接 用openrowset连接远程SQL或插入数据 --如果只是临时访问,可以直接用openrowset --查询示例 select * from openrowset('SQLOLEDB', 'sql服务器名'; '用户名'; '密码', 数据库名.dbo.表名) --导入示例 select * into 表 from openrowset('SQLOLEDB' ,'sql服务器名';'用户名';'密码' ,数据库名.dbo.表名) --创建链接服务器 exec

处于同一个域中的两台Sql server 实例无法连接

处于同一个域中的两台Sql server 实例无法连接,报的错误信息如下: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is

驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接

由于项目中必须得用JDK6来作为Java环境,于是连接SQLServer时出现了com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接.错误:"Java.lang.RuntimeException: Could not generate DH keypair".这样的错误. 这个在JDK7中是修复了的,所以如果项目允许的话就换成JDK7吧,但有些只能用JDK6

C# 连接SQL Server数据库的连接字符串<转>

C#连接SQL Server数据库的连接字符串,我们一个一个参数来介绍(注意:参数间用分号分隔): “user id=sa”:连接数据库的验证用户名为sa.他还有一个别名“uid”,所以这句我们还可以写成“uid=sa”. “password=”:连接数据库的验证密码为空.他的别名为“pwd”,所以我们可以写为“pwd=”. 这里注意,你的SQL Server必须已经设置了需要用户名和密码来登录,否则不能用这样的方式来登录.如果你的SQL Server设置为Windows登录,那么在这里就不需要

SQL Server本地管理员和sa都无法访问的解决方案

SQL Server本地管理员和sa都无法访问的解决方案 问题描述: 安装SQL Server的时候,没有添加正确的SQL Server本地管理员账号,并且忘记启用混合验证模式.导致通过SQL Server本地管理员和sa都无法访问. 解决方案: 步骤1:用服务器本地管理员账号MachineName\Administrator登录,停止SQL Server服务(无需修改服务启动账号). 步骤2:修改SQL Server服务的启动参数,在原来的启动参数后面加上";-m"(不要带双引号),