Unable to shrink the logs file in Mssql 2012

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unable to shrink the logs file in Mssql 2012

    Hello,

    I am unable to shrink the database log files in Mssql 2012. I am using the below query for it.
    -------------------------------------------------------------
    BACKUP LOG "Databasename" WITH TRUNCATE_ONLY
    DBCC SHRINKFILE (Databasename_Log', 1)
    -------------------------------------------------------------
    Can anyone help me please.

    Regards,
    Aidan.

    #2
    Re: Unable to shrink the logs file in Mssql 2012

    Hi Aidan,

    You can use the following query to shrink the database log file :

    USE [Database_Name]
    GO
    ALTER DATABASE [Database_Name] SET RECOVERY SIMPLE WITH NO_WAIT
    DBCC SHRINKFILE(Database_Name_log, 1)
    ALTER DATABASE [Database_Name] SET RECOVERY FULL WITH NO_WAIT
    GO

    Regards,
    "It Takes 20 Years To Build A Reputation And Five Minutes To Ruin It. If You Think About That, You'll Do Things Differently. "

    Comment


      #3
      Re: Unable to shrink the logs file in Mssql 2012

      Hello,

      Thanks for your reply it really works.

      Regards,
      Aidan B

      Comment

      Working...
      X