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»»

Unable to shrink a 50GB log db file Expand / Collapse
Author
Message
Posted Friday, December 21, 2012 1:41 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 3:04 PM
Points: 6, Visits: 21
Hello there,
I'm trying to shrink a 50GB log db file down to GB using the following script.

USE [master]
GO
ALTER DATABASE [database] SET RECOVERY SIMPLE WITH NO_WAIT;
GO

USE [database]
GO
DBCC SHRINKFILE (N'database_name_log' , 0, TRUNCATEONLY)
GO


USE [master]
GO
ALTER DATABASE [database] MODIFY FILE ( NAME = N'database_name_log', SIZE = 204800KB ,
FILEGROWTH = 1048576KB )
GO

USE [master]
GO
ALTER DATABASE [database] SET RECOVERY FULL WITH NO_WAIT;
GO


but it wont do anything to the log file. I did check for open transactions using opentran and this is what I see:

Replicated Transaction Information:
Oldest distributed LSN : (0:0:0)
Oldest non-distributed LSN : (1686:11756:1)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

I've reading allover that the non-distributed LSN value means that there is some incomplete replication that's still pending but then there is no replication going on in the DB setup, what else could be preventing the shrink that I'm trying to get done? Please advise.

Thanks in Advance!!

Regards,
Madhu
Post #1399583
Posted Friday, December 21, 2012 1:47 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 3:04 PM
Points: 6, Visits: 21
Forgot to mention that the size of MDF is just around 2GB and also this seems to be taking up a lot of space on the data drive.
Post #1399584
Posted Friday, December 21, 2012 1:54 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:48 AM
Points: 39,980, Visits: 36,347
You have (or had) snapshot replication?
See this article, specifically the section on replication, and the blog post that it references
http://www.sqlservercentral.com/articles/Transaction+Log/72488/

p.s. The truncateonly option is not valid for log files. It's ignored. Don't shrink log files to 0. Shrink to a sensible size.



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 #1399585
Posted Friday, December 21, 2012 2:08 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 3:04 PM
Points: 6, Visits: 21
I'm dont think there were any snapshot replications that were done on this db but I did run the following query:
SELECT name, recovery_model_desc, log_reuse_wait_desc
FROM sys.databases

and the log_reuse_wait_desc shows 'REPLICATION' against the db that is in concern. Not sure what else could be going on here
Post #1399589
Posted Friday, December 21, 2012 3:11 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:48 AM
Points: 39,980, Visits: 36,347
CDC perhaps? It uses the replication log reader hence shows as replication.

Please have a look at the article I referenced.



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 #1399602
Posted Friday, December 21, 2012 3:15 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 3:04 PM
Points: 6, Visits: 21
CDC is not enabled on this db. Verified using the following query:
SELECT [name], database_id, is_cdc_enabled
FROM sys.databases
Post #1399607
Posted Friday, December 21, 2012 3:19 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:48 AM
Points: 39,980, Visits: 36,347
If you have a replication log wait then you have either CDC or replication somewhere, either running or improperly removed. Please see the article I referenced.


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 #1399610
Posted Friday, December 21, 2012 3:28 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 3:04 PM
Points: 6, Visits: 21
Ok, based on the queries suggested in the article, I do not see any replication tasks or CDC going on in my DB. The article says that on a 2005 SQL there was a bug which caused the log wait to be set to replication status but I'm using SQL 2008R2 Express edition. Are there anyother queries that I can use to check on possible replication tasks or improper truncations?

Thanks!
Post #1399616
Posted Friday, December 21, 2012 3:50 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:48 AM
Points: 39,980, Visits: 36,347
If you know there's no replication inentionally configured and running, then just take the steps listed to remove the replication effects.


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 #1399622
Posted Monday, December 24, 2012 8:52 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, February 15, 2013 3:04 PM
Points: 6, Visits: 21
I was able to remove the replication using the SP sp_removedbreplication and it did drop down the size of the ldf file but I'm still curious to know what might have caused this lockup... is there a way to determine this before I use this same SP once again if I were to come across the same scenario?

Thanks once again for the assistance!!

Regards,
Madhu
Post #1399922
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse