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