test<!-- 864 -->

  • Hi Experts,

    I am not able to delete a db log file .I used the below command to delete but its throwing error. The DB is primary in Always ON

    USE ABC

    GO

    DBCC SHRINKFILE('ABC_Log4', EMPTYFILE)

    GO

    ALTER DATABASE [ABC_XSM] REMOVE FILE [ABC_Log4]

    GO

    Cannot shrink log file 5 (ABC_Log4) because the logical log file located at the end of the file is in use.

    (1 row(s) affected)

    DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    Msg 5042, Level 16, State 2, Line 1

    The file 'ABC_Log4' cannot be removed because it is not empty.

    Moderators-Please excuse me for adding those polls it happened by mistake.

  • emptyfile does not apply to transaction logs.

    is the database in simple or full recovery?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Perry Whittle (8/20/2014)


    emptyfile does not apply to transaction logs.

    is the database in simple or full recovery?

    Thanks a lot Perry..

    DB is in full recovery mode and its the Primary of an Always On availability group.

  • run a couple of log backups in succession and try delete the file again

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Thanks Perry ..That helped

  • you're welcome, don't forget to mark the post as solution to help others

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 6 posts - 1 through 5 (of 5 total)

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