October 22, 2012 at 7:44 am
Hi Experts,
One of our VLDB(3TB) is inrecovery state after server restart and from sql log i got the message 2% completed of phase one and approximately 53268 seconds remaining. Database is in SIMPLE recovery mode,is that a reason for this high recovery time??If yes then how?? Can anyone suggest some tips on reducing recovery time??
Thanks in Advance.
October 22, 2012 at 8:19 am
Nope. Simple recovery is not the reason for the high recovery time. You either had huge uncommitted transactions when the DB shut down or you have severe log fragmentation or both.
Only thing you can do at this point is wait.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 22, 2012 at 6:22 pm
Agree with Master Gail Or if you do not need the Logs Just drop the database and then attached the data files with no ldf file. That way a fresh ldf file is created and you will not have any log history.
USE [master]
GO
EXEC sp_attach_single_file_db @dbname='TestDb',
@physname=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf'
GO
OR
CREATE DATABASE TestDb ON
(FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf')
FOR ATTACH_REBUILD_LOG
GO
October 23, 2012 at 12:58 am
As suggested by Gail When the Server Restarted there must be some Transaction that might be in rollback state.It might take lot of time to recover and also consume lot of log space.
If u have lastest backup u can resore it from the backup.
October 23, 2012 at 2:17 am
Mac1986 (10/22/2012)
Agree with Master Gail Or if you do not need the Logs Just drop the database and then attached the data files with no ldf file. That way a fresh ldf file is created and you will not have any log history.
That is absolutely horrid advice.
The database is in recovery, that means it was not cleanly shut down. If he were to do as you suggest, SQL would not be able to create a new log file (if can only do that when the database was cleanly shut down prior to the deletion) and the attach script you recommended will fail.
Hence, following your advice will turn this from an attached database in recovery to a database file that will not attach at all. Hardly an improvement.
(yes, it's possible to hack the DB back in and attempt an emergency mode repair. I say attempt, because it does not always succeed. Even if it does succeed, it will very likely leave the DB transactionally inconsistent, referentially inconsistent, potentially even structurally inconsistent)
Deleting a database's log file is a very good way of destroying that DB beyond any ability to recover (except via restoring backup)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 23, 2012 at 4:51 am
Thanks Gail,
The DB got recovered.
In a blog i read that SIMPLE recovery mode can cause high recovery interval since its not possible to take log backups and taking frequent log backup will reduce the recovery time is that true??
Will frequent log backup reduces VLF's created??
October 23, 2012 at 5:03 am
Ratheesh.K.Nair (10/23/2012)
In a blog i read that SIMPLE recovery mode can cause high recovery interval since its not possible to take log backups and taking frequent log backup will reduce the recovery time is that true??
No, as I said earlier, Simple recovery model is not in any way the cause of high recovery time. Log backups have nothing to do with recovery time. Recovery models have nothing to do with recovery time. Recovery time is a factor of the amount of operations that need to roll back (not committed) and the number of operations that have to roll forward (committed but not hardened to the data file). Neither of those is affected by recovery model.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 23, 2012 at 5:33 am
Thanks a lot Gail..You are awesome..
October 23, 2012 at 5:39 am
Just to add to Gails' points,
in simple recovery model the inactive log is cleared on check point. So VLFs are affted by the file growth setting/ the your transaction durations/ recovery interval setting at server level.
October 23, 2012 at 6:20 am
Thanks Roshan,
So you meant to say SIMPLE Recovery model can cause VLF to grow???
October 23, 2012 at 9:07 am
No, simple recovery does not in and of itself cause the log to grow.
Log growth is possible in any recovery model if the largest transaction (in simple recovery) or largest transaction/total transactions between log backups (full and bulk logged recovery models) require more spacew then the log has available.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 23, 2012 at 9:42 am
Thanks Again 🙂
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply