Microsoft SQL Server 2012 管理 (2): Auditing
-- Demostratin 2A (Using SQL Server Audit)
-- Step 1: Use the master database
USE master;
GO -- Step 2: Create a SQL Server Audit and define tis target as
-- application log
Create Server Audit MarketDevLog
To Application_log
With (QUEUE_DELAY = 1000, ON_FAILURE = CONTINUE)
GO -- Step 3: Change to the MarketDev database
USE MarketDev;
GO -- Step 4: Create a database audit specification for SELECT
-- activity on the Marketing schema
CREATE DATABASE AUDIT SPECIFICATION MrketingSelectSpec
FOR SERVER AUDIT MarketDevLog
ADD (SELECT ON SCHEMA::Marketing BY public);
GO -- Step 5: Query the sys.server_audits system view.
-- Scroll to the right and note the available columns.
-- particular, note the is_state_enabled column. SELECT * FROM sys.server_audits;
GO -- Step 6: Change to master database
USE master;
GO -- Step 7: Enable the server audit
ALTER SERVER AUDIT MarketDevLog WITH (STATE=ON);
GO -- Step 8: Change to MarketDev database
USE MarketDev;
GO -- Step 9: Enable the MarketingSelectSpec audit specification
ALTER DATABASE AUDIT SPECIFICATION MarketingSelectSpec
WITH (STATE = ON); -- Step 10: Query the sys.server_audits and
-- sys.database_audit_specifications and
-- sys.database_audit_specification_details system view
-- Note that the audit is now started and scroll to
-- see the details provided for the audit specification SELECT * FROM sys.server_audits;
SELECT * FROM sys.database_audit_specifications;
SELECT * FROM sys.database_audit_specification_details;
GO -- Step 11: Geenerate an auditable event by querying a table
-- in the Marketing schema. Also execute a query
-- that should not be audited. SELECT * FROM Marketing.PostalCode;
GO
SELECT * FROM DirectMarketing.City;
GO -- Step 12: Check the contents of the Application log
-- (Do this by Start, Right-click My Computer, then
-- Expand Diagnostics, Event Viewer, and Windows Logs
-- click Application. Click on each of the MSSQLSERVER
-- the upper pane For each evetn, click on the detail
-- the lower pane and review the contents). the close
-- management windows. -- Step 13: Change to the master database
USE master;
GO -- Step 14: Disable the server audit
ALTER SERVER AUDIT MarketDevLog WITH (STATE=OFF);
GO -- Step 15: Change to the MarketDev database
USE MarketDev;
GO -- Step 16: Disable the MarketingSelectSpec audit specification
ALTER DATABASE AUDIT SPECIFICATION MarketingSelectSpec
WITH (STATE = OFF);
Microsoft SQL Server 2012 管理 (2): Auditing的更多相关文章
- Microsoft SQL Server 2012 管理 (1): 安装配置SQL Server 重点
SQL Server 可以在实例,数据库,列,查询分别指定排序规则 /* Module 1 - working with Clollations */ -- 1.1 Obtain the Instan ...
- Microsoft SQL Server 2012 管理 (2): 实例与数据库管理
1.加密数据库 /* Module 2 Implementing Transparent Data Encryption */ -- 2.1 Create DataBase Master Key US ...
- Querying Microsoft SQL Server 2012 读书笔记:查询和管理XML数据 1 -使用FOR XML返回XML结果集
XML 介绍 <CustomersOrders> <Customer custid="1" companyname="Customer NRZBB&qu ...
- 【转】Microsoft® SQL Server® 2012 Performance Dashboard Reports
http://www.cnblogs.com/shanyou/archive/2013/02/12/2910232.html SQL Server Performance Dashboard Repo ...
- Microsoft SQL server 2012数据库学习总结(一)
一.Microsoft SQL Server2012简介 1.基本概要 Microsoft SQL Server 2012是微软发布的新一代数据平台产品,全面支持云技术与平台,并且能够快速构建相应的解 ...
- 微软推出的免费新书《Introducing Microsoft SQL Server 2012》
微软推出的免费新书<Introducing Microsoft SQL Server 2012>,该书详细介绍微软SQL 2012数据库服务最新功能以及功能应用和使用技巧. 该书适合SQL ...
- Exam 70-462 Administering Microsoft SQL Server 2012 Databases 复习帖
好吧最近堕落没怎么看书,估计这个月前是考不过了,还是拖到国庆之后考试吧.想着自己复习考试顺便也写点自己的复习的概要,这样一方面的给不准备背题库的童鞋有简便的复习方法(好吧不被题库的同学和我一样看MSD ...
- Microsoft® SQL Server® 2012 功能包
Microsoft® SQL Server® 2012 功能包 http://www.microsoft.com/zh-cn/download/details.aspx?id=29065 Micros ...
- sql server 安装出现需要sqlncli.msi文件,错误为 microsoft sql server 2012 native client
在安装sql server 2017 时出现 弹框标题为 microsoft sql server 2012 native client 内容为需要sqlncli.msi文件 去本地目录找本身的那 ...
随机推荐
- Windows下搭建appium(Android版)
1.安装node.js 说明:安装node.js是为了可以使用它的npm,可以用npm install很方便的安装它包含的包,appium server使用node.js编写的 下载地址:https: ...
- mysql数据类型长度
1个字节= 8位 tinyint 为一个字节 2的8次方= 256 所以最多存储到256 日期和时间数据类型 MySQL数据类型 含义 date 3字节,日期,格式:2014-09-18 time ...
- 5.Longest Palindromic Substring (String; DP, KMP)
Given a string S, find the longest palindromic substring in S. You may assume that the maximum lengt ...
- Java中的Filter
filter过滤器主要使用于前台向后台传递数据是的过滤操作.程度很简单就不说明了,直接给几个已经写好的代码: 一.使浏览器不缓存页面的过滤器 import javax.servlet.*; impor ...
- Distributing Ballot Boxes
Distributing Ballot Boxes http://acm.hdu.edu.cn/showproblem.php?pid=4190 Time Limit: 20000/10000 MS ...
- C#操作Excel 单元格的格式处理[xyytIT]
一. C# 操作 Excel 单元格自动填充,居中对齐,字体颜色等格式设置: Excel.Range titleRange = worksheet.get_Range(worksheet.Cells[ ...
- CentOS 安装 Docker CE
准备工作 系统要求 Docker CE 支持 64 位版本 CentOS 7,并且要求内核版本不低于 3.10. CentOS 7 满足最低内核的要求,但由于内核版本比较低,部分功能(如 overla ...
- 13-matlab图片转化
图片格式: 处理函数: rgb2gray() gray2rgb()
- Golang之单元测试
文件名必须以_test.go结尾 使用go test 执行单元测试 例 package main func add(a, b int) int { return a + b } func sub(a, ...
- PAT 1078 字符串压缩与解压(20)(代码+思路)
1078 字符串压缩与解压(20 分) 文本压缩有很多种方法,这里我们只考虑最简单的一种:把由相同字符组成的一个连续的片段用这个字符和片段中含有这个字符的个数来表示.例如 ccccc 就用 5c 来表 ...