SQL Server Default Trace Application 3--Detect DDL operations on tables

Source: Internet
Author: User
Tags add time

SQL SERVER default tracking app 3-- Detection of DDL operations for tables


DDL operations that occur on the SQL Server database, can you tell who did it?

Yes. The SQL Server default trace has object modification events.

This script lists all the object modification events. Add time and database name restrictions to the query criteria.

Select E.name as Eventclass,t.loginname,t.spid,t.starttime,t.textdata,t.objectid,t.objectname,t.databasename, T.hostname,t.ntusername,t.ntdomainname,t.clientprocessid,t.applicationname,t.errorfrom sys.fn_trace_gettable ( CONVERT (VARCHAR), (SELECT TOP 1f.[ Value]from Sys.fn_trace_getinfo (NULL) f WHERE f.property = 2), DEFAULT) Tinner join sys.trace_events e on t.eventclass = E.trace_event_idwhere eventclass=164

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; "alt = "image" src= "http://s3.51cto.com/wyfs02/M01/53/EB/wKiom1Rz8L_SzO_0AADdQmAzZsM878.jpg" height= "border=" 0 "/ >

This article is from the "Dripping Stone Wear" blog, please be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1582296

SQL Server Default Trace Application 3--Detect DDL operations on tables

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.