Wednesday, September 24, 2008

One of my customer reported the error "Transaction (Process ID xxx) was deadlocked on (xxx) resources with another process and has been chosen as the deadlock victim. Rerun the transaction." In my customers case the deadlock error was :

1Transaction (Process ID 75) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

As it appears that this is a resource deadlock and one resource is waiting for sub resources in a cyclic manner for long and the resource which is has done the least amount of work will be marked as deadlock victim by the SQL Server 2005. The resource can be block due to communication buffer or waiting threads or combination of both.

Typically the Trace Flag 1204 Report generates the results depending on the resource involved but the somehow the report format remain same.

To start Trace Flag 1204, type the following command - be advised that here we are starting the sqlserver instance with the Trace Flags:

C:\Program Files\Microsoft SQL Server\binn\sqlservr   T1204  T3605

The other way to enable the Trace Flags is to add them in the startup properties within the Enterprise Manager.

To see which Trace Flags are enabled type:

dbcc tracestatus(-1)

 

 

9/24/2008 1:37:50 PM UTC  #    Disclaimer  |  Comments [0]  | 
 Monday, September 22, 2008

Database Engine Tuning Advisor

9/22/2008 1:23:23 PM UTC  #    Disclaimer  |  Comments [0]  | 
 Sunday, September 21, 2008

Last month I was contacted by a company, they were complaining that since they have migrated from SQL Server 2000 to 2005 the performance of their web application is not only decreasing but sometimes the SQL Server stop responding and the only workaround the DBA was finding is the restart of services - sounds too painful.

I started Analyzing the machine configuration to see whether the machine is as per the requirements, the machine was 8 processor with 8 GB of RAM - more then enough. The Page File size and the Database Size were also as per the recommendation, then what's the problem?

I took more time to figure out by having few more questions.

Q-Were SQL Server 2000 and IIS running on the same machine?
A- Yes.

Q- After migration, doesn IIS running on the same machine?
A- No.

One of the obvious reason was the database design itself, but i was not touching the area because it might become an offense to the database design team.

Q- How the Database was migrated?
A- Using the Database Migration Assistant.

Another obvious reason, the migration tool can only migrate from 2000 to 2005 and can't change any logic - as the name complies.

9/21/2008 1:22:15 PM UTC  #    Disclaimer  |  Comments [0]  | 
 Saturday, September 20, 2008

As an administrator its your responsibility to monitor your server on regular intervals and Dynamic Management Views and Dynamic Management Functions play vital role in providing help to ease the monitoring process.

The DMV and DMF returns server state information that can be use to monitor server health, performance bottleneck and issues.

To find out what sort of DMV and DMF in SQLServer, issue this query in SQL Window

use master
go
select name
from sys.all_objects
where name like 'dm%
order by name
go

This will list a number of them, the naming convention help you in identifying what each of them is meant for.

As a hint its another way to view the Performance Monitor counter through T-SQL.

Let say you as administrator wants to view the Operating System Performance Counter, simply issue this query and you will come to know the performance counter

select object_name,
 counter_name,
 instance_name,
 cntr_value
from
 sys.dm_os_performance_counters
where
counter_name in
 ('buffer cache hit ratio',
 'user connections',
 'transactions',
 'average wait time (ms)',
 'transactions/sec',
 'errors/sec',
 'target server memory (kb)',
 'total server memory (kb)'
)
order by object_name, counter_name
go

Similarly by issuing this query you can have a similar display as of the Activity Monitor

select session_id,
 login_name,
 cpu_time,
 memory_usage,
 status
from sys.dm_exec_sessions
go

Further if you like to view what has actually executed for a particular session you can issue this statement

select T.text
from sys.dm_exec_requests R
cross apply sys.dm_exec_sql_text(sql_handle) as T
where R.session_id = 57
)
go

And for those who wants to see everything from single statement can rely on the below SQL

select T.text
from sys.dm_exec_requests R
cross apply sys.dm_exec_sql_text(sql_handle) as T
where R.session_id in
(
select
session_id,
from sys.dm_exec_sessions
)

So you've seen that how easy it would be to perform Performance Monitoring but in reality its not as easy as it sounds, so far Microsoft has rewarded you DMV and DMF for your patience but solving out the issues by reading these counters is another big challenge.

Bandagi!

9/20/2008 12:42:51 PM UTC  #    Disclaimer  |  Comments [0]  | 
 Friday, September 19, 2008

"The objective of this book is to [hopefully] help people begin to grasp what can be done with SQL Server 2008. The book is part conceptual, exploring the new features and abilities of this generation enterprise database product, and it is part tengible, demonstrating features using C# code and a new and improves T-SQL."

– Peter DeBetta

Some of the chapters

Chapter 1: Security and Administration
Chapter 2: Performance
Chapter 3: Type System
Chapter 4: Programmability
Chapter 5: Storage
Chapter 6: Enhancements for High Availability
Chapter 7: Business Intelligence Enhancements

Download for free from Microsoft Press!

http://csna01.libredigital.com/?urss1q2we6

Hurry up!!!

Bandagi!

9/19/2008 7:07:47 PM UTC  #    Disclaimer  |  Comments [0]  | 
 Tuesday, September 16, 2008

Policies may vary based on organizational needs but here are some of the recommendations which may help in crafting the internet access, well i say in my organization ineternet access policy plays a vital role in protecting the electronic assets.

- All Internet activity should be related to company business only.

- Internet is a public domain so act accordingly regarding company confidentiality policies.

- All data should pass through centralized location with LAN, users should be permitted to use modems through their workstations. To help enforce this, users do not have access to analog phone lines at their workstation.

- Frequently access websites should regularly be monitored wherever necessary

- Internet bandwith should be in control and specially during office should be provided on request basis.

- Access to sites not permitted should be enable through proper justification.

- Email and Messaging websites should never be allowed within the corporate boundries, where necessary all email data should routed through email exchange (e.g. MS Exchange Server)

- Most of the applicatons require access to Ports, this should be controlled through firewall rule settings (e.g McAfee Desktop Firewall)

9/16/2008 12:01:31 PM UTC  #    Disclaimer  |  Comments [0]  |