SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

SQL Server Soldier :: News from the frontlines of the database wars

Add to Technorati Favorites Add to Google
Browse by Tag : Dynamic Management Views (RSS)

Database snapshots can take a long time to create

Rating: |  Discuss | 4,783 Reads | 636 Reads in Last 30 Days |no comments

Database Snapshots Can Take a Long Time to Create

Believe it, it's true!! One of the big selling point for database snapshots is that creating them is almost instantaneous. Since a database snapshot is created as an empty shell, it should be and almost always is a very quick process. What they don't tell you is long running active transactions can extensively delay the creation of the snapshot file.

What's causing my snapshot creation to freeze for long periods of time?

When you create a database snapshot, the snapshot contains all open transactions at the time. As part of the initialization process, it calls the recovery process on the snapshot. Part of the recovery process is to roll back all active transactions in the snapshot (they do not roll back in the actual database). If there are long running transactions -- such as a large index rebuild -- running at the time of the snapshot creation, the rollback can take a really long time.

If it appears that your snapshot creation is frozen, you can check sys.dm_exec_requests, and you should see rollbacks in progress in the database snapshot.

According to Books Online:
Uncommitted transactions are rolled back in a newly created database snapshot because the Database Engine runs recovery after the snapshot has been created (transactions in the database are not affected).

Shhhh!! Be vewy, vewy quiet. I'm hunting Select *!!

Rating: (not yet rated) Rate this |  Discuss | 537 Reads | 15 Reads in Last 30 Days |no comments
"Select *" is bad. Everyone knows it, but everyone still uses it. I use it. Most of the time it is fairly innocuous. No harm, no foul, right? Updating your procedures to not use Select * can be a daunting task. Here's a tip to help you work smarter, not harder. Do less work that is more meaningful....

The Shadow Knows What Procedures Lurk in the SQL Plan Cache

Rating: (not yet rated) Rate this |  Discuss | 360 Reads | 12 Reads in Last 30 Days |no comments
How do you know what procedures are cached in SQL Server? Simple, just ask, and SQL Server will tell you.You can query the SQL Server dynamic management views to get a list of procedures in cache. In this example, I query sys.dm_exec_cached_plans and...