Author: Cindy Gross | Befriending Dragons

  • SQL Server lifecycle and the compatibility level settings

    I’ve had several people ask how the compatibility mode/level fits in with the SQL Server lifecycle. For example, the question might be: once we no longer support SQL Server 2000, does that mean we don’t support databases restored/attached to later versions of SQL and still set to 80 compatibility mode for example? The answer is that each version of SQL Server has a set of compatibility levels it supports. That support does not change based on the lifecycle. So for example, SQL Server 2008 R2 supports compatibility levels 80 (SQL 2000), 90 (SQL 2005), and 100 (SQL 2008). When you restore a SQL Server 2000 database to SQL Server 2008 R2 it remains in 80 compatibility mode until you issue ALTER DATABASE {dbname} SET COMPATIBILITY LEVEL = 100 (in older versions use sp_dbcmptlevel). When extended support for SQL Server 2000 ends in 2013, Microsoft will not support SQL Server 2000 any more. But we will still support a database on SQL Server 2008 R2 that is in 80 compatibility mode because that is a supported level/mode for R2. So the lifecycle refers to the actual instance, not the database level.

    I want to add some information here that a lot of people don’t understand. The compatibility level affects only some of the behavior of that database, mostly related to syntax and available features. A database set to 80 compatibility on SQL Server 2008 R2 is NOT the same as a database actually running on SQL Server 2000. For example, you can NOT restore the 2008 R2 80 compatibility mode database back to a 2000 instance. The optimizer is the 2008 R2 optimizer, not the 2000 optimizer. The compatibility mode/level is meant to be a temporary workaround while you fix syntax or keyword issues.

  • New SQL Server Setup Portal is Live!

    There’s a new setup portal to help you out with any SQL Server 2008 or SQL Server 2008 R2 setup issues. You can search for setup content, get downloads, watch videos and more. Learn how to slipstream (new in SQL 2008 SP1) or sysprep (new in R2). Check it out and let us know what you think!

    SQL Server Setup http://technet.microsoft.com/en-us/sqlserver/ff625277.aspx

  • No new certifications for SQL 2008 R2

    Some of you may be wondering if you should get the SQL Server 2008 certifications or wait for new SQL Server 2008 R2 certifications. There’s no point in waiting, because there will not be any new exams for R2. See the blog below for the reasons why. If you want to get a SQL Server certification, go ahead and prepare for the SQL Server 2008 exams.

    Why the SQL Server 2008 Certifications Don’t Cover R2 http://blogs.msdn.com/gerryo/archive/2010/05/03/why-the-sql-server-2008-certifications-don-t-cover-r2.aspx

    SQL Server Certification
    http://www.microsoft.com/learning/en/us/certification/cert-sql-server.aspx#tab1

    Levels/types of certification, each having a prerequisite of the one before it.

    ·         MCTS = Pass one test in a given technology area http://www.microsoft.com/learning/en/us/certification/cert-sql-server.aspx#tab2

    ·         MCITP = Pass one or more tests that relate to a skill area within a product. For SQL Server the three MCITP options are Administrator, Developer, or BI. http://www.microsoft.com/learning/en/us/certification/cert-sql-server.aspx#tab3

    ·         MCM/Master = Pass 3 tests and a lab exercise as part of 3 weeks of rigorous training http://www.microsoft.com/learning/en/us/certification/cert-sql-server.aspx#tab5

    For a nice visual representation, see http://download.microsoft.com/download/6/3/7/6370c653-e270-4e23-9685-15043f63dcce/SQLServer2008_CertPath_Complete.pdf

    Click through on any exam listed in the above links for details on what to study for each exam. Start on the “Microsoft Certified Technology Specialist” tab as those exams are prerequisites for MCITP.

    For example, you may wish to take the Database Development exam for SQL 2008 (70-433). http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-433&locale=en-us. Click on Skills Measured for areas to practice/study. Click on Preparation Materials for potential classes, books, practice tests, and more. SQL BOL and blogs are also good prep tools. Let me know which areas you want to learn more about and I can either explain them directly and/or offer links to good study material.

  • DMV series: sys.dm_db_partition_stats

    DMV: sys.dm_db_partition_stats

     

    This DMV returns information for the current database context. It can tell you how many rows are in each table (per partition) and how much of the space is used and reserved for in-row, overflow, and LOB data (with or without the metadata overhead).

     

    Remember that the stored count information was not always 100% accurate in SQL Server 2000. For a new table created on 2005 the counts will be accurate. But for a table that existed in 2000 and now resides on 2005 through a restore or update, you need to run (only once after the move to 2005) either sp_spaceused @updateusage = N’true’ or DBCC UPDATEUSAGE with the COUNT_ROWS option.

     

    Regarding performance with LOB (text, image, XML, max) or overflow (variable length) data: You can end up with “extra” IOs and more page allocations/deallocations, which can potentially make performance worse. They are also processed synchronously which can slow down joins and sorts. If a column is indexed its data cannot be pushed offrow.

    ·         Row-Overflow Data Exceeding 8 KB http://msdn.microsoft.com/en-us/library/ms186981.aspx
    Surpassing the 8,060-byte row-size limit might affect performance because SQL Server still maintains a limit of 8 KB per page. When a combination of varchar, nvarchar, varbinary, sql_variant, or CLR user-defined type columns exceeds this limit, the SQL Server Database Engine moves the record column with the largest width to another page in the ROW_OVERFLOW_DATA allocation unit, while maintaining a 24-byte pointer on the original page. Moving large records to another page occurs dynamically as records are lengthened based on update operations.

     

    SQL 2000 did support storing LOBs (text, image) offrow, but it had no concept of overflow rows for variable length data types. If the actual length of a row with variable length data types would exceed 8060 bytes the insert or update would fail. In 2005+ the data over 8060 bytes is moved offrow, leaving behind a 24 byte pointer.

    ·         Row Size limitation in SQL 2000 and 2005 http://blogs.msdn.com/msdnts/archive/2006/12/01/row-size-limitation-in-sql-2000-and-2005.aspx

    ·         Stretching the 8K Row Limit  http://www.sqlmag.com/Articles/ArticleID/50490/50490.html?Ad=1

     

    Sample Queries

    — DMV: sys.dm_db_partition_stats
    — Returns information for the current database
    — Key data: row count per partition, pages of in-row, overflow, and LOB data, used vs reserved pages
    — Common join objects: sys.allocation_units, sys.partitions, sys.indexes
    — A table with no explicit partitions has partition_number=1
    — Permission needed: VIEW DATABASE STATE

    USE AdventureWorks

    /*
    — For any databases upgraded or restored from SQL 2000, you have to update the count info once
    EXEC sp_spaceused @updateusage = N’true’
    DBCC UPDATEUSAGE (0) WITH COUNT_ROWS — 0 = current db
    */

    — Run the CLEANUP section when you have finished exploring the DMV

    /*
    — show that you have to account for the schema too (since table has same name as Person.Address)
    — show how to force a row into LOB_DATA
    — start with inserting just one row and run all the select queries
    — then insert the LOB row and run the selects
    — then run the overflow insert and run the selects
    — DROP TABLE dbo.Address
    CREATE TABLE dbo.Address (col1 varchar(max), col2 varchar(max), col3 nvarchar(4000), col4 nvarchar(4000), col5 nvarchar(4000));
    INSERT dbo.Address VALUES (‘a’, ‘b’, ‘c’, ‘d’, ‘e’); — no overflow
    INSERT dbo.Address VALUES (REPLICATE (‘a’, 8000),REPLICATE (‘b’, 8000), NULL, NULL, NULL); — LOB_DATA
    INSERT dbo.Address VALUES (NULL, NULL, REPLICATE (‘a’, 4000),REPLICATE (‘b’, 4000),REPLICATE (‘c’, 4000)); — overflow
    –SELECT DATALENGTH(col1), DATALENGTH(col2), DATALENGTH(col3), DATALENGTH(col4), DATALENGTH(col5),* FROM dbo.Address

    — add a table with partitions
    DROP TABLE a1
    DROP PARTITION SCHEME myRangePS1
    DROP PARTITION FUNCTION myRangePF1

    CREATE PARTITION FUNCTION myRangePF1 (int)
    AS RANGE LEFT FOR VALUES (1, 100, 1000);
    GO
    CREATE PARTITION SCHEME myRangePS1
    AS PARTITION myRangePF1
    TO (‘primary’, ‘primary’, ‘primary’, ‘primary’);
    GO
    CREATE TABLE a1
    (col1 int) ON myRangePS1 (col1)
    GO
    INSERT a1 VALUES (1)
    INSERT a1 VALUES (10)
    INSERT a1 VALUES (101)
    INSERT a1 VALUES (1001)
    */

    — Simple query with no joins or attempt to get the true count per table
    — Note that it returns multiple rows per table when there are multiple indexes, these row counts should NOT be added together
    — It also returns multiple rows per table when the table is partitioned, these DO need to be added together
    SELECT ps.row_count, OBJECT_SCHEMA_NAME(ps.object_id) AS SchemaName, OBJECT_NAME(ps.object_id) AS ObjectName, ps.index_id, ps.partition_number
    , *
    FROM sys.dm_db_partition_stats ps
    ORDER BY OBJECT_NAME(ps.object_id), OBJECT_SCHEMA_NAME(ps.object_id)

    — Still doesn’t take into account how to SUM the rows
    — Shows the most interesting columns and calculates the total size
    — You could use the “used” or “data page” columns instead of the “reserved” columns, explore this on your own
    SELECT ps.row_count, OBJECT_SCHEMA_NAME(ps.object_id) AS SchemaName, OBJECT_NAME(ps.object_id) AS ObjectName, ps.index_id, ps.partition_number
    , au.type_desc, au.total_pages AS TotalPages, au.total_pages * 8 /*8k pages*/ /1024 /*1024k per mb*/ AS TotalMB
    FROM sys.dm_db_partition_stats ps
    JOIN sys.allocation_units au ON ps.partition_id = au.container_id
    ORDER BY OBJECT_NAME(ps.object_id), OBJECT_SCHEMA_NAME(ps.object_id)
    — do not order by size or pages as we haven’t done a group by to add partitions together

    — Query from http://sqlblog.com/blogs/louis_davidson/archive/2007/07/11/sys-dm-db-partition-stats.aspx
    — “Get rowcount of tables. Note that I grouped on the object_id, because for a partitioned table,
    — you need to add all of the rows in all partitions.”
    select object_name(dm_db_partition_stats.object_id),
    sum(dm_db_partition_stats.row_count) as row_count
    from sys.dm_db_partition_stats
    join sys.indexes
    on indexes.object_id = dm_db_partition_stats.object_id
    and indexes.index_id = dm_db_partition_stats.index_id
    where indexes.type_desc in (‘CLUSTERED’,’HEAP’)
    group by dm_db_partition_stats.object_id

    — total rowcount as modified by cgross
    SELECT OBJECT_SCHEMA_NAME(ps.object_id) AS SchemaName, OBJECT_NAME(ps.object_id) AS ObjectName,
    SUM(ps.row_count) AS row_count
    FROM sys.dm_db_partition_stats ps
    JOIN sys.indexes i
    ON i.object_id = ps.object_id
    AND i.index_id = ps.index_id
    WHERE i.type_desc IN (‘CLUSTERED’,’HEAP’)
    AND OBJECT_SCHEMA_NAME(ps.object_id) <> ‘sys’
    GROUP BY ps.object_id
    ORDER BY OBJECT_NAME(ps.object_id), OBJECT_SCHEMA_NAME(ps.object_id)

    — rowcount plus inrow, LOB, overflow info
    — reserved info includes allocated data, index data, metadata
    SELECT OBJECT_SCHEMA_NAME(ps.object_id) AS SchemaName, OBJECT_NAME(ps.object_id) AS ObjectName,
    SUM(ps.row_count) AS row_count,
    SUM(ps.in_row_reserved_page_count) AS InRowReservedPgs,
    SUM(ps.lob_reserved_page_count) AS LOBReservedPgs,
    SUM(ps.row_overflow_reserved_page_count) AS OverflowReservedPgs,
    SUM(ps.reserved_page_count) AS TotalReservedPgs
    FROM sys.dm_db_partition_stats ps
    JOIN sys.indexes i
    ON i.object_id = ps.object_id
    AND i.index_id = ps.index_id
    WHERE i.type_desc IN (‘CLUSTERED’,’HEAP’)
    AND OBJECT_SCHEMA_NAME(ps.object_id) <> ‘sys’
    GROUP BY ps.object_id
    ORDER BY OBJECT_NAME(ps.object_id), OBJECT_SCHEMA_NAME(ps.object_id)

    /*
    — Per BOL “The container ID has a one-to-one mapping to the partition_id in the sys.partitions catalog view that maintains the relationship between the table, index, or the indexed view data stored in a partition and the allocation units used to manage the data within the partition. ”
    — more info on sys.allocation_units in http://www.sqlmag.com/articles/index.cfm?articleid=50257&pg=2
    SELECT * FROM sys.allocation_units
    — WHERE allocation_unit_id = 72057594042974208 OR container_id = 72057594042974208 — partition_id of Address table
    WHERE container_id IN (72057594043957248,72057594038321152) — two partition_ids for databaselog

    — Per BOL “The sys.system_internals_allocation_units system view is reserved for Microsoft SQL Server internal use only. Future compatibility not guaranteed.”
    SELECT * FROM sys.system_internals_allocation_units
    WHERE allocation_unit_id = 72057594042974208 OR container_id = 72057594042974208 — partition_id of Address table
    */

    /*
    References and explanations:
    sys.dm_db_partition_stats (Transact-SQL) http://msdn.microsoft.com/en-us/library/ms187737.aspx
    Diving In to Object-Storage Metadata http://www.sqlmag.com/articles/index.cfm?articleid=50257&pg=2

    — UpdateUsage
    Remember that the stored count information was not always 100% accurate in SQL Server 2000.
    For a new table created on 2005 the counts will be accurate.
    But for a table that existed in 2000 and now resides on 2005 through a restore or update,
    you need to run (only once after the move to 2005) either sp_spaceused @updateusage = N’true’ or
    DBCC UPDATEUSAGE with the COUNT_ROWS option.

    — Performance
    Performance can potentially be worse with LOB (text, image, XML, max) or overflow (variable length) data.
    You can end up with “extra” IOs and more page allocations/deallocations, which can potentially make
    performance worse. They are also processed synchronously which can slow down joins and sorts.
    If a column is indexed its data cannot be pushed offrow.
    • Row-Overflow Data Exceeding 8 KB http://msdn.microsoft.com/en-us/library/ms186981.aspx
    Surpassing the 8,060-byte row-size limit might affect performance because SQL Server still maintains a limit of 8 KB per page. When a combination of varchar, nvarchar, varbinary, sql_variant, or CLR user-defined type columns exceeds this limit, the SQL Server Database Engine moves the record column with the largest width to another page in the ROW_OVERFLOW_DATA allocation unit, while maintaining a 24-byte pointer on the original page. Moving large records to another page occurs dynamically as records are lengthened based on update operations.

    — SQL 2000
    SQL 2000 did support storing LOBs (text, image) offrow, but it had no concept of overflow rows for variable length data types. If the actual length of a row with variable length data types would exceed 8060 bytes the insert or update would fail. In 2005+ the data over 8060 bytes is moved offrow, leaving behind a 24 byte pointer.
    • Row Size limitation in SQL 2000 and 2005 http://blogs.msdn.com/msdnts/archive/2006/12/01/row-size-limitation-in-sql-2000-and-2005.aspx
    • Stretching the 8K Row Limit  http://www.sqlmag.com/Articles/ArticleID/50490/50490.html?Ad=1
    */

    /*
    –CLEANUP
    DROP TABLE a1
    DROP PARTITION SCHEME myRangePS1
    DROP PARTITION FUNCTION myRangePF1
    DROP TABLE dbo.Address
    */

  • Moving data between 32-bit and 64-bit SQL Server instances

    I was recently asked about whether SQL Server data can move between architectures, say from x64 to x86.

     

     

    Yes, you can move SQL Server data back and forth between x64, x86, and IA64 architectures. The data and log files themselves do not store anything that indicates the architecture and work the same on either 32-bit or 64-bit. The same applies to the backup files. Given those facts it becomes clear that we can easily move data between architectures. You can backup on x86 and restore to x64. Detach/attach works fine. Log shipping works because it is basically backup/restore with some scheduling. Mirroring and transactional replication take data from the transaction log and push the data to another system so again they work across architectures. Merge replication is basically just another application sitting on top of SQL Server, it moves data by reading tables in one location and modifying data in another location. Again, this can all be done across architectures.

     

    Hopefully you are not installing new x86 boxes, 64-bit handles memory so much better. If you have legacy x86 boxes you can easily do a backup or detach from that old system and restore or attach on the new x64 instance. You can also reverse the process and copy data from x64 back to x86. The same logic applies to the other technologies listed above.

     

    Per BOL (I used the SQL 2008 R2 version):

    ·         The SQL Server on-disk storage format is the same in the 64-bit and 32-bit environments. Therefore, a database mirroring session can combine server instances that run in a 32-bit environment and server instances that run in a 64-bit environment.

    ·         Because the SQL Server on-disk storage format is the same in the 64-bit and 32-bit environments, a replication topology can combine server instances that run in a 32-bit environment and server instances that run in a 64-bit environment.

    ·         The SQL Server on-disk storage format is the same in the 64-bit and 32-bit environments. Therefore, a log shipping configuration can combine server instances that run in a 32-bit environment and server instances that run in a 64-bit environment.

     

    If you’re doing SAN level replication you’ll need to talk to your SAN vendor about their support across platforms.

     

    Some x64 info:

    http://blogs.msdn.com/cindygross/archive/tags/x64/default.aspx

  • SQL Server Performance Tools – Boise Code Camp Presentation

    Today I am presenting about SQL Server Performance Tools at the Boise Code Camp. You can download the slides and supporting files here on this blog (at the bottom it says Attachment(s): PerformanceTools.zip ). The basic agenda of items covered is:

     

    ¢  Methodology

    ¢  SQLDiag

    ¢  PSSDiag

    ¢  SQLNexus

    ¢  Profiler

    ¢  PerfMon

    ¢  References

    The perfstats script I discussed can be found at:
    And the perfstats analysis tools are at:

    PerformanceTools.zip

  • What do those “IO requests taking longer than 15 seconds” messages on my SQL box mean?

    You may be sometimes seeing stuck/stalled IO messages on one or more of your SQL Server boxes. This is something it is important to understand so I am providing some background information on it.

     

    Here is the message you may see in the SQL error log:

    SQL Server has encountered xxx occurrence(s) of IO requests taking longer than 15 seconds to complete on file [mdf_or_ldf_file_path_name] in database [dbname] (dbid). The OS file handle is 0x…. The offset of the latest long IO is: 0x….”.

     

    The message indicates that SQL Server has been waiting on at least one I/O for 15 seconds or longer. The exact number of times you have exceeded this time for the specified file since the last message is included in the message. The messages will not be written more than once every five minutes. Keep in mind that read IOs on an average system should take no more than 10-20ms and writes should take no more than 3-5ms (the exact acceptable values vary depending on your business needs and technical configuration). So anything measured in seconds indicates a serious performance problem. The problem is NOT within SQL Server, this message indicates SQL has sent off an IO request and has waited more than 15 seconds for a response. The problem is somewhere in the disk IO subsystem. For example, the disk IO subsystem may have more load than it is designed to handle, there is a “bad” hardware or firmware somewhere along the path, filter drivers such as anti-virus software are interfering, your file layout is not optimal, or some IO subsystem setting such as HBA queue depth is not set optimally.

     

    Though the root cause is IO, you can see other symptoms that are a side effect and may lead you down the wrong troubleshooting path. For example, if enough IO is backed up behind the stalled IO then you may see blocking in SQL Server (because locks that are usually taken for very short periods of time are now held for seconds), new connections may not be allowed, and the CPU usage can increase (because many threads are waiting), and a clustered SQL Server can fail over (because the IsAlive checks which are just SQL queries fail to complete like all the other queued queries). You may see other errors returned to the user or in the various logs, such as timeouts.

     

    There are two ways to approach this problem. You can either reduce the IO on the system (change indexes or queries or archive data for example) or you can make the underlying system able to handle the IO load (fix hardware/firmware problems, change configurations, add disks or controllers, change the file layout, etc.).

     

    Background:

    ·         897284  Diagnostics in SQL Server 2000 SP4 and in later versions help detect stalled and stuck I/O operations

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;897284

    ·         Detecting and Resolving Stalled and Stuck I/O Issues in SQL Server 2000 SP 4 http://msdn.microsoft.com/en-us/library/aa175396(SQL.80).aspx

     

    Troubleshooting:

    ·         Every Windows 2003 SP1 or SP2 system should have this storport fix: 941276  A Windows Server 2003-based computer stops responding when the system is under a heavy load and when the Storport driver is being used http://support.microsoft.com/default.aspx?scid=kb;EN-US;941276

    ·         Use PerfMon to look at the disk counters for sec/read, sec/write, bytes/sec, current disk queue length, reads/sec, writes/sec

    ·         Collect data from sys.dm_io_virtual_file_stats and sys.dm_io_pending_io_requests.

    ·         Ask your storage admins to monitor the entire IO subsystem from the Windows system all the way through to the underlying disks.

  • How to Rename SQL Server

    How to rename a SQL Server varies a bit depending on the SQL version, whether it is clustered or not, and whether you want to rename the server/virtual server part of the name (works except for SQL 2000 clusters) or the instance part of the name (requires a reinstall). Also, you do not want to try renaming a server involved in replication as it will break replication (you have to drop/recreate all replication after a rename), and there are extra steps if mirroring is involved (stop mirroring before the rename, change configuration after). Be very careful to include the keyword “local” in the sp_addserver part of the steps (applies only to stand alone systems) and check @@SERVERNAME afterwards to make sure you have completed the steps correctly.

     

    SQL 2008:

    ·         How to: Rename a SQL Server Failover Cluster Instance http://msdn.microsoft.com/en-us/library/ms178083.aspx

    ·         How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server http://msdn.microsoft.com/en-us/library/ms143799.aspx

     

    SQL 2005:

    ·         How to: Rename a SQL Server 2005 Virtual Server http://msdn.microsoft.com/en-us/library/ms178083(SQL.90).aspx

    ·         How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server 2005 http://msdn.microsoft.com/en-us/library/ms143799(SQL.90).aspx

     

    SQL 2000:

    ·         The SQL Server Network Name resource cannot be renamed http://support.microsoft.com/kb/307336

    ·         Renaming a Server http://msdn.microsoft.com/en-us/library/aa197071(SQL.80).aspx

     

    From the BOL topics we can see that you can NOT rename the instance part of the name in SQL Server 2000, 2005, or 2008:

     

    SQL 2005 cluster:

    “The name of the virtual server is always the same as the name of the SQL Network Name (the SQL Virtual Server Network Name). Although you can change the name of the virtual server, you cannot change the instance name. For example, you can change a virtual server named VS1instance1 to some other name, such as SQL35instance1, but the instance portion of the name, instance1, will remain unchanged.”

     

    SQL 2005 standalone:

    “These steps can be used only to rename the part of the instance name that corresponds to the computer name. For example, you can change a computer named MB1 that hosts an instance of SQL Server named Instance1 to another name, such as MB2. However, the instance portion of the name, Instance1, will remain unchanged. In this example, the \ComputerNameInstanceName would be changed from \MB1Instance1 to \MB2Instance1.”

     

    SQL 2008 cluster:

    “Although you can change the name of the virtual server, you cannot change the instance name. For example, you can change a virtual server named VS1instance1 to some other name, such as SQL35instance1, but the instance portion of the name, instance1, will remain unchanged.”

     

    SQL 2008 standalone:

    “The following steps cannot be used to rename an instance of SQL Server. They can be used only to rename the part of the instance name that corresponds to the computer name. For example, you can change a computer named MB1 that hosts an instance of SQL Server named Instance1 to another name, such as MB2. However, the instance part of the name, Instance1, will remain unchanged. In this example, the \ComputerNameInstanceName would be changed from \MB1Instance1 to \MB2Instance1.”

     

     

  • SQL DAC

    When you start SQL Server (2005+) it creates a separate “Dedicated Administrator Connection” or DAC using a special TCP port. One sysadmin at a time can connect with this DAC connection by specifying Admin:ServerNameInstance. From SQLCMD you can either prefix the server name with Admin: or you can use the /A switch. From SSMS you can use Admin: to make a “Query Editor” connection but you cannot use it in Object Explorer. DAC should only be used when other connection methods fail and you must collect information or think you might be able to kill some SPIDs to improve the situation. On a local connection you can always use DAC (as long as you are a sysadmin and no one else is using it) but for remote connections (and all connections to a cluster are considered remote) you must have enabled remote connections for DAC:

    EXEC sp_configure ‘remote admin connection’, 1

    RECONFIGURE

     

    If you want to see who if anyone is connected using DAC, try this query:

    SELECT dec.local_tcp_port AS DAC_Port, des.login_name AS LoginName, des.nt_domain AS NTDomain,

          des.nt_user_name AS NTUserName, dec.session_id AS SPID,

          dec.connect_time AS ConnectTime, dec.last_read AS LastRead, dec.last_write AS LastWrite,

          des.host_name AS HostName, dec.client_net_address AS ClientIP, des.program_name AS AppName,

          e.state AS EndpointState, e.is_admin_endpoint AS IsAdminEndpoint

          FROM sys.dm_exec_connections dec

          JOIN sys.endpoints e ON e.endpoint_id = dec.endpoint_id

          JOIN sys.dm_exec_sessions des ON des.session_id = dec.session_id

          WHERE e.name = ‘Dedicated Admin Connection’

     

    If you have any Express Editions, you have to use trace flag 7806 to enable DAC for Express.

     

    Using a Dedicated Administrator Connection

    http://msdn.microsoft.com/en-us/library/ms189595.aspx

     

    How to: Use the Dedicated Administrator Connection with SQL Server Management Studio

    http://msdn.microsoft.com/en-us/library/ms178068.aspx

  • Remote Desktop Options

    You probably use remote desktop to connect to your servers or other desktops. You may see Remote Desktop referred to as RDP, RDS, or MSTSC. One common concern is how to resize the remote desktop connection. You can use mstsc.exe to open your connection and pass /f for full screen. You can also pass in the specific pixel count with /w: and /h:. If you have multiple monitors on both the local and remote machines, you can use /span to be able to use both monitors. If you prefer the GUI, when you launch mstsc.exe, click on the options button. On the display tab you have a slider bar of less…more for size. Something else you may find useful is making your local desktop drives available on your RDP session. On the “local resources” tab click on “more” and then check “drives” in the white box. Back on the general tab you can choose to save the current connection settings and use them again.

     

    If you want to see what documented options are available from the command line run mstsc.exe /? and take a look at the popup window. Alternatively you can look at this site: http://technet.microsoft.com/en-us/library/cc753907(WS.10).aspx.

     

    Additional RDP/MSTSC resources:

    ·         Remote Desktop Services (Terminal Services) Team Blog http://blogs.msdn.com/rds/default.aspx

    ·         Remote Desktop scripting http://blogs.msdn.com/rds/archive/2009/11/04/announcing-the-launch-of-remote-desktop-services-script-center-to-ease-management.aspx,  http://technet.microsoft.com/en-us/scriptcenter/ee364707.aspx

    ·         MSTSC.EXE – no more /console switch in RDC 6.1 http://blogs.technet.com/askperf/archive/2008/01/04/mstsc-exe-no-more-console-switch-in-rdc-6-1.aspx