SQLServer專(zhuān)用管理員連接(DedicatedAdminConnection(DAC))

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(DAC))

創(chuàng)新互聯(lián)專(zhuān)注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、新干網(wǎng)絡(luò)推廣、微信小程序、新干網(wǎng)絡(luò)營(yíng)銷(xiāo)、新干企業(yè)策劃、新干品牌公關(guān)、搜索引擎seo、人物專(zhuān)訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供新干建站搭建服務(wù),24小時(shí)服務(wù)熱線:18980820575,官方網(wǎng)址:bm7419.com

 

只有 SQL Server sysadmin 角色的成員可以使用 DAC 連接。默認(rèn)情況下,只能從服務(wù)器上運(yùn)行的客戶端建立連接。

 

打開(kāi)SSMS,在“Connect to Server”窗口,選擇“Cancel”,然后選擇File菜單,下拉菜單選擇“New”、“Database Engine Query”。

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(DAC))

輸入“admin:.”,點(diǎn)擊“Connect”。

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(DAC))

默認(rèn)不允許使用網(wǎng)絡(luò)連接DAC,需要通過(guò)sp_configure配置“remote admin connections”選項(xiàng)。

 

先來(lái)看看配置的默認(rèn)值:

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

或者

sp_configure 'remote admin connections'

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(DAC))

Value默認(rèn)為0,指明僅允許本地連接使用 DAC。Maximum為1,表明只運(yùn)行一個(gè)遠(yuǎn)程管理連接。

 

--啟用遠(yuǎn)程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.

 

然后開(kāi)啟SQL Server Browser服務(wù),防火墻允許TCP 1434端口的訪問(wèn)。

我們通過(guò)另一臺(tái)服務(wù)器上的SSMS建立DAC查詢連接,選擇File菜單,下拉菜單選擇“New”、“Database Engine Query”。

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(DAC))

輸入域名或IP即可。

 

DAC在SSMS連接時(shí),只能通過(guò)建立查詢窗口的方式打開(kāi)。當(dāng)SQL Server因系統(tǒng)資源不足,或其它異常導(dǎo)致無(wú)法建立數(shù)據(jù)庫(kù)連接時(shí), 可以使用系統(tǒng)預(yù)留的DAC連接到數(shù)據(jù)庫(kù),進(jìn)行一些問(wèn)題診斷和故障排除。DAC只能使用有限的資源。請(qǐng)勿使用DAC運(yùn)行需要消耗大量資源的查詢,否則可能發(fā)生嚴(yán)重的阻塞。

 

另一種打開(kāi)方式是在命令行界面通過(guò)SqlCMD使用特殊的管理員開(kāi)關(guān)(-A),提供對(duì)DAC的支持。

 

本地DAC連接:

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(DAC))

遠(yuǎn)程DAC連接:

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(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 session_id=@@spid;
SELECT * FROM sys.sysrmtlgns;
SELECT * FROM sys.syslnklgns;

SQL Server專(zhuān)用管理員連接(Dedicated Admin Connection(DAC))

當(dāng)前名稱(chēng):SQLServer專(zhuān)用管理員連接(DedicatedAdminConnection(DAC))
瀏覽路徑:http://bm7419.com/article48/igodep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、品牌網(wǎng)站建設(shè)、電子商務(wù)、App開(kāi)發(fā)、網(wǎng)站設(shè)計(jì)公司服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作