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文件 去本地目录找本身的那 ...
随机推荐
- ReentrantLock 使用
从使用场景的角度出发来介绍对ReentrantLock的使用,相对来说容易理解一些. 场景1:如果发现该操作已经在执行中则不再执行(有状态执行) a.用在定时任务时,如果任务执行时间可能超过下次计划执 ...
- mysql mapper中增删查改
//1.增 public int insert(Port port) ; //2.删 public int deleteM(String id);//3.改 public int update(Por ...
- Java.sql.SQLException: 无效的列类型: 1111
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: ...
- Python3 pow() 函数
Python3 pow() 函数 Python3 数字 描述 pow() 方法返回 xy(x的y次方) 的值. 语法 以下是 math 模块 pow() 方法的语法: import math mat ...
- Java学生信息增删改查(并没用数据库)
一个泛型的应用,Java版本增删改查,写的简陋,望批评指正 2016-07-02 很久前写的一个程序了.拿出来存一下,不是为了展示啥,自己用的时候还可以看看.写的很粗糙. import java.io ...
- python之面向对象之继承
#写一个类SchoolMember class SchoolMember(object): member_num = 0 def __init__(self,name,age,sex): self.n ...
- 836. Rectangle Overlap 矩形重叠
[抄题]: A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of i ...
- php多进程 防止出现僵尸进程
对于用PHP进行多进程并发编程,不可避免要遇到僵尸进程的问题. 僵尸进程是指的父进程已经退出,而该进程dead之后没有进程接受,就成为僵尸进程(zombie)进程.任何进程在退出前(使用exit退出) ...
- 对于Android开发,啥是高级工程师?
最近一直在思考自己的技术方向.新的技术永远都是层出不穷,kotlin,flutter,小程序,轻应用等等,但是作为一个老鸟,新的东西,永远都是学不完的,想在新的技术上迭代学习出一个新高度,而增加自己的 ...
- php用get方式传json数据 变成null了
$data = I('param.data'); $data=stripslashes(html_entity_decode($data));//$data为传过去的json字符串