Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How SQLServer cleans up log files

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how SQLServer cleans up log files. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Most of the time, the log file of SQLSERVER is not read, but after a long time, it is enough to burst the disk, so it is necessary to clean up the log file. Using the following method, after testing in the real environment, 400G log files are cleaned up in 1 second.

Operation steps

1. Change the recovery model to "simple"

Right-click Database-Properties, switch to options, and change the recovery model to simple.

two。 Shrink log

Right-click database-task-shrink-file

Once confirmed, you will find that the log files have been cleaned up quickly.

3. Command operation

Name of database to be cleaned by USE [master] GOALTER DATABASE-name of database to be cleaned by SET RECOVERY SIMPLE WITH NO_WAITGOALTER DATABASE-- name of database to be cleaned by simple mode GOUSE GODBCC SHRINKFILE (name of database to be cleaned by N' _ log', 2, TRUNCATEONLY)-set the size of the compressed log to 2m You can specify the name of the database to be cleaned by GOUSE [master] GOALTER DATABASE, the name of the database to be cleaned by SET RECOVERY FULL WITH NO_WAITGOALTER DATABASE, SET RECOVERY FULL-- restore to full mode GO, thank you for reading! This is the end of the article on "how to clean up log files in SQLServer". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report