I've a database in a production server which has a log that is getting enormous, while trying to understand the reason, I've issued this query:
SELECT name, log_reuse_wait_desc FROM sys.databases
The database in question has DATABASE_SNAPSHOT_CREATION, and even tough the docs say it should be a momentary state, it's been in this state for 10 mins. I'm g开发者_如何学编程uessing it's what's keeping the log from becoming manageable.
How can I fix this?
PS: I'm using the SIMPLE recovery mode.
OK - Try running DBCC SQLPERF(LOGSPACE). That will tell you how much of that log file is actually being used.
I had a similar issue, now it is sorted out :)
-> database on simple recovery mode, showing up this DATABASE_SNAPSHOT_CREATION on the log_reuse_wait_desc.
what I did to sort it out was to run the script below:
use Databasename
go
checkpoint
the "checkpoint" part I run many times. after that no more DATABASE_SNAPSHOT_CREATION.
The scripts that I have used in my quest are the following:
DBCC SQLPERF(LOGSPACE)
select log_reuse_wait_desc, * from sys.databases
where log_reuse_wait_desc != 'NOTHING'
SELECT * FROM sys.dm_exec_requests
checkpoint
Do you have any large transactions open? Database snapshots are always taken of the database in a consistent state. If a large transaction has been running for, say, 10 minutes, the transaction has to be rolled back in the snapshot before the snapshot can be complete.
SELECT * FROM sys.dm_exec_requests
The above query can tell you what's running at the time it is run.
精彩评论