Presentation is loading. Please wait.

Presentation is loading. Please wait.

1.2 資料庫的監控. Overview Using SQL Profiler and Performance Monitor Integration Using DDL Triggers Using Event Notifications.

Similar presentations


Presentation on theme: "1.2 資料庫的監控. Overview Using SQL Profiler and Performance Monitor Integration Using DDL Triggers Using Event Notifications."— Presentation transcript:

1 1.2 資料庫的監控

2 Overview Using SQL Profiler and Performance Monitor Integration Using DDL Triggers Using Event Notifications

3 Lesson: Using SQL Profiler SQL Profiler Enhancements in SQL Server 2005 How to Save a Trace as XML

4 SQL Profiler Enhancements in SQL Server 2005 Profiling Analysis Services Tracing Showplan and deadlock events Saving results as XML Aggregating data

5 How to Save a Trace as XML Create and execute a trace File menu, Save As, Trace XML File Specify name and location for file

6 Lesson: Using DDL Triggers What Are DDL Triggers? How to Create DDL Triggers How to Manage DDL Triggers Demonstration: Creating a DDL Trigger

7 Process: What Are DDL Triggers? UPDATE STATISTICS someTable DDL statement executed 1 1 Triggers to trap DDL statement execution Database or server scope DDL action performed 2 2 Trigger fires 3 3 EventData

8 CREATE TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS... CREATE TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS... CREATE TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS DECLARE @data XML... SET @data = eventdata()... CREATE TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS DECLARE @data XML... SET @data = eventdata()... CREATE TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS DECLARE @data XML DECLARE @database NVARCHAR (100) SET @data = eventdata() SET @database = CONVERT(NVARCHAR(100), @data.query('data(//DatabaseName)'))... CREATE TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS DECLARE @data XML DECLARE @database NVARCHAR (100) SET @data = eventdata() SET @database = CONVERT(NVARCHAR(100), @data.query('data(//DatabaseName)'))... How to Create DDL Triggers Define the trigger name, scope, and event 1 1 Retrieve event information using eventdata() 2 2 Extract event data using query() 3 3

9 How to Manage DDL Triggers Viewing triggers Modifying triggers Deleting triggers SELECT name FROM sys.triggers SELECT definition FROM sys.sql_modules... SELECT name FROM sys.triggers SELECT definition FROM sys.sql_modules... ALTER TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS... ALTER TRIGGER UpdStats ON DATABASE FOR UPDATE_STATISTICS AS... DROP TRIGGER UpdStats ON DATABASE

10 Demonstration: Creating a DDL Trigger In this demonstration, you will see how to use a DDL trigger to audit database operations


Download ppt "1.2 資料庫的監控. Overview Using SQL Profiler and Performance Monitor Integration Using DDL Triggers Using Event Notifications."

Similar presentations


Ads by Google