Home Database Mysql Tutorial SQL SERVER数据库日志清空图文教程

SQL SERVER数据库日志清空图文教程

Jun 07, 2016 pm 04:17 PM
server Graphics and text Tutorial database log Clear

数据库日志不停疯长,如何进行清空呢?这里以一台数据库SQL SERVER 2005为例, 日志文件达到了100多个G一直无法清理,想了很多的办法: 比如下面这款SqlServer日志清除专家,可用于SQL Server 7、SQL Server 2000、SQL Server 2005的各种版本的数据库日志的

数据库日志不停疯长,如何进行清空呢?这里以一台数据库SQL SERVER 2005为例, 日志文件达到了100多个G一直无法清理,想了很多的办法:

比如下面这款SqlServer日志清除专家,可用于SQL Server 7、SQL Server 2000、SQL Server 2005的各种版本的数据库日志的清除。

这个工具一清就可以清干净的。使您再也不用担心数据库日志文件超过几百兆或上GB级而烦恼。

第二个方法就是采用了一个比较死的办法。采用 分离,,然后再删除日志文件再附加来生成一个新的日志文件。

切记在操作前先把SQL好好的备份一下。

第一步 当然还是打开企业管理器了

SQL SERVER数据库日志清空图文教程 三联

在分离前最好是先把IIS之类的正在连接数据库的程序关一下,要不然老半天也分离不了。

SQL SERVER数据库日志清空图文教程

也可以选择一下 删除链接 这样可能分离会快一点。

我们再定位到数据库所在的硬盘位置

我们为了保除起见可以把 qq2.mdf备份一份,然后再将 qq2_log.ldf 这个文件重命一下名(200G的文件实在是没地方可以备份)。

然后我们再来附加数据库

SQL SERVER数据库日志清空图文教程

SQL SERVER数据库日志清空图文教程

附加到刚刚那个 mdf的文件。注意看下面会提示 .ldf 文件找不到。

SQL SERVER数据库日志清空图文教程

不管他了。选择 .ldf这一分把他给删掉。

然后再确定,哈还原成功了。系统自动生成了一个新的 ldf 文件  504KB

建议大家先用上面的那个工具去清一下,如果清不到再用这个死办法来删除日志。

最后再次提醒各位一定要注意备份噢!!

SQL2008 的收缩日志 
由于SQL2008对文件和日志管理进行了优化,所以以下语句在SQL2005中可以运行但在SQL2008中已经被取消:
(SQL2005)

go

go
USE DNName 

Go
--------------------------------------------------------------
(SQL2008):
SQL2008中清除日志就必须在简单模式下进行,等清除动作完毕再调回到完全模式。

    GO

    GO

    GO

    GO

    GO

    GO



    GO



    GO

优点:此清除日志所运行消耗的时间短,90GB的日志在分钟左右即可清除完毕,做完之后做个完全备份在分钟内
即可完成。
缺点: 不过此动作最好不要经常使用,因为它的运行会带来系统碎片。普通状态下LOG和DIFF的备份即可截断日志。
此语句使用的恰当环境:当系统的日志文件异常增大或者备份LOG时间太长可能影响生产的情况下使用。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

In summer, you must try shooting a rainbow In summer, you must try shooting a rainbow Jul 21, 2024 pm 05:16 PM

After rain in summer, you can often see a beautiful and magical special weather scene - rainbow. This is also a rare scene that can be encountered in photography, and it is very photogenic. There are several conditions for a rainbow to appear: first, there are enough water droplets in the air, and second, the sun shines at a low angle. Therefore, it is easiest to see a rainbow in the afternoon after the rain has cleared up. However, the formation of a rainbow is greatly affected by weather, light and other conditions, so it generally only lasts for a short period of time, and the best viewing and shooting time is even shorter. So when you encounter a rainbow, how can you properly record it and photograph it with quality? 1. Look for rainbows. In addition to the conditions mentioned above, rainbows usually appear in the direction of sunlight, that is, if the sun shines from west to east, rainbows are more likely to appear in the east.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

How to retrieve the wrong chain of virtual currency? Tutorial on retrieving the wrong chain of virtual currency transfer How to retrieve the wrong chain of virtual currency? Tutorial on retrieving the wrong chain of virtual currency transfer Jul 16, 2024 pm 09:02 PM

The expansion of the virtual market is inseparable from the circulation of virtual currency, and naturally it is also inseparable from the issue of virtual currency transfers. A common transfer error is the address copy error, and another error is the chain selection error. The transfer of virtual currency to the wrong chain is still a thorny problem, but due to the inexperience of transfer operations, novices often transfer the wrong chain. So how to recover the wrong chain of virtual currency? The wrong link can be retrieved through a third-party platform, but it may not be successful. Next, the editor will tell you in detail to help you better take care of your virtual assets. How to retrieve the wrong chain of virtual currency? The process of retrieving virtual currency transferred to the wrong chain may be complicated and challenging, but by confirming the transfer details, contacting the exchange or wallet provider, importing the private key to a compatible wallet, and using the cross-chain bridge tool

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

How does Go WebSocket integrate with databases? How does Go WebSocket integrate with databases? Jun 05, 2024 pm 03:18 PM

How to integrate GoWebSocket with a database: Set up a database connection: Use the database/sql package to connect to the database. Store WebSocket messages to the database: Use the INSERT statement to insert the message into the database. Retrieve WebSocket messages from the database: Use the SELECT statement to retrieve messages from the database.

Performance optimization tips for logging mechanism in Java functions? Performance optimization tips for logging mechanism in Java functions? May 02, 2024 am 08:06 AM

Logging optimization tip: Disable debug logging to eliminate the impact. Batch log messages to reduce overhead. Use asynchronous logging to offload logging operations. Limit log file size to improve application startup and processing performance.

How to use database callback functions in Golang? How to use database callback functions in Golang? Jun 03, 2024 pm 02:20 PM

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

See all articles