SQL SERVER RULES

SQL SERVER RULES

Tuesday, March 6, 2012

DATA AUDITING IN SQL SERVER 2008

Hi guys,

DATA AUDITING is newly introduced concept in SQL SERVER 2008.

Auditing an instance of sql server or sql server database involves tracking and logging events that occurs on the system.There are several methods to audit the instance or database

---syntax for sql auditing.

create server audit example
to file (filepath = 'd:\example\')

alter server audit example
with (state = on)

---syntax for auditing the database in server audit file

create database audit specification example_db
for server audit example
add(insert ,select ,drop,delete on table_name by schema_name)
with (state = on)

---To check the data auditng by using the system function

select * from fn_get_audit_file('d:\xxx\',null,null)


Hope u gusy got the Basic idea about DATA AUDITING IN SQL SERVER

Plan Guides in SQL Server 2008

Hi Guys,

Plan Guides is one of the system procedure which in newly introduced in SQL Server 2008 i.e
sp_create_plan_guides which is likely for to optimize the performance of queries.This procedure can be very useful when yo cannot change the text directly.

By using OPTION Clause that contanins the query hints for optimize the query performance

syntax for Plan Guides.

sp_create_plan_guide
@name =N 'example',
@stmt =N 'select * from table where country = @country',
@type = N'object',
@module_or_batch = N'tablename',
@parms = null,
@hint = N'option (optimize for @country = 'uk')'

Hope U guys got the minimum basic idea about the Plan Guides in SQL SERVER 2008