How to disconnect database users in SQL Server

There are a few ways to do it:

either set the database in a single user mode

?View Code TSQLALTER DATABASE dbName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

or use the following code (this code I found on SQLServerCentral.com and is composed by Darwin Hatheway. The actual article was written by Brian Knight and can be accessed here.)

?View Code TSQLdeclare . . . → Read More: How to disconnect database users in SQL Server

Database development and more…

For a while now I have been working as a SQL Server consultant: performance evaluations, talking to my client’s vendors, answering SQL Server questions… It is a great job. Very rewarding, too. I gather experience and variety of other developers’ points of views.

Often I get confused, though. How is the application development done nowadays? Has something . . . → Read More: Database development and more…

Management Data Warehouse size issues

I have noticed that the MDW (PerformanceDW, Performance Data Warehouse) has been growing too big. It turned out that this is caused by a bunch of orphaned rows in the notable_query_plan table.

Here is a script which will solve the problem:

– Purge snapshots.notable_query_plan table

DECLARE @delete_batch_size bigint;

DECLARE @rows_affected int;

SET @delete_batch_size = 500;

SET @rows_affected = @delete_batch_size;

WHILE (@rows_affected = @delete_batch_size)

BEGIN

DELETE . . . → Read More: Management Data Warehouse size issues

How to compress your database… REALLY!

NB: Do NOT try any idea in this post at home, and DO NOT try it on your production server!

Here are some thoughts on database backup strategies, which were brought upon after reading Brent Ozar’s post on the topic.

In short, the problem is that Brent has a database which has to be backed up and the . . . → Read More: How to compress your database… REALLY!

Related Posts with Thumbnails
free counters