{"id":513,"date":"2011-12-01T21:43:00","date_gmt":"2011-12-01T21:43:00","guid":{"rendered":"\/blogs\/bobb\/post\/Auditing-database-level-objects-in-SQL-Express-2012.aspx"},"modified":"2013-01-03T23:59:28","modified_gmt":"2013-01-04T07:59:28","slug":"auditing-database-level-objects-in-sql-express-2012","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/","title":{"rendered":"Auditing database-level objects in SQL Express 2012"},"content":{"rendered":"<p>\n&#8230; Continued from <a href=\"http:\/\/3.209.169.194\/blogs\/bobb\/using-filtering-and-server-audit-specs-to-audit-db-objects-in-sql-server-2012\/\" class=\"broken_link\">previous blog entry<\/a> &#8230;&nbsp;\n<\/p>\n<p>\nThe point of using a Server Audit Specification with database events in SQL Server 2012 is this. In SQL Server 2008, audit is an Enterprise-only feature. Only available in Enterprise, Evaluation, and Developer Edition. In SQL Server 2012, one of the new features (to quote BOL) is: &quot;Support for server auditing is expanded to include all editions of SQL Server. Database audits are limited to Enterprise, Datacenter, Developer, and Evaluation editions.&quot; (Note: there&#39;s no DataCenter edition any more after the recent licensing change).\n<\/p>\n<p>\nSo there IS a SQL Express 2012 RC0 available. Let&#39;s download it and try it out. [Starts download. Waits 5 minutes. Starts install. Done in 5-10 minutes. Nice].\n<\/p>\n<p>\nThere is no GUI for Server Audit and Server Audit Specification, even when you load up an Express edition into a Enterprise SSMS Object Explorer. But who needs a GUI&#8230;we can use DDL and use sys.fn_get_audit_file to read the audit log.\n<\/p>\n<p>\nUSE master<br \/>\nGO<br \/>\nCREATE SERVER AUDIT TestAudit2 TO file (filepath = &#39;c:\\temp&#39;)<br \/>\nWHERE database_name =&#39;AdventureWorks&#39; AND schema_name =&#39;HumanResources&#39; <br \/>\n&nbsp; AND object_name =&#39;EmployeePayHistory&#39; AND database_principal_name =&#39;dbo&#39;;\n<\/p>\n<p>\nCREATE SERVER AUDIT SPECIFICATION TestServerSpec2<br \/>\nFOR SERVER AUDIT TestAudit2<br \/>\n&nbsp;&nbsp;&nbsp; &#8212; ADD SELECT ON HumanResources.EmployeePayHistory BY dbo) &#8212; note: you can&#39;t do this in SERVER AUDIT SPEC<br \/>\n&nbsp;&nbsp;&nbsp; ADD (SCHEMA_OBJECT_ACCESS_GROUP)<br \/>\n&nbsp;&nbsp;&nbsp; WITH (STATE = ON);<br \/>\nGO\n<\/p>\n<p>\nAs my friends in the UK would say: &quot;Works a treat!&quot;. And Books Online is correct, attempting to define a Database Audit\n<\/p>\n<p>\nSpecification in SQL Express returns:\n<\/p>\n<p>\nMsg 33075, Level 16, State 3, Line 1<br \/>\nGranular auditing is not available in this edition of SQL Server. For more information about feature support in the editions of SQL Server, see SQL Server Books Online.\n<\/p>\n<p>\nSo you can&#39;t do without Database Audit Specs is audit Database Level audit actions. Like INSERT, SELECT, or DELETE. So maybe you&#39;re not *supposed to* be able to specify action_id in a Server Audit Specifcation filter predicate. Although you can&#39;t specify these (action_ids in predicate filters) for Server-level objects either. Even in Enterprise edition.\n<\/p>\n<p>\nStill, having seen auditing with SQL Express and only SERVER AUDIT filters, it&#39;s a MUCH more powerful and compelling feature than I&#39;d imaged when I first heard of it. Especially after seeing folks try to shoehorn auditing using CDC. Or change tracking. Or use triggers on every action. And BTW, you are limited to 3000 characters in a filter predicate, although they seem to allow AND\/OR\/NOT and the standard comparison operators. No &quot;LIKE&quot; capability, but you don&#39;t get that it SQL Server auditing anyhow.&nbsp;\n<\/p>\n<p>\nIn any case&#8230;&nbsp;enjoy auditing in SQL Express! And Standard Edition. And BI Edition.&nbsp;And no, I haven&#39;t tried it on LocalDB yet.\n<\/p>\n<p>\n@bobbeauch<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8230; Continued from previous blog entry &#8230;&nbsp; The point of using a Server Audit Specification with database events in SQL Server 2012 is this. In SQL Server 2008, audit is an Enterprise-only feature. Only available in Enterprise, Evaluation, and Developer Edition. In SQL Server 2012, one of the new features (to quote BOL) is: &quot;Support [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,31],"tags":[],"class_list":["post-513","post","type-post","status-publish","format-standard","hentry","category-security","category-sql-server-2012"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Auditing database-level objects in SQL Express 2012 - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Auditing database-level objects in SQL Express 2012 - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"&#8230; Continued from previous blog entry &#8230;&nbsp; The point of using a Server Audit Specification with database events in SQL Server 2012 is this. In SQL Server 2008, audit is an Enterprise-only feature. Only available in Enterprise, Evaluation, and Developer Edition. In SQL Server 2012, one of the new features (to quote BOL) is: &quot;Support [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2011-12-01T21:43:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-04T07:59:28+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/\",\"name\":\"Auditing database-level objects in SQL Express 2012 - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2011-12-01T21:43:00+00:00\",\"dateModified\":\"2013-01-04T07:59:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Security\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/security\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Auditing database-level objects in SQL Express 2012\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Auditing database-level objects in SQL Express 2012 - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/","og_locale":"en_US","og_type":"article","og_title":"Auditing database-level objects in SQL Express 2012 - Bob Beauchemin","og_description":"&#8230; Continued from previous blog entry &#8230;&nbsp; The point of using a Server Audit Specification with database events in SQL Server 2012 is this. In SQL Server 2008, audit is an Enterprise-only feature. Only available in Enterprise, Evaluation, and Developer Edition. In SQL Server 2012, one of the new features (to quote BOL) is: &quot;Support [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/","og_site_name":"Bob Beauchemin","article_published_time":"2011-12-01T21:43:00+00:00","article_modified_time":"2013-01-04T07:59:28+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/","name":"Auditing database-level objects in SQL Express 2012 - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2011-12-01T21:43:00+00:00","dateModified":"2013-01-04T07:59:28+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/auditing-database-level-objects-in-sql-express-2012\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Security","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/security\/"},{"@type":"ListItem","position":3,"name":"Auditing database-level objects in SQL Express 2012"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=513"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/513\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}