December 19, 2014 at 1:25 pm
I'm having a serious problem with the log file on one of my servers. While the primary and secondary db files themselves only add up to about 25 GB, the log has grown to nearly 250 gb, even though log backups (running hourly) consistently yield 1.3 GB .trn files. I have tried multiple shrink operations, both via the SSMS interface and T-SQL with no success. According to the interface there is 0 available free space. I have even tried changing the recovery model to simple with no success (I know, spare me the lecture. I'm desperate). I'm becoming desperate because all of my full backups are routinely taking up that entire amount of storage, even though (logs and all) they should be taking no more than 30 GB.
Tom
December 19, 2014 at 1:58 pm
Was replication ever implemented? Database Mirroring? Either of those, without a system on the other side receiving updates, will prevent the log from being re-used.
http://www.sqlservercentral.com/articles/Database+Mirroring/117489/
http://www.sqlservercentral.com/articles/Replication/107698/
December 19, 2014 at 2:09 pm
Replication had been failing and has since been removed.
December 19, 2014 at 2:09 pm
You can find what the transaction log is waiting on by running the following and replacing <dbname> with the name of the database in question. This should point you in the direction to resolve the issue.
SELECT name, log_reuse_wait_desc
FROM sys.databases
WHERE name ='<dbname>'
December 19, 2014 at 2:31 pm
The results of the helpdb execution are as follows:
namedb_sizeownerdbidcreatedstatuscompatibility_level
CampusVue 266730.13 MBc20008Aug 17 2011Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=FULL, Version=655, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAnsiNullsEnabled, IsAnsiPaddingEnabled, IsAnsiWarningsEnabled, IsArithmeticAbortEnabled, IsAutoCreateStatistics, IsAutoUpdateStatistics, IsFullTextEnabled, IsNullConcat, IsQuotedIdentifiersEnabled90
I know that's a little scrambled but I'm sure you know what you're looking at. I tried the fix in the article your sent with the remove replication execution, which stated it complete successfully, but I was still unable to shrink the log. I was quite hopeful, because the fictional scenario is my place exactly.
December 19, 2014 at 2:38 pm
The results of:
SELECT name, log_reuse_wait_desc
FROM sys.databases
WHERE name = 'dbname'
was:
name log_reuse_wait_desc
CampusVue REPLICATION
And this is after running:
EXEC sys.sp_removedbreplication @dbname = dbname
GO
December 19, 2014 at 3:03 pm
I really am at my wits end with this.
December 19, 2014 at 3:15 pm
Since you ran the stored proc to remove replication, it might be that Change Data Capture may be enabled and the SQL Agent jobs are not running. What does the following return?
SELECT name, is_cdc_enabled
FROM sys.databases
WHERE name='<dbname>'
December 19, 2014 at 3:31 pm
It returns a "1". How do I disable CDC? I have two jobs, CDC enable and CDC cleanup.
December 19, 2014 at 3:56 pm
Actually those two jobs are "CDC Capture" and "CDC Cleanup".
December 19, 2014 at 4:00 pm
Alright, now we are getting some where. If you are using cdc, you should enable and run the CDC jobs. There should be capture and cleanup jobs. The capture job should run continuously and the cleanup job should run daily. Now if you REALLY want to disable CDC, you can run the following.
USE <dbname>
GO
EXEC sys.sp_cdc_disable_db
GO
If this doesn't work, you may have to manually remove CDC. This article describes the process.
Edit - link came up wrong
December 19, 2014 at 4:44 pm
Okay, I ran the following query:
USE MyDB
GO
EXEC sys.sp_cdc_disable_db
GO
I am now seeing that the log is 98% free space. I'm pretty sure I can take this from here.
THANK YOU for you help!!!
December 19, 2014 at 5:38 pm
Please mark Jeremy's advice as the correct answer if it worked. That will help others find the answer.
December 22, 2014 at 4:53 am
Hi,
Tsql to Disable CDC:
USE <Name of the database>
GO
EXEC sys.sp_cdc_disable_db
GO
You dont have to delete the jobs or manually disable the CDC from tables. Running the above statement would automatically remove all the CDC metadata from your database.
You would need SYSADMIN privileges to run this command.
Hope it Helps..!!!
Regards
Shafat Husain
Regards,
Shafat Husain
🙂
And Your Lord Never Forgets...!! (64:19 -- Quran)
December 22, 2014 at 4:53 am
OOps-- Duplicate Answer
Regards,
Shafat Husain
🙂
And Your Lord Never Forgets...!! (64:19 -- Quran)
Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic. Login to reply