|
|
|
Forum 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
|
|
|
|
|
Forum 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.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:30 AM
Points: 37,742,
Visits: 30,021
|
|
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
|
|
|
|
|
Forum 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
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:30 AM
Points: 37,742,
Visits: 30,021
|
|
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
|
|
|
|
|
Forum 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
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:30 AM
Points: 37,742,
Visits: 30,021
|
|
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
|
|
|
|
|
Forum 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!
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:30 AM
Points: 37,742,
Visits: 30,021
|
|
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
|
|
|
|
|
Forum 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
|
|
|
|