How does SQL Server database shrink log space?

Source: Internet
Author: User

Tag: SQL Server database log shrinks free space.

How SQL Server database shrinks log space


Description: SQL Server database log will become larger, especially when the space is tight, you have to shrink the log to release some of the space, the following means.


Version: SQL Server R2


Method:

    1.    new query, execute script. The script is as follows

      Note that the Red section needs to be modified to the appropriate database name. The green section needs to be modified to the corresponding database log name

      Use [ usrinf ]
      GO
      ALTER DATABASE usrinf SET RECOVERY simple with no_wait
      GO
      ALTER DATABASE usrinf SET RECOVERY simple
      GO
      use usrinf
      GO
      DBCC shrinkfile (N ' usrinf_log ', 0,truncateonly)
      GO
      Use [usrinf ]
      GO
      ALTER DATABASE usrinf SET RECOVERY full with no_wait
      GO
      ALTER DATABASE usrinf SET RECOVERY full
      GO



    2. Modify the recovery model for the corresponding database to a simple mode .  such log files can grow very slowly.

Right------options on the database-----Recovery Mode-----Simple


650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7A/6A/wKiom1aohfuBWbaqAAEGqGY2bwM720.jpg "title=" 96a65e25-7f49-4f09-9f82-03ca6e1b186a.jpg "alt=" Wkiom1aohfubwbaqaaegqgy2bwm720.jpg "/>







This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://pizibaidu.blog.51cto.com/1361909/1739290

How does SQL Server database shrink log space?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.