SQL2012SP1, simple recovery, transaction log full, can't add another, won't grow

  • SUMMARY:

    I have many databases with full transaction logs. They are already in SIMPLE recovery model,

    and I cannot add a new log or truncate the existing one, because the transaction log is full due to 'CHECKPOINT'

    DETAILS:

    (Examining just one of the problematic databases)

    I have a SQL Server 2012 SP1 database with a full transaction log.

    This database has one data file (750MB) and one log file (850MB)

    Compatibility level = SQL Server 2012 (110)

    Recovery Model is Simple

    Under Recovery Options, Page Verify=CHECKSUM and Target Recovery Time=0

    I had 5G of free disk (which should have been enough), and I added more, so now I have 25G free.

    My log file growth is set to: "By 10 percent, Limited to 2097152 MB "

    (I can't change it - if I try I get an error because the transaction log is full)

    I can't do a backup - get an error because the transaction log is full due to 'CHECKPOINT'

    I can't add another log file - get an error because the transaction log is full due to 'CHECKPOINT'

    Verifying that file#2 is my log file

    SELECT file_id, name FROM sys.database_files;

    I can't do a truncate only shrink successfully:

    DBCC SHRINKFILE (2, TRUNCATEONLY);

    - get an error because my log is out of space - with a cascade error that the transaction log is full due to 'CHECKPOINT'

    DBCC CHECKDB mostly just gives errors because the transaction log is full due to 'CHECKPOINT'

    I can't change the recovery model to full - get an error because the transaction log is full due to 'CHECKPOINT'

    I can't change the recovery model to bulk-logged - get an error because the transaction log is full due to 'CHECKPOINT'

    From sys.databases,

    is_read_only=0, state=0, state_desc=ONLINE, is_in_standy=0

    is_cleanly_shutdown=0, is_supplemental_logging_enabled=0

    is_read_committed_snapshot_on=0

    recovery_model=3, recovery_model_desc=SIMPLE

    is_fulltext_enabled=1

    is_published=0, is_subscribed=0, is_merge_published=0, is_distributed=0, is_sync_with_backup=0

    is_broker_enabled=1, log_reuse_wait=1, log_reuse_wait_desc=CHECKPOINT

    I tried doing a manual CHECKPOINT (using the CHECKPOINT cmd in MgmtStudio) and got errors:

    (1 row(s) affected)

    Msg 5901, Level 16, State 1, Line 3

    One or more recovery units belonging to database 'MYDATABASENAME' failed to generate a checkpoint. This is typically caused by lack of system resources such as disk or memory, or in some cases due to database corruption. Examine previous

    entries in the error log for more detailed information on this failure.

    Msg 9002, Level 17, State 1, Line 3

    The transaction log for database 'MYDATABASENAME' is full due to 'CHECKPOINT'.

    SELECT count(*) FROM fn_dblog (NULL, NULL);

    4,521,289

    That seems like a lot !?

    My ERRORLOGs are full of errors about full transaction logs. I have many databases with this same issue - I've just focused on one, for testing.

    DBCC OPENTRAN

    gives me no open transactions

    However,

    select * from sys.dm_tran_database_transactions where database_id = MYDBID

    gives me 6 rows, of which 4 have null begin times

    I tried using

    select request_session_id, * from sys.dm_tran_locks where resource_database_id = MYDBID and resource_subtype = 'BULKOP_BACKUP_LOG'

    and killing those sessions, but they always come back immediately

  • Is it possible there are any uncommitted distributed transactions? What is the initial file size for the log file? Is the recovery interval value for the database set at the default of 0? Have you tried issuing a CHECKPOINT? Try with a duration of 5 or 10; i.e. CHECKPOINT 5

  • Tommy Bollhofer (5/14/2013)


    Is it possible there are any uncommitted distributed transactions?

    I ran "DBCC OPENTRAN" and got an empty response (detailed in post above). 🙁

    Is there something else possibly worth checking?

    What is the initial file size for the log file?

    The "initial file size" is 849MB now (I estimated it at 850MB in post above). As there are a couple hundred VLFs, it was no doubt small originally. I don't know the original setting.

    Is the recovery interval value for the database set at the default of 0?

    If you mean the "Target Recovery Time (Seconds)", that is still 0, as specified in post above. If you mean, can I change it from 0, I tried to change it to 2, but it fails with the (locally popular) message that the transaction log is full. 🙁

    If you mean something else, please excuse my ignorance and point me in a direction, and I'll go look.

    Have you tried issuing a CHECKPOINT? Try with a duration of 5 or 10; i.e. CHECKPOINT 5

    I tried it with no duration and got errors (detailed in post above).

    If I try it with a checkpoint_duration of 5, (i.e., "CHECKPOINT 5"), I get the same error. 🙁

  • Looking at

    SELECT * FROM sys.dm_exec_requests where command like '%LOG%' or command like '%CHECKPOINT%' or wait_type like '%LOG%'

    I see a CHECKPOINT command with a wait_type of LOGMGR_RESERVE_APPEND, and some other lines. I am suspicious that if I just had more knowledge, I could deduce something useful from the information in that view.

  • There is a fix for a similar issue in CU2 for SP1. Even if you did not upgrade these databases, I would try that CU.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • So this particular release and situation will not allow you to increase the existing log file size when it gets full?

  • I have not run into that bug with this release (2012 SP1). But it appears that it is out there and there is potential for it.

    But it is safe to assume that since there is a fix for it in a CU, that you could end up in a situation where you will not be able to release log space without the CU.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQLRNNR (5/14/2013)


    I have not run into that bug with this release (2012 SP1). But it appears that it is out there and there is potential for it.

    But it is safe to assume that since there is a fix for it in a CU, that you could end up in a situation where you will not be able to release log space without the CU.

    The reason I asked about just increasing the log size is that it was my understanding that increasing the log file size would add log space instead of trying to release existing log space (as they're probably in use), so I was seeing if my understanding was incorrect. Wouldn't be the first time!

  • patrickmcginnis59 10839 (5/14/2013)


    SQLRNNR (5/14/2013)


    I have not run into that bug with this release (2012 SP1). But it appears that it is out there and there is potential for it.

    But it is safe to assume that since there is a fix for it in a CU, that you could end up in a situation where you will not be able to release log space without the CU.

    The reason I asked about just increasing the log size is that it was my understanding that increasing the log file size would add log space instead of trying to release existing log space (as they're probably in use), so I was seeing if my understanding was incorrect. Wouldn't be the first time!

    Operations of that nature are one at a time. So if a checkpoint is in progress, it has to complete in order for the file growth to be able to happen. The checkpoint (in laymans terms) releases log space. The file growth would be adding space.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • FYI, I believe this was the fix SQLRNNR was referring too -

    http://support.microsoft.com/kb/2509302

    CU2 for SP1 available via -

    http://support.microsoft.com/kb/2790947

  • SQLRNNR (5/14/2013)


    patrickmcginnis59 10839 (5/14/2013)


    SQLRNNR (5/14/2013)


    I have not run into that bug with this release (2012 SP1). But it appears that it is out there and there is potential for it.

    But it is safe to assume that since there is a fix for it in a CU, that you could end up in a situation where you will not be able to release log space without the CU.

    The reason I asked about just increasing the log size is that it was my understanding that increasing the log file size would add log space instead of trying to release existing log space (as they're probably in use), so I was seeing if my understanding was incorrect. Wouldn't be the first time!

    Operations of that nature are one at a time. So if a checkpoint is in progress, it has to complete in order for the file growth to be able to happen. The checkpoint (in laymans terms) releases log space. The file growth would be adding space.

    I'm just trying to think of it from a systems standpoint. The checkpoint is no longer in progress (sounds like it never even started according to the OP), so I get that, and its no longer going to free any more log records (virtual log files I guess). So what stops SQL server from making more space for more log records? Heck, looking at the original post he really had plenty of log space it seems. Even the operations of that nature seems like it does not have to progress one at a time to me even in a single threaded program you can mark your place after a fixed amount of progress with a task, go allocate some resources, and pick up where you left off. I could certainly understand if its an SQL Server specific situation (like not resizing the tempdb on a busy system) This sounds serious enough that I think its ok if you can describe it somewhat beyond lay terms, I'm pretty sure I've just landed on this version so I know I'd like to know all I can!

    From Microsoft:

    log_reuse_wait_desc value CHECKPOINT

    No checkpoint has occurred since the last log truncation, or the head of the log has not yet moved beyond a virtual log file. (All recovery models)

    This is a routine reason for delaying log truncation. For more information, see Database Checkpoints (SQL Server).

    In the cited article, these log records weren't released even thought T-LOGS were taken under a full recovery model. But theres no mention that the T-LOGS failed to be made. In this case, CHECKPOINT itself fails!

    For the original poster, have you been running checkdb's routinely? Just curious given the error messages.

  • This may or may not have anything to do with the problem but... Have you checked TempDB?

    I've run into issues where the TempDB log is full up and won't let me do operations on other databases until TempDB is cleared & shrunk.

    This is not something I recommend for the unwary, BTW. But it is a note of interest that the Shrinking operation often requires more space during its run.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • re: SQL2012SP1CU2 & stuck transaction log KB: http://support.microsoft.com/kb/2509302

    I considered that, but

    #1) That KB says it is for databases in Full Recovery Model

    #2) It says it occurs as a result of a script run during upgrade. My stuck databases were all created on SQL2012.

    This issue occurs because the "tran_sp_MScreate_peer_tables" transaction was left open by a replication upgrade script during the upgrade. This open transaction prevents usual log truncation.

    #3) Following along the diagnostic steps given further down in the article

    I don't even have this registry key: HKLM\SOFTWARE\Microsoft\MSSQLServer\Replication

    and I get nothing back from

    select * from sys.dm_tran_active_transactions where name = 'tran_sp_MScreate_peer_tables'

  • Brandie suggested looking at the tempdb and expanding it if it is out of space.

    Also, in my post, I recommended running the CU whether or not you have upgraded (which would invoke the upgrade scripts).

    Try the tempdb thing and then be prepared to still apply that CU.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Good point. There are other options available. Have you consider the potential for data loss? The following thread may be helpful.

    http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/76e99d3a-0d6b-4ee3-8f22-6d56c3c6e50c/[/url]

Viewing 15 posts - 1 through 15 (of 26 total)

You must be logged in to reply to this topic. Login to reply