SQL Server 2012 egg-hurting log files

Source: Internet
Author: User

A day at work see a database on SQL Server 2012 D on disk 80%, a moment feeling bad. So look at the hard disk, a small 200M database file, dragging a 6G log file. But I feel depressed.

So it's easy to open a database--------shrink-to-file

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/EE/wKioL1ivz8LS_xHmAABv-yFWUa0145.png-wh_500x0-wm_ 3-wmp_4-s_1798577468.png "title=" Qq20170224141614.png "alt=" Wkiol1ivz8ls_xhmaabv-yfwua0145.png-wh_50 "/>

After the point is confirmed, the effect is not obvious. The command is good when necessary.

Use Dbnamegobackup database DBNAME to disk= ' D:\DataBases\Backup\DBNAME.bak ' with Init;backup log DBNAME to disk= ' D:\DataB Ases\backup\dbname.log ' godbcc shrinkfile (' Dbname_log ', 0, truncateonly) GO

The small partners who have done the database should know that when backing up, some logs will be converted into data and stored in the data file so that the log file space will be empty.

So when you run backup log, you will receive the backup information from the database.

The DBCC SHRINKFILE is the operation that compresses the log file.

This article from "jyancing" blog, declined reprint!

SQL Server 2012 egg-hurting log files

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.