Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Database inrecovery Expand / Collapse
Author
Message
Posted Monday, October 22, 2012 7:44 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, September 15, 2014 5:34 AM
Points: 2,609, Visits: 3,903
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.
Post #1375429
Posted Monday, October 22, 2012 8:19 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:28 PM
Points: 43,028, Visits: 36,193
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 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1375447
Posted Monday, October 22, 2012 6:22 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Sunday, September 14, 2014 1:28 AM
Points: 219, Visits: 693
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

Post #1375795
Posted Tuesday, October 23, 2012 12:58 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Yesterday @ 8:10 PM
Points: 81, Visits: 918
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.
Post #1375860
Posted Tuesday, October 23, 2012 2:17 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:28 PM
Points: 43,028, Visits: 36,193
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 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1375890
Posted Tuesday, October 23, 2012 4:51 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, September 15, 2014 5:34 AM
Points: 2,609, Visits: 3,903
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??
Post #1375958
Posted Tuesday, October 23, 2012 5:03 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:28 PM
Points: 43,028, Visits: 36,193
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 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1375962
Posted Tuesday, October 23, 2012 5:33 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, September 15, 2014 5:34 AM
Points: 2,609, Visits: 3,903
Thanks a lot Gail..You are awesome..
Post #1375972
Posted Tuesday, October 23, 2012 5:39 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 11:52 PM
Points: 617, Visits: 1,275
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.


-- Roshan Joe
*******************************************
Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help
Custom cleanup script for backups
Post #1375977
Posted Tuesday, October 23, 2012 6:20 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, September 15, 2014 5:34 AM
Points: 2,609, Visits: 3,903
Thanks Roshan,

So you meant to say SIMPLE Recovery model can cause VLF to grow???
Post #1375996
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse