<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblogcasts.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">sqldbatips.com blog</title><subtitle type="html">Musings on SQL Server from Jasper Smith, SQL Server MVP</subtitle><id>http://sqlblogcasts.com/blogs/sqldbatips/atom.aspx</id><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/default.aspx" /><link rel="self" type="application/atom+xml" href="http://sqlblogcasts.com/blogs/sqldbatips/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.20917.1142">Community Server</generator><updated>2008-05-21T12:43:00Z</updated><entry><title>Updated build of ExpressMaint utility now available</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/07/04/updated-build-of-expressmaint-utility-now-available.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/07/04/updated-build-of-expressmaint-utility-now-available.aspx</id><published>2008-07-04T10:34:00Z</published><updated>2008-07-04T10:34:00Z</updated><content type="html">&lt;p&gt;An updated version (1.5.0.0) of the ExpressMaint utility for automating database maintenance operations for SQL 2005 Express Edition is now available. This new version includes the following additions and fixes&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Added 2 new database operation types for updating database statistics&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Added new switch to allow multi database operations to continue if one or more databases fail&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Added fix for SMO Index Reorganise bug (&lt;a class="" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=339570" target="_blank"&gt;Connect Item 339570&lt;/a&gt;) which caused reorg to fail when indexes had non default fill factor&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;a class="" href="http://www.sqldbatips.com/showarticle.asp?ID=29" target="_blank"&gt;Download Latest Version and View Updated usage notes from sqldbatips.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://www.codeplex.com/ExpressMaint" target="_blank"&gt;Download Source Code from Codeplex&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10581" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="SQL Tools" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+Tools/default.aspx" /></entry><entry><title>Updated Release of SQL 2005 Service Manager for Vista now available</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/07/02/Release-2.0.0.5-of-SQL-2005-Service-Manager-for-Vista-.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/07/02/Release-2.0.0.5-of-SQL-2005-Service-Manager-for-Vista-.aspx</id><published>2008-07-02T14:00:00Z</published><updated>2008-07-02T14:00:00Z</updated><content type="html">&lt;p&gt;A new build of SQL 2005 Service Manager is now available for Windows&amp;nbsp;Vista (2.0.0.5). This releases adds compatability for SQL 2008 RC0 and filters the SQL Agent service from being managed for SQL 2008 Express Edition (see why &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/28/sql-server-2008-express-installs-sql-agent-but-don-t-bother-trying-to-start-it.aspx"&gt;here&lt;/a&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;&lt;a class="" title="Download SQL 2005 Service Manager" href="http://www.sqldbatips.com/showarticle.asp?ID=46" target="_blank"&gt;&lt;font color="#009933"&gt;Download SQL 2005 Service Manager from sqldbatips.com&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;a class="" href="http://www.codeplex.com/SQL2005SrvcMngr/Release/ProjectReleases.aspx?ReleaseId=14939" target="_blank"&gt;&lt;font color="#009933"&gt;Download SQL 2005 Service Manager from Codeplex&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10564" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="SQL Tools" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+Tools/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>Enabling Hyper-V on Dell XPS Laptop</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/07/02/enabling-hyper-v-on-dell-xps-laptop.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/07/02/enabling-hyper-v-on-dell-xps-laptop.aspx</id><published>2008-07-02T12:08:00Z</published><updated>2008-07-02T12:08:00Z</updated><content type="html">&lt;p&gt;Now that Hyper-V is RTM (download update&amp;nbsp;&lt;a class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3AB3D4B-63C8-4424-A738-BADED34D24ED&amp;amp;displaylang=en" target="_blank"&gt;here&lt;/a&gt;) I figured I&amp;#39;d take the plunge and dual boot my laptop by installing a Windows 2008 x64 partition. All went well and I installed the Hyper-V role and the RTM update. When it came to starting up a VM however I found that it wouldn&amp;#39;t start because the Intel-VT extensions were not enabled (they are Off by default). After quite a few scans through the BIOS settings I finally found the correct option (it&amp;#39;s under &lt;strong&gt;POST Behavior&lt;/strong&gt; which to me seems to be not very intuitive!). The instructions for enabling the required hardware settings for Hyper-V are below (Dell XPS M1730 with A06 BIOS)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Boot into Setup (&lt;strong&gt;F2&lt;/strong&gt;)&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Navigate to &lt;strong&gt;Security&amp;gt;CPU XD Support&lt;/strong&gt; and ensure it is Enabled (it is &lt;strong&gt;Enabled&lt;/strong&gt; by default)&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Navigate to &lt;strong&gt;POST Behavior&amp;gt;Virtualization&lt;/strong&gt; and ensure it is Enabled (it is&amp;nbsp;&lt;strong&gt;Off&lt;/strong&gt; by default)&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Hope this helps, it took me a while to find this and searching google didn&amp;#39;t help (in fact most of the dell forum posts seemed to indicate it required a BIOS update past A06 or wasn&amp;#39;t possible). &lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10565" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Windows 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Windows+2008/default.aspx" /><category term="Hyper-V" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Hyper-V/default.aspx" /><category term="Virtualization" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Virtualization/default.aspx" /></entry><entry><title>Updated Release of SQL 2005 Service Manager now available</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/30/updated-release-of-sql-2005-service-manager-now-available.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/30/updated-release-of-sql-2005-service-manager-now-available.aspx</id><published>2008-06-30T08:48:00Z</published><updated>2008-06-30T08:48:00Z</updated><content type="html">&lt;p&gt;A new build of SQL 2005 Service Manager is now available for XP, Windows 2003 and Windows 2008 (1.0.0.13). This releases adds compatability for SQL 2008 RC0 and filters the SQL Agent service from being managed for SQL 2008 Express Edition (see why &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/28/sql-server-2008-express-installs-sql-agent-but-don-t-bother-trying-to-start-it.aspx"&gt;here&lt;/a&gt;). Updated sourcecode is available from the Codeplex site. A new build for Vista will be available shortly.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;&lt;a class="" title="Download SQL 2005 Service Manager" href="http://www.sqldbatips.com/showarticle.asp?ID=46" target="_blank"&gt;&lt;font color="#009933"&gt;Download SQL 2005 Service Manager from sqldbatips.com&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;a class="" title="Download SQL 2005 Service Manager from Codeplex" href="http://www.codeplex.com/SQL2005SrvcMngr/Release/ProjectReleases.aspx?ReleaseId=14936" target="_blank"&gt;&lt;font color="#009933"&gt;Download SQL 2005 Service Manager from Codeplex&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10562" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="SQL Tools" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+Tools/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>SQL Server 2008 Express installs SQL Agent (but don't bother trying to start it)</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/28/sql-server-2008-express-installs-sql-agent-but-don-t-bother-trying-to-start-it.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/28/sql-server-2008-express-installs-sql-agent-but-don-t-bother-trying-to-start-it.aspx</id><published>2008-06-28T09:00:00Z</published><updated>2008-06-28T09:00:00Z</updated><content type="html">&lt;p&gt;If you have installed either of the Express Editions available in the &lt;a class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=35F53843-03F7-4ED5-8142-24A4C024CA05&amp;amp;displaylang=en" target="_blank"&gt;SQL Server 2008 RC0 download&lt;/a&gt; you may have noticed that as well as the SQL Server service for the Express instance, setup also installs the SQL Agent service. Great news you might think but no, &lt;em&gt;&lt;strong&gt;the service is installed in a disabled state and will error if you try and start it manually&lt;/strong&gt;&lt;/em&gt;. This is a change in behaviour from SQL 2005 Express Edition which did not create the SQL Agent service (or even include sqlagent.exe) and is far from ideal and may be comfusing to customers as confirmed by Microsoft in my &lt;a class="" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=351806" target="_blank"&gt;Connect Bug&lt;/a&gt; for this issue however it also &lt;u&gt;&lt;em&gt;won&amp;#39;t&lt;/em&gt;&lt;/u&gt; be fixed in SQL 2008.&lt;/p&gt;
&lt;p&gt;Why do I care (a) because I think its confusing for customers and (b) because I maintain the &lt;a class="" href="http://www.codeplex.com/SQL2005SrvcMngr" target="_blank"&gt;SQL 2005 Service Manager&lt;/a&gt; tool on Codeplex which despite its name does support SQL 2008 and this makes my life more difficult because I now have to check the instance editions and filter out SQL agent for 2008 Express instances (so for totally selfish reasons then!). Along with the reappearance of the FTS service under a new name in RC0 it&amp;#39;s making adding SQL 2008 compatability more painful than I had hoped :-)&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10554" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>Workaround for Audit issue when targetting the Security Log in SQL 2008 RC0</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/workaround-for-audit-issue-when-targetting-the-security-log-in-sql-2008-rc0.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/workaround-for-audit-issue-when-targetting-the-security-log-in-sql-2008-rc0.aspx</id><published>2008-06-27T17:30:00Z</published><updated>2008-06-27T17:30:00Z</updated><content type="html">&lt;p&gt;&lt;span style="COLOR:black;"&gt;In RC0, the registry entry that specifies the message file for audit events that are written to the security&amp;nbsp;event log is incorrect (&lt;a class="" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=352787" target="_blank"&gt;Connect Item 352787&lt;/a&gt;). This means that when viewing audit events written to the security log in Event Viewer you will&amp;nbsp;see the following text in the description (I&amp;#39;m sure you&amp;#39;ve seen these type of messages before!)&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;&lt;em&gt;The description for Event ID ( 33205 ) in Source ( MSSQLSERVER$AUDIT ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event:&lt;/em&gt; &lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;This should be fixed for RTM however to correct this in RC0, open regedit and browse to the following key (the example below is for a default instance, for a named instance the key format is MSSQL$&amp;lt;INSTANCE NAME&amp;gt;$AUDIT)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;&lt;em&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security\MSSQLSERVER$AUDIT&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;If you examine the EventMessageFile value you will notice that the path&amp;nbsp;is similar to the one below (this is for a default instance in the default location, if you installed in a different location or have a named instance then the path will be different)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;&lt;em&gt;C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\&lt;strong&gt;1033\Resources&lt;/strong&gt;\sqlevn70.rll&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;The highlighted section is actually the wrong way round i.e. the path should actually be&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;&lt;em&gt;C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\&lt;strong&gt;Resources\1033&lt;/strong&gt;\sqlevn70.rll&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;Once you have corrected this and restarted the SQL Server service then the spurious messages will no longer be displayed when viewing the audit events in the security event log.&lt;/span&gt;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10531" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Security" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Security/default.aspx" /><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>New in SQL 2008: Server and Database Auditing Part III</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-auditing-part-iii.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="1197" href="http://sqlblogcasts.com/blogs/sqldbatips/attachment/10529.ashx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-auditing-part-iii.aspx</id><published>2008-06-27T17:15:00Z</published><updated>2008-06-27T17:15:00Z</updated><content type="html">&lt;p&gt;In this post I&amp;#39;ll cover how to create Database Audit Specifications to audit database level events. This post is part of a series so if you missed Part I you can find it &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-i.aspx"&gt;&lt;font color="#009933"&gt;here&lt;/font&gt;&lt;/a&gt;&amp;nbsp;and Part II &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-ii.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Database Audit Specification&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Database Audit Specifications define the audit action groups, individual audit actions and filters that you use to audit events at the database level and the Server Audit it belongs to. &lt;em&gt;There can be a maximum of 1 Database Audit Specification per Database per Server Audit&lt;/em&gt;. You can create multiple Database Audit Specifications for a database as long as each one uses a separate Server Audit.&lt;/p&gt;
&lt;p&gt;At the instance level you can specify one or more audit action groups (for Database Audit Specifications you can specify individual audit actions and filters as well). Note that actions that modify the audit itself (e.g. disabling or altering audit objects) are automatically audited. There are a large number of audit action groups, to find details on all of them check Books Online.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Walkthrough&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the following examples we will create Database Audit Specifications for the Adventureworks database using&amp;nbsp;a new&amp;nbsp;file based Server Audits (I won&amp;#39;t cover creating&amp;nbsp;the Server Audits in any detail, if you want more details on Server Audits see&amp;nbsp;&lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-i.aspx"&gt;&lt;font color="#009933"&gt;Part I&lt;/font&gt;&lt;/a&gt;). You will need the latest version of Adventureworks which can be downloaded from Codeplex &lt;a class="" href="http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=14274" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;For the first example, we will create a Database Audit Specification to audit all DML on the Sales.CreditCard and HumanResources.EmployeePayHistory tables. First we will create a new file based Server Audit that we will use for our Database Audit Specification&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;CREATE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;[AWDMLAudit]&amp;nbsp; &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;FILE&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;FILEPATH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;C:\Audit\DB\Adventureworks\AWDMLAudit&amp;#39;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MAXSIZE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;100&amp;nbsp;MB&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MAX_ROLLOVER_FILES&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;2147483647&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;RESERVE_DISK_SPACE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;=&amp;nbsp;OFF&amp;nbsp; &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;&lt;font face="Courier New" size="2"&gt;)&amp;nbsp; &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;QUEUE_DELAY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;2000&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ON_FAILURE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;CONTINUE&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;We will now create a new Database Audit Specification to audit the DML events for the Sales.CreditCard and HumanResources.EmployeePayHistory tables. Notice that as well as the audit action groups available in Server Audit Specifications, we can also specify individual audit actions and filter them based on individual objects and the user or role accessing them. In this example we will specify the public database role so that DML for all users is captured.&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;CREATE&amp;nbsp;DATABASE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;AUDIT&amp;nbsp;SPECIFICATION&amp;nbsp;AWSensitiveDMLAudit &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FOR&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;AWDMLAudit &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;INSERT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;UPDATE&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;DELETE &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ON&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;HumanResources.EmployeePayHistory &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;PUBLIC&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;),&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;INSERT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;UPDATE&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;DELETE &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ON&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;Sales.CreditCard &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;PUBLIC&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;STATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;ON&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;Now lets generate some events and then view the audit file to ensure that the events have been audited&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;USE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;AdventureWorks &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;TOP&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;10&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;Sales.CreditCard &lt;br /&gt;GO &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;BEGIN&amp;nbsp;TRAN &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;UPDATE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;Sales.CreditCard&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SET&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ExpYear&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;2009&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ModifiedDate&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;GETDATE&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;() &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;CreditCardID&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;6 &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;ROLLBACK&amp;nbsp;TRAN &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;HumanResources.EmployeePayHistory &lt;br /&gt;GO&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;USE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;master &lt;br /&gt;GO &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;get&amp;nbsp;the&amp;nbsp;audit&amp;nbsp;file &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DECLARE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@filepattern&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;VARCHAR&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;300&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DECLARE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@folder&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;VARCHAR&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;255&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DECLARE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@auditguid&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;VARCHAR&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;36&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@auditguid&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;audit_guid&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@folder&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;log_file_path &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font color="#008000"&gt;sys.server_file_audits&lt;/font&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;AWDMLAudit&amp;#39; &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@filepattern&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@folder&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;+&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;*_&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;+&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@auditguid&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;+&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:red;"&gt;&lt;font face="Courier New" size="2"&gt;&amp;#39;*&amp;#39; &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;view&amp;nbsp;the&amp;nbsp;results &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.name&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;Action&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;c.class_type_desc&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ObjectType&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.server_principal_name&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.schema_name&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;OBJECT_NAME&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;f.statement &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:darkred;"&gt;fn_get_audit_file&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@filepattern&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,NULL,NULL)&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;f &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font color="#008000"&gt;sys.dm_audit_class_type_map&lt;/font&gt;&amp;nbsp;c&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.class_type&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;c.class_type &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font color="#008000"&gt;sys.dm_audit_actions&lt;/font&gt;&amp;nbsp;a&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.action_id&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.action_id&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;AND&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;c.securable_class_desc&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;a.class_desc &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.action_id&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;&amp;lt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;AUSC&amp;#39; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ORDER&amp;nbsp;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;event_time&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DESC&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sequence_number&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/dbauditresults.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/dbauditresults.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;There are a couple of interesting points raised by the results. As you can see, the update statement is present (twice in fact since the table needs to be read to be able to qualify rows for the update which is why poth the SELECT and UPDATE appear for the UPDATE statement) even though the transaction it was in was rolled back. Also notice that the statement for the update is the auto parameterised version rather than the actual statement text. &lt;em&gt;&lt;strong&gt;Database audits do not capture any before or after data images for DML actions.&lt;/strong&gt;&lt;br /&gt;&lt;/em&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;Here are a few more examples demonstrating the additional filtering available for Database Audit Specifications. Note that if you try and create these without deleting the previous Database Audit Specification they will fail because of the limit of &lt;em&gt;1 Database Audit Specification per Database per Server Audit&lt;/em&gt;. Also note that in order to DROP or ALTER a Database Audit Specification if must first be disabled. You can of course simly alter the existing Database Audit Specification by adding the new audit actions and groups.&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;some&amp;nbsp;more&amp;nbsp;examples&amp;nbsp;of&amp;nbsp;database&amp;nbsp;audit&amp;nbsp;specifications &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;USE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;AdventureWorks &lt;br /&gt;GO &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;audit&amp;nbsp;all&amp;nbsp;execution&amp;nbsp;of&amp;nbsp;stored&amp;nbsp;procedures &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;AUDIT&amp;nbsp;SPECIFICATION&amp;nbsp;Example1 &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FOR&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;AWDMLAudit &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;EXECUTE &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ON&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;DATABASE::AdventureWorks &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;PUBLIC&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;STATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;ON&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:gray;"&gt;&lt;font face="Courier New" size="2"&gt;) &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;GO &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;audit&amp;nbsp;all&amp;nbsp;updates&amp;nbsp;in&amp;nbsp;the&amp;nbsp;Sales&amp;nbsp;schema &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;AUDIT&amp;nbsp;SPECIFICATION&amp;nbsp;Example2 &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FOR&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;AWDMLAudit &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;UPDATE &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ON&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SCHEMA::Sales &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;PUBLIC&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;STATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;ON&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:gray;"&gt;&lt;font face="Courier New" size="2"&gt;) &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;GO &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;audit&amp;nbsp;all&amp;nbsp;schema&amp;nbsp;changes&amp;nbsp;in&amp;nbsp;the&amp;nbsp;database &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;AUDIT&amp;nbsp;SPECIFICATION&amp;nbsp;Example3 &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FOR&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;AWDMLAudit &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;SCHEMA_OBJECT_CHANGE_GROUP&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;STATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;ON&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;As for Server Audit Specifications, there is built in tool support for Database Audit Specifications in SSMS. If you expand a database node in Object Explorer you will see the new Database Audit Specifications node. To create a new Database Audit Specification, right click on the Database Audit Specifications node and choose New Database Audit Specification as shown below&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms_dbnew.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms_dbnew.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This will bring up the Create Database Audit Specification dialog which allows you to select the audit actions and groups and any applicable filtering&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/ssms_audit_dbcreate.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/ssms_audit_dbcreate.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;That brings us to the end of this introduction to the new built in auditing in SQL Server 2008. As you have seen, it is extremely easy to configure and administer via TSQL or SSMS. It is also designed to be extremely lightweight and have less overhead than the existing mechanisms (SQL Trace, DDL Triggers, Event Notifications).&lt;/p&gt;
&lt;p&gt;All the code examples are attached to this post.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10529" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Security" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Security/default.aspx" /><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>New in SQL 2008: Server and Database Auditing Part II</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-auditing-part-ii.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="1245" href="http://sqlblogcasts.com/blogs/sqldbatips/attachment/10528.ashx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-auditing-part-ii.aspx</id><published>2008-06-27T17:10:00Z</published><updated>2008-06-27T17:10:00Z</updated><content type="html">&lt;p&gt;In this post I&amp;#39;ll cover how to create a Server Audit Specification to audit Instance level events. This post is part of a series so if you missed Part I you can find it &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-i.aspx"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Server Audit Specification&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Server Audit Specifications define the audit action groups that you want to audit at the Instance level and the Server Audit it belongs to. &lt;em&gt;There can be a maximum of 1 Server Audit Specification per Server Audit&lt;/em&gt;. You can create multiple Server Audit Specifications as long as each one uses a separate Server Audit.&lt;/p&gt;
&lt;p&gt;At the instance level you can specify one or more audit action groups (for Database Audit Specifications you can specify individual audit actions and filters as well). Note that actions that modify the audit itself (e.g. disabling or altering audit objects) are automatically audited. There are a large number of audit action groups, to find details on all of them check Books Online.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Walkthrough&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the following example we will create a couple of Server Audit Specifications using the Server Audits we created in &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-i.aspx"&gt;Part I&lt;/a&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;For the first example we&amp;#39;ll create a Server Audit Specification to audit changes to logins using the SERVER_PRINCIPAL_CHANGE_GROUP and use the &lt;strong&gt;ApplicationLog Server Audit&lt;/strong&gt;. If you don&amp;#39;t specify the WITH clause then the Server Audit Specification will be created in a disabled state.&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;&lt;font size="2"&gt;CREATE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;SPECIFICATION&amp;nbsp;[AuditLoginChanges] &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FOR&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;[ApplicationLog] &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;SERVER_PRINCIPAL_CHANGE_GROUP&lt;/span&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;STATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;ON&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt;&lt;font face="Arial"&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;div&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;Now lets generate a couple of events that will be audited. We will create a login, alter it and then drop it.&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;create&amp;nbsp;some&amp;nbsp;events &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;login&amp;nbsp;AuditLoginDemo&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;password&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;sdkfds*)&amp;amp;(9kdsafk&amp;#39;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;check_policy&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;=OFF &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ALTER&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;login&amp;nbsp;AuditLoginDemo&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;DEFAULT_DATABASE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;model&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;DEFAULT_LANGUAGE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;British &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DROP&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;login&amp;nbsp;AuditLoginDemo &lt;br /&gt;GO&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;&lt;/font&gt;&lt;/span&gt;To view the audit events that are written to the Application Log we can either use Windows Event Viewer or SQL Server Management Studio. When viewing events using Event Viewer it is helpful to create a filter for only Success and Failure audits to cut down the number of records. When viewing the audit in SSMS this is automatically done for you. To view the events in SSMS, expand the Security top level node, expand the Audits node, right click the Application Log Server Audit and choose View Audit Logs as shown below.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_view.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_view.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This launches the SSMS Log Viewer which enables you to easily review audit events written to any of the available Server Audit targets&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_logviewer.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_logviewer.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;In the next example we&amp;#39;ll create a Server Audit Specification using SSMS that audits the SERVER_OPERATION_GROUP and SERVER_STATE_CHANGE_GROUP audit action groups and uses the ServerAuditFile Server Audit. To create a new Server Audit specification, expand the Security top level node, right click the Server Audit Specifications&amp;nbsp;node and choose New Server Audit Specification. This will open the Create Server Audit Specification dialog as shown below. You need to supply a name and select the Server Audit you want to use. Choose ServerAuditFile from the drop down list. You can then add one or more audit action groups as shown below. Click OK to create the Server Audit Specification.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As with all the audit objects, the Server Audit Specification will be created in a disabled state. To enable it using SSMS, right click on the Server Audit Specification and choose Enable Server Audit Specification as shown below&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/ssms_audit_enable.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/ssms_audit_enable.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is the equivalent TSQL command for the actions above which demonstrates how to add multiple audit action groups to a Server Audit Specification&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;CREATE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;SPECIFICATION&amp;nbsp;[ServerOperationAndState] &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FOR&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;[ServerAuditFile] &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;SERVER_OPERATION_GROUP&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;), &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ADD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;SERVER_STATE_CHANGE_GROUP&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;STATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;ON)&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;Now lets generate some audit events, in this case we will use sp_configure to modify some configuration settings to trigger events in the SERVER_OPERATION_GROUP action group&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;EXEC&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:darkred;"&gt;sp_configure&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;show&amp;nbsp;advanced&amp;nbsp;options&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;1 &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;RECONFIGURE &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;EXEC&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:darkred;"&gt;sp_configure&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;clr&amp;nbsp;enabled&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;1 &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;RECONFIGURE &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;In order to view the audit events we could use the SSMS Log viewer as in Step 3 above but since the ServerAuditFile Server Audit has a file target, we can also use the new function fn_get_audit_file to view the contents of the file from TSQL as shown below. First we query the sys.server_file_audits catalog view to get the audit folder and then pass that to the fn_get_audit_file function.&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;DECLARE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@folder&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;VARCHAR&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;255&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@folder&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;log_file_path&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;+&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;*&amp;#39;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sys.server_file_audits&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;ServerAuditFile&amp;#39; &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sys.&lt;/span&gt;&lt;span style="COLOR:darkred;"&gt;fn_get_audit_file&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#434343;"&gt;@folder&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DEFAULT&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DEFAULT&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ORDER&amp;nbsp;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;event_time&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;DESC&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;There are a number of new catalog views and DMV&amp;#39;s that allow us to query the new audit objects and these are show below as well as a query that will list all Server Audit Specifcations, the audit action groups defined and the asoosciated Server Audit details. For details of the individual views see Books Online.&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;new&amp;nbsp;catalog&amp;nbsp;views&amp;nbsp;and&amp;nbsp;DMV&amp;#39;s &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;&lt;font color="#008000"&gt;sys.server_audits&lt;/font&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;&lt;font color="#008000"&gt;sys.server_file_audits&lt;/font&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;&lt;font color="#008000"&gt;sys.dm_server_audit_status &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;&lt;font color="#008000"&gt;sys.server_audit_specifications &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;&lt;font color="#008000"&gt;sys.server_audit_specification_details&lt;/font&gt; &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:green;"&gt;&lt;font face="Courier New" size="2"&gt;--&amp;nbsp;query&amp;nbsp;to&amp;nbsp;list&amp;nbsp;all&amp;nbsp;server&amp;nbsp;audit&amp;nbsp;specifications&amp;nbsp;with&amp;nbsp;details&amp;nbsp;of &lt;br /&gt;--&amp;nbsp;the&amp;nbsp;audited&amp;nbsp;action&amp;nbsp;groups,&amp;nbsp;server&amp;nbsp;audits&amp;nbsp;and&amp;nbsp;audit&amp;nbsp;files&amp;nbsp;(if&amp;nbsp;applicable)&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sp.name&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ServerAuditSpecification&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;CASE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHEN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sp.is_state_enabled&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;1&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;THEN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;Y&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ELSE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;N&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;END&amp;nbsp;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;SpecificationEnabled&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;d.AuditActions&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.name&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ServerAudit&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.type_desc&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ServerAuditType&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;CASE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHEN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.is_state_enabled&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;1&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;THEN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;Y&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ELSE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;N&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;END&amp;nbsp;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;AuditEnabled&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;st.status_desc&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;AuditStatus&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.queue_delay&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;QueueDelay&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.on_failure_desc&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;OnFailure&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;st.audit_file_path&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;CurrentFile&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.max_file_size&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MaxFileSize&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.max_rollover_files&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MaxRolloverFiles&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;CASE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHEN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.reserve_disk_space&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;0&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;THEN&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;N&amp;#39;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHEN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;f.reserve_disk_space&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;1&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;THEN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;Y&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;END&amp;nbsp;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;ReserveSpace &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sys.server_audit_specifications&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;sp &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;sys.server_audits&amp;nbsp;a&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sp.audit_guid&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;a.audit_guid &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;sys.dm_server_audit_status&amp;nbsp;st&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.audit_id&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;st.audit_id &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;LEFT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;sys.server_file_audits&amp;nbsp;f&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a.audit_id&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;f.audit_id&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;LEFT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;server_specification_id&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:magenta;"&gt;STUFF&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;((&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;,&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;+&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;audit_action_name&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;[text()] &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sys.server_audit_specification_details&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;d2 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;d2.server_specification_id&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;d1.server_specification_id &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ORDER&amp;nbsp;BY&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;audit_action_name &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FOR&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;xml&amp;nbsp;path&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)),&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;1&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;1&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;AuditActions &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sys.server_audit_specification_details&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;d1 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;GROUP&amp;nbsp;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;server_specification_id&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;d &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;sp.server_specification_id&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;d.server_specification_id &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ORDER&amp;nbsp;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ServerAuditSpecification&lt;/span&gt;&lt;/font&gt;&lt;/font&gt; &lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;All the sample code is attached to this post. In &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-iii.aspx"&gt;Part III&lt;/a&gt; I&amp;#39;ll examine Database Audit Specifications&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10528" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Security" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Security/default.aspx" /><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>New in SQL 2008: Server and Database Auditing Part I</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-auditing-part-i.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="718" href="http://sqlblogcasts.com/blogs/sqldbatips/attachment/10530.ashx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-auditing-part-i.aspx</id><published>2008-06-27T17:05:00Z</published><updated>2008-06-27T17:05:00Z</updated><content type="html">&lt;p&gt;In this post I&amp;#39;ll cover how to create the Server Audit Object itself and the configuration for the targets of the audit (Application Event Log, Security Event Log or File)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;S&lt;/strong&gt;&lt;strong&gt;erver Audit Object&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Server Audit object is the first object you create when enabling auditing on an instance of SQL Server 2008. It defines the target for audit events generated by Audit Specifications. In SQL Server 2008 there are 3 possible audit outputs&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Windows Application Event Log&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Windows Security Event Log&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;File (local or remote)&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;When you specify the Application or Security Log, the only options available for configuration are&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Queue Delay - the amount of time in milliseconds that events are buffered before being forced to be processes. To enable synchronous event delivery&amp;nbsp;you would set this to 0. The default value for this is 1000 (1 second)&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Shutdown on Failure - if this option is selected then the instance will shutdown if audit events cannot be written to the target&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;There are some additional taks that need to be performed to enable SQL Server to write audit events to the Windows Security Log which I&amp;#39;ll cover in the example below. They are also well documented in Books Online. &lt;em&gt;&lt;strong&gt;Note that writing to the Security Log is not supported on Windows XP&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;When you specify File you can configure the folder that the audit files will be generated in, the maximun number of rollover files, the maximum size of each file and whether to reserve the disk space for the audit file if a maximum size is specified. We&amp;#39;ll cover the actuall DDL for this later on in the example code.&lt;/p&gt;
&lt;p&gt;When a Server Audit object is created it is initially in a disabled state. In order for audit events to be written to the target it must first be enabled.&lt;/p&gt;
&lt;p&gt;There can be a maximum of 1 Server Audit Specification per Server Audit (you can of course create multiple Server Audits) and 1 Database Audit Specification per database per Server Audit (again you can create multiple Database Audit Specifications for a database but they need to use multiple Server Audits)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Walkthrough&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In this example we&amp;#39;ll configure&amp;nbsp;three Server Audit objects utilising each of the available targets (application Log, Security Log,File). I&amp;#39;ll demonstrate how to do this via TSQL and via SSMS.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;For the first object we will create a Server Audit object that targets the &lt;strong&gt;Windows Application Event Log&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;CREATE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;[ApplicationLog] &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;APPLICATION_LOG &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;WITH &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;QUEUE_DELAY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;2000 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ON_FAILURE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;=&amp;nbsp;CONTINUE &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;&lt;font face="Courier New" size="2"&gt;) &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;GO &lt;/font&gt;&lt;br /&gt;&lt;br /&gt;In this example, we have specified a Queue Delay of 2000 milliseconds and to not shutdown if audit records cannot be written to the application log. Initially this Server Audit is created in a disabled state. To enable it we can use the following command&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;ALTER&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;[ApplicationLog]&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;STATE&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=ON&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;To perform the same action using SSMS we would connect to our instance using Object Explorer and expand the Security node, right click on Audit and choose New Audit from the context menu&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms_new.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms_new.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This will bring up the Create Audit dialog where we can specify the parameters for our Server Audit Object as shown below&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_applog_props.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_applog_props.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This will create the Server Audit object in a disabled state exactly as if we created it via TSQL so to enable it via SSMS simply select the Server Audit Object, right click and choose Enable Audit from the context menu&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms_enable.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_ssms_enable.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;&lt;span style="COLOR:black;"&gt;For the second object we will create a Server Audit object that targets the &lt;strong&gt;Windows&amp;nbsp;Security Event Log&lt;/strong&gt;. Before we can do this however, we need to configure a couple of windows settings to allow SQL Server to write events to the Security Event Log. The example below is for Windows 2003, the procedure for Windows 2008 is slightly different and is documented in Books Online. Note that the options that need to be set here may well be set by Group Policy in a domain envrionment in which case local settings could be overwritten. You would need to discuss these settings with the group that manages Group Policy to ensure the required settings remain in effect for SQL Servers where you want to be able to write events to the Security Log.&lt;br /&gt;&lt;br /&gt;First we need to enable Audit object access for Success and Failure. We do this using the Local Security Policy mmc snapin (Start&amp;gt;Run&amp;gt;secpol.msc)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_secpol.gif"&gt;&lt;/a&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_secpol.gif"&gt;&lt;/a&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_secpol2.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_secpol2.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then we need to assign the Generate Security Audits right to the SQL Server service account. This is done through the same mmc snapin as above by selcting the User Rights Assignment node and double clicking on the Generate Security Audits entry in the right hand pane and adding in the SQL Service account. In this example I&amp;#39;m using a local user account as my server is not part of a domain.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit_secpol3.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit_secpol3.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Once these 2 changes have been made, restart the SQL Server service and you will then be able to create a Server Audit targetting the Windows security log as shown below. Again, this will be created in a disabled state so you will need to enable it exactly the same as for the Application Log example. &lt;strong&gt;&lt;font color="#ff0000"&gt;Note SQL Sever 2008 RC0 has a &lt;a class="" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=352787" target="_blank"&gt;bug&lt;/a&gt; with regard to viewing events written to the Security Log in Event Viewer. See &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/workaround-for-audit-issue-when-targetting-the-security-log-in-sql-2008-rc0.aspx"&gt;this post&lt;/a&gt; for the workaround.&lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;CREATE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;[SecurityLog] &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;SECURITY_LOG &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;WITH &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;QUEUE_DELAY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;2000 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ON_FAILURE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;=&amp;nbsp;CONTINUE &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;&lt;span style="COLOR:black;"&gt;For the third object we will create a Server Audit object that targets a local file. There are some additional options available when specifying a file target inluding the folder that the audit files will be generated in, the maximun number of rollover files, the maximum size of each file and whether to reserve the disk space for the audit file if a maximum size is specified as shown below&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;CREATE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;SERVER&amp;nbsp;AUDIT&amp;nbsp;[ServerAuditFile] &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;FILE&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;FILEPATH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;N&amp;#39;C:\Audit\Server\&amp;#39; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MAXSIZE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;100&amp;nbsp;MB &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MAX_ROLLOVER_FILES&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;2147483647 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;RESERVE_DISK_SPACE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;=&amp;nbsp;OFF &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;&lt;font face="Courier New" size="2"&gt;) &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;WITH &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;QUEUE_DELAY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;2000 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;,&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ON_FAILURE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;CONTINUE &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;)&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;In this example we are specifying a target folder of C:\Audit\Server, a maximum individual file size of 100MB, an unlimited number of rollover files and not to reserve disk space when creating the audit files. Note that you can also specify a UNC path for the FILEPATH if you want to write to a remote share as long as the SQL Service account has permissions to the share. Because of the increased latency due to the network you may need to increase the QUEUE_DELAY parameter to avoid impacting the instance. Also with a remote target it may not be wise to specify ON_FAILURE = SHUTDOWN (you can increase the availability of the share by creating it on a cluster)&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;span style="COLOR:black;"&gt;There is one more option available when creating a Server Audit and that is AUDIT_GUID. All Server Audits have an audit_guid (which you can find by querying &lt;font color="#008000"&gt;sys.server_audits&lt;/font&gt;&lt;font color="#000000"&gt;) . When you create a Database Audit Specification (covered in &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-iii.aspx"&gt;Part III&lt;/a&gt;) you associate it with a Server Audit. If you restore or attach the database to another instance for example when configuring database mirroring, the Database Audit Specification becomes orphaned because there is no Server Audit on the new instance with a matching audit_guid. Thus by providing the option to specify the audit_guid, you can create the required Server Audit on the new instance. For a Server Audit that uses a File target in a database mirroring environment you will probably want to use a file share rather than a local file and will need to make sure poth the principal and mirror SQL service accounts have access to the share.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;So as we have seen from these examples, it is extremely straightforward to create Server Audit objects in SQL Server 2008 using TSQL or SSMS. The Security Event Log target is a good choice to ensure that audit records cannot be tampered with and should also integrate well with &lt;a class="" href="http://opsmgr2007.wikidot.com/system:audit-collection-services" target="_blank"&gt;ACS&lt;/a&gt; (Audit Collection Services) in&amp;nbsp;&lt;a class="" href="http://www.microsoft.com/systemcenter/operationsmanager/en/us/default.aspx" target="_blank"&gt;SCOM 2007&lt;/a&gt; (System Center Operations Manager) or other security log based audit collection systems. Again, as with a number of the new features in SQL Server 2008 it will be interesting to see the performance impact (if any) of the various audit configurations and I&amp;#39;m sure some best practice white papers will be available at some point post RTM.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="COLOR:black;"&gt;All the code for the examples in this post are in the attached zip file. In &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-ii.aspx"&gt;Part II&lt;/a&gt; we&amp;#39;ll cover how to create Server Audit Specifications and relate them to the Server Audits we created.&lt;/span&gt;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10530" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Security" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Security/default.aspx" /><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>New in SQL 2008: Server and Database Auditing Overview</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-audits.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/27/new-in-sql-2008-server-and-database-audits.aspx</id><published>2008-06-27T17:00:00Z</published><updated>2008-06-27T17:00:00Z</updated><content type="html">&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In SQL Server 2008 Enterprise Edition, Instance and Database level audit is now a built in function of the Database Engine with its own set of instance and database level objects, &lt;strong&gt;Server Audit&lt;/strong&gt; and &lt;strong&gt;Server Audit Specification&lt;/strong&gt; at the instance level and&lt;strong&gt; Database Audit Specification&lt;/strong&gt; at the Database level (on a side note I&amp;#39;m not sure why they used the prefix Server since these are Instance level objects)&lt;/p&gt;
&lt;p&gt;These new objects also have their own DDL commands (CREATE, ALTER, DROP) which we will examine in the later code examples. The generation of audit events is extremely lightweight compared to previously available mechanisms and is based on the new Extended Events infrastructure which is designed to have an extremely low overhead even for large numbers of events. It also allows much finer grained filtering of events.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Whilst we had the ability to audit a large number of DDL actions in SQL Server 2005 using the Event Notification infrastructure (I have a sample tool that allows auditing of all schema changes across multiple instances and centralised storage and reporting available &lt;a class="" href="http://www.sqldbatips.com/showarticle.asp?ID=113" target="_blank"&gt;here&lt;/a&gt;) not all actions were auditable, it was not that straightforward to configure and there was no tool support within SSMS (SQL Server Management Studio).&lt;/p&gt;
&lt;p&gt;In SQL Server 2008, all events are auditable including&amp;nbsp;those not available via Event Notifications and configuration is creatly simplified. As we&amp;#39;ll see later on, there is also built in tool support for this in SSMS. The diagram below gives an overview of the various audit objects&lt;/p&gt;
&lt;p&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/audit.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/audit.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/a.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Server Audit&lt;/strong&gt; objects define the properties of an audit (Queue Delay, Action on Audit Failure) as well as the output &lt;strong&gt;Target&lt;/strong&gt; (File, Windows Application Log or Windows Security Log). You can create multiple Server Audits each of which defines its own Target.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Server Audit Specification &lt;/strong&gt;objects&amp;nbsp;define the audit action groups that you want to audit at the Instance level and the Server Audit it belongs to. &lt;em&gt;There can be a maximum of 1 Server Audit Specification per Server Audit&lt;/em&gt;. You can create multiple Server Audit Specifications as long as each one uses a separate Server Audit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Database&amp;nbsp;Audit Specification &lt;/strong&gt;objects&amp;nbsp;define the individual audit actions or action groups that you want to audit at the&amp;nbsp;Database level including any filters and the Server Audit it belongs to. &lt;em&gt;There can be a maximum of 1 Database Audit Specification per Database per Server Audit&lt;/em&gt;. You can create multiple Database Audit Specifications for&amp;nbsp;the same&amp;nbsp;database but they need to belong to separate Server Audits.&lt;/p&gt;
&lt;p&gt;In the following series of posts I&amp;#39;ll cover the three core objects in detail: Server Audit, Server Audit Specification and Database Audit Specification&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;&lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-i.aspx"&gt;Server and Database Auditing Part I - Server Audit&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-ii.aspx"&gt;Server and Database Auditing Part II - Server Audit Specification&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/new-in-sql-2008-server-and-database-auditing-part-iii.aspx"&gt;Server and Database Auditing Part II - Database Audit Specification&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10522" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Security" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Security/default.aspx" /><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>Microsoft SQL Server 2008 Feature Pack RC0 (June 2008)</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/microsoft-sql-server-2008-feature-pack-rc0-june-2008.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/25/microsoft-sql-server-2008-feature-pack-rc0-june-2008.aspx</id><published>2008-06-25T08:00:00Z</published><updated>2008-06-25T08:00:00Z</updated><content type="html">&lt;p&gt;The June feature pack for SQL Server 2008 RC0 allows you to download individual componets of the RC0 release (e.g. SMO, command line utilities, SQL Native Client) as well as some additional tools. Most notably, you can download Report Builder 2.0 and SQL 2008 Upgrade Advisor. Just go to the link below and scroll down the page. Note that to run SQL 2008 Upgrade Advisor from a PC that does not have RC0 installed you will need to install Windows Installer 4.5. There are links to the hotfix for this on the feature pack page.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=089A9DAD-E2DF-43E9-9CD8-C06320520B40&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=089A9DAD-E2DF-43E9-9CD8-C06320520B40&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10523" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="SQL Tools" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+Tools/default.aspx" /><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>New in SQL 2008 : Transparent Data Encryption Part II</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/24/new-in-sql-2008-transparent-data-encryption-part-ii.aspx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/24/new-in-sql-2008-transparent-data-encryption-part-ii.aspx</id><published>2008-06-24T20:11:00Z</published><updated>2008-06-24T20:11:00Z</updated><content type="html">&lt;p&gt;In &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/24/new-in-sql-2008-transparent-data-encryption-overview.aspx"&gt;Part I&lt;/a&gt; we created the required keys and certificate to enable Transparent Data Encryption for the TDE database. In this post I&amp;#39;ll cover how to restore an encrypted database to another instance (e.g. to set up database mirroring or log shipping). In order to be able to restore the now encrypted backup of the TDE database, we need to create the server certificate used to secure the Database Encryption Key for the TDE database (DEKCert). In order to do this we need the backup files we created in Step 4 of &lt;a class="" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/24/new-in-sql-2008-transparent-data-encryption-overview.aspx"&gt;Part I&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Walkthrough&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;First we will try and restore the TDE database to another instance without first creating the server certificate. As you will see below, this fails because the server certificate used to secure the database encryption key cannot be found on the new instance. &lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;backup&amp;nbsp;database&amp;nbsp;if&amp;nbsp;not&amp;nbsp;already&amp;nbsp;done &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BACKUP&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;TDE&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDE_Encrypted.bak&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;init &lt;br /&gt;GO &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;try&amp;nbsp;and&amp;nbsp;restore&amp;nbsp;to&amp;nbsp;a&amp;nbsp;different&amp;nbsp;instance &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;RESTORE&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;TDE&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDE_Encrypted.bak&amp;#39; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;move&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;TDE&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDE.mdf&amp;#39;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;move&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;TDE_log&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDE.ldf&amp;#39;&lt;font color="#808080"&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;font face="courier new,courier" color="#ff0000"&gt;Msg 33111, Level 16, State 3, Line 1&lt;br /&gt;Cannot find server certificate with thumbprint &amp;#39;0xCA741797B81ED8D1305EAE65A747BA51E1DAB80D&amp;#39;.&lt;br /&gt;Msg 3013, Level 16, State 1, Line 1&lt;br /&gt;RESTORE DATABASE is terminating abnormally.&lt;br /&gt;&lt;/font&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;&lt;font face="courier new,courier" color="#ff0000"&gt;&lt;font face="Arial" color="#000000"&gt;On our new instance, we need to create the server certificate used to secure our database encryption key for the TDE database (DEKCert). We do this by creating a certificate from the backups we created in Step 4 of Part I (if you don&amp;#39;t have the backups simply run the backup certificate part again on the original instance). We need to create the database master key for the master database as in Part I if it doesn&amp;#39;t exist before we can create the certificate.&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;USE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;master &lt;br /&gt;GO &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--&amp;nbsp;create&amp;nbsp;database&amp;nbsp;master&amp;nbsp;key&amp;nbsp;if&amp;nbsp;it&amp;nbsp;doesn&amp;#39;t&amp;nbsp;exist &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MASTER&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;KEY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ENCRYPTION&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;PASSWORD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:red;"&gt;&lt;font face="Courier New" size="2"&gt;&amp;#39;sdfsdfysd092735kjn$&amp;amp;adsg&amp;#39; &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;GO &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:green;"&gt;--create&amp;nbsp;TDE&amp;nbsp;certificate&amp;nbsp;from&amp;nbsp;backup &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;CERTIFICATE&amp;nbsp;DEKCert&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;FILE&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\DEKCert&amp;#39; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;PRIVATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;KEY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FILE&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\DEKCertPrivKey&amp;#39;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;DECRYPTION&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;PASSWORD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;sd092rhhh4735kjn$&amp;amp;adsg&amp;#39;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;&lt;font face="courier new,courier" color="#ff0000"&gt;&lt;font face="Arial" color="#000000"&gt;Now that the server certificate used to encrypt the database encryption key for the TDE database is present on the new instance, we can successfully restore the TDE database.&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;RESTORE&amp;nbsp;DATABASE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;TDE&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDE_Encrypted.bak&amp;#39; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;move&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;TDE&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDE.mdf&amp;#39;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;move&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;TDE_log&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDE.ldf&amp;#39;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:gray;"&gt;&lt;font face="Courier New" size="2"&gt;, &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;recovery &lt;br /&gt;GO&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;&lt;font face="courier new,courier" color="#ff0000"&gt;&lt;font face="Arial" color="#000000"&gt;Just to make sure, you can query the test table to make sure you can see the data on the new instance&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;TDE.dbo.t1&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/tde_res_new.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/tde_res_new.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;You can find more details about Transparent Data Encryption in the SQL Server 2008 Books Online. I haven&amp;#39;t had a chance to do any performance test of this feature yet but it will be interesting to see what the impact is both for the encrypted database and the instance as a whole (due to tempdb being automatically encrypted)&lt;/p&gt;
&lt;p&gt;The sample code for this example is attached to this post&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10516" width="1" height="1"&gt;</content><author><name>sqldbatips</name><uri>http://sqlblogcasts.com/members/sqldbatips.aspx</uri></author><category term="Security" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Security/default.aspx" /><category term="Katmai" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/Katmai/default.aspx" /><category term="SQL 2008" scheme="http://sqlblogcasts.com/blogs/sqldbatips/archive/tags/SQL+2008/default.aspx" /></entry><entry><title>New in SQL 2008 : Transparent Data Encryption Part I</title><link rel="alternate" type="text/html" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/24/new-in-sql-2008-transparent-data-encryption-overview.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="767" href="http://sqlblogcasts.com/blogs/sqldbatips/attachment/10515.ashx" /><id>http://sqlblogcasts.com/blogs/sqldbatips/archive/2008/06/24/new-in-sql-2008-transparent-data-encryption-overview.aspx</id><published>2008-06-24T14:38:00Z</published><updated>2008-06-24T14:38:00Z</updated><content type="html">&lt;p&gt;&lt;strong&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/backup_unencrypted.gif"&gt;&lt;/a&gt;Overview&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Transparent Data Encryption (TDE) provides a w&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/tde.gif"&gt;&lt;/a&gt;ay to encrypt all the data in a database with no changes to applications that access that data. It provides protection for the data at rest by performing encryption as data is written to database files and the transaction log and decryption when it is read from those files. This is done automatically once a database has been encrypted using TDE and no changes need to be made to applications that access the data (hence &amp;quot;Transparent&amp;quot;). &lt;/p&gt;
&lt;p&gt;A symmetric key called the database encryption key (DEK) is used to perform the encryption/decryption and this is stored in the database itself. This key is secured either with a certificate in the master database or by an asymmetric key protected by an EKM (Extensible Key Management) module. In the example code below we&amp;#39;ll use a certificate in the master database to secure the database encryption key. &lt;/p&gt;
&lt;p&gt;The following diagram (taken from Books Online) demonstrates the key hierarchy used for encryption and in the example code below we will go through the steps required to enable TDE. It is vitally important to backup and the certificate used to secure the database encryption key. This backup can&amp;nbsp;be used to recreate the certificate on another instance which is required in order to restore or attach an encrypted database.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/tde.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/tde.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Key Points&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Encrypts data as it is written to disk&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Decrypts data as it is read from disk&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Encryption/Decryption for data files is performed at the page level&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;FILESTREAM data is &lt;strong&gt;&lt;u&gt;NOT&lt;/u&gt;&lt;/strong&gt; encrypted&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Enabling encryption on a database does &lt;u&gt;&lt;strong&gt;NOT&lt;/strong&gt;&lt;/u&gt; increase its size&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Enabling TDE will prevent instant file initalization which may affect performance during file autogrow&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Enabling encryption on any database automatically encrypts tempdb which may have a performance impact&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Transparent to client applications&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Backups of databases encrypted using TDE are also encrypted&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Works with log shipping and database mirroring&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Encrypted data does not compress as well as unencrypted data so backup compression is not very useful for encrypted databases however data compression can still be used effectively&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;You cannot restore or attach an encrypted database&amp;nbsp;to another instance without the certificate used to secure the DEK being present in the master database&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;The same server certificate can be used to secure multiple database encryption keys but a database encryption key is only ever associated with one certificate&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Walkthrough&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;In this example we will create a database called TDE which we will then encrypt using a database encryption key secured with a server certificate. First lets create the database and a table with some simple data and then backup the database.&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;USE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;master &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;TDE &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;USE&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;TDE &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;TABLE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;dbo.t1&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;VARCHAR&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;100&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;)) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;INSERT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;t1&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:black;"&gt;a&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;)&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;This&amp;nbsp;is&amp;nbsp;some&amp;nbsp;plain&amp;nbsp;text&amp;#39;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;),(&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;This&amp;nbsp;is&amp;nbsp;some&amp;nbsp;more&amp;nbsp;plain&amp;nbsp;text&amp;#39;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:gray;"&gt;&lt;font face="Courier New" size="2"&gt;) &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BACKUP&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;TDE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;DISK&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\TDEUnencrypted.bak&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:black;"&gt;&lt;font face="Courier New" size="2"&gt;init &lt;br /&gt;GO&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;Now open the backup file in Visual Studio 2008 and search for &amp;quot;This is some plain text&amp;quot;. You&amp;#39;ll see (as below) that you are able to find the text in the backup file&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblogcasts.com/blogs/sqldbatips/backup_unencrypted.gif"&gt;&lt;img src="http://sqlblogcasts.com/blogs/sqldbatips/backup_unencrypted.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;div&gt;Now we need to create our server certificate that will be used to secure our database encryption key. In order to create the server certificate we need to create a database master key in the master database (if it doesn&amp;#39;t already exist)&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;USE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;master &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MASTER&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;KEY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ENCRYPTION&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;PASSWORD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:red;"&gt;&lt;font face="Courier New" size="2"&gt;&amp;#39;sd092735kjn$&amp;amp;adsg&amp;#39; &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BACKUP&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;MASTER&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;KEY&amp;nbsp;TO&amp;nbsp;FILE&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\masterkey&amp;#39;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ENCRYPTION&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;PASSWORD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;sfg56565kjn$&amp;amp;adsg213&amp;#39; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;We can now create and backup the server certificate that we will use to secure the database encryption key&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;USE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;master &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;CERTIFICATE&amp;nbsp;DEKCert&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;SUBJECT&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="COLOR:red;"&gt;&lt;font face="Courier New" size="2"&gt;&amp;#39;DEK&amp;nbsp;Certificate&amp;#39; &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BACKUP&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;CERTIFICATE&amp;nbsp;DEKCert&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;TO&amp;nbsp;FILE&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\DEKCert&amp;#39; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;WITH&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;PRIVATE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;KEY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:gray;"&gt;(&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;FILE&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;c:\DEKCertPrivKey&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;,&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ENCRYPTION&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;BY&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;PASSWORD&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:red;"&gt;&amp;#39;sd092735kjn$&amp;amp;adsg&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:gray;"&gt;) &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;GO&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;
&lt;div&gt;Now that we have our server certificate, we can create the database encryption key for the TDE database&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;&lt;font face="Courier New" size="2"&gt;USE&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:black;"&gt;TDE &lt;br /&gt;GO &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR:blue;"&gt;CREATE&amp;nbsp;DATABASE&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:black;"&gt;ENCRYPTION&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:blue;"&gt;KEY &lt