


How to prevent Microsoft SQL Server log files from growing larger? _PHP Tutorial
How to reduce the size of MSSQL log files is a frequent question, but there are already many answers to this question in the essence area, so I won’t go into details here.
Now let’s discuss the fundamental problem, that is, how to prevent the log file from growing larger?
First introduce a simple method.
Just set the database's failure recovery model to "Simple" (SQL2K). This way it will truncate the log during Checkpoint.
The specific operation method is:
1. Right-click the database in Enterprise Manager, "Properties | Options | Fault Recovery", select "Simple", if it is SQL7, there is A "trunc. log on chkpt. ", just select it.
2. If you don’t want to use Enterprise Manager, execute
EXEC sp_dboption 'your_dbname', 'trunc. log on chkpt.', 'TRUE'
in Query Analyser or isql. However, It should be noted that after doing this, although the log will not increase, it also means that once you make a mistake, you will not have the opportunity to use the log to recover. (For how to use logs to recover, please see the FAQ in the essence area)
Therefore, it is absolutely not recommended to truncate logs on a production database, unless you have sufficient reasons and sufficient assurance, or...
It is not you who bears the responsibility. .
Since this method is not safe, I will introduce a safe method below.
As everyone knows, SQL Server will automatically truncate the inactive portion of the transaction log when completing a transaction log backup. These inactive sections contain completed transactions and are therefore no longer used during the recovery process. In contrast, the active portion of the transaction log contains transactions that are still running but have not yet completed. SQL Server will reuse this truncated inactive space in the transaction log rather than allowing the transaction log to continue to grow and take up more space.
So, by backing up the transaction log, the log file will no longer grow.
However, leaving the log file always is not an option. If you delete it, you will lose the possibility of recovery.
We can do it in conjunction with a full backup. The transaction log before the full backup can be deleted.
For example, a backup plan includes a full backup every day and keeps it for 7 days, and a transaction log backup every 15 minutes and keeps it for 2 days.
Using the Database Maintenance Plan Wizard can easily create a backup plan, but you must remember to set how long the backup should be retained, otherwise it will be a bad thing if the hard disk space is filled up by the backup.
Wrotten by Lucky@Dev-club
March 8, 2002

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box "Error 0x80004005: Unspecified Error" will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

Quark Netdisk and Baidu Netdisk are currently the most commonly used Netdisk software for storing files. If you want to save the files in Quark Netdisk to Baidu Netdisk, how do you do it? In this issue, the editor has compiled the tutorial steps for transferring files from Quark Network Disk computer to Baidu Network Disk. Let’s take a look at how to operate it. How to save Quark network disk files to Baidu network disk? To transfer files from Quark Network Disk to Baidu Network Disk, you first need to download the required files from Quark Network Disk, then select the target folder in the Baidu Network Disk client and open it. Then, drag and drop the files downloaded from Quark Cloud Disk into the folder opened by the Baidu Cloud Disk client, or use the upload function to add the files to Baidu Cloud Disk. Make sure to check whether the file was successfully transferred in Baidu Cloud Disk after the upload is completed. That's it

Recently, many netizens have asked the editor, what is the file hiberfil.sys? Can hiberfil.sys take up a lot of C drive space and be deleted? The editor can tell you that the hiberfil.sys file can be deleted. Let’s take a look at the details below. hiberfil.sys is a hidden file in the Windows system and also a system hibernation file. It is usually stored in the root directory of the C drive, and its size is equivalent to the size of the system's installed memory. This file is used when the computer is hibernated and contains the memory data of the current system so that it can be quickly restored to the previous state during recovery. Since its size is equal to the memory capacity, it may take up a larger amount of hard drive space. hiber

Detailed explanation of the role of .ibd files in MySQL and related precautions MySQL is a popular relational database management system, and the data in the database is stored in different files. Among them, the .ibd file is a data file in the InnoDB storage engine, used to store data and indexes in tables. This article will provide a detailed analysis of the role of the .ibd file in MySQL and provide relevant code examples to help readers better understand. 1. The role of .ibd files: storing data: .ibd files are InnoDB storage

The os.Rename function is used in Go language to rename files. The syntax is: funcRename(oldpath,newpathstring)error. This function renames the file specified by oldpath to the file specified by newpath. Examples include simple renaming, moving files to different directories, and ignoring error handling. The Rename function performs an atomic operation and may only update directory entries when the two files are in the same directory. Renames may fail across volumes or while a file is in use.

Working with files in the Linux operating system requires the use of various commands and techniques that enable developers to efficiently create and execute files, code, programs, scripts, and other things. In the Linux environment, files with the extension ".a" have great importance as static libraries. These libraries play an important role in software development, allowing developers to efficiently manage and share common functionality across multiple programs. For effective software development in a Linux environment, it is crucial to understand how to create and run ".a" files. This article will introduce how to comprehensively install and configure the Linux ".a" file. Let's explore the definition, purpose, structure, and methods of creating and executing the Linux ".a" file. What is L

Analysis of the Impact of MySQL Connection Number on Database Performance With the continuous development of Internet applications, databases have become an important data storage and management tool to support application systems. In the database system, the number of connections is an important concept, which is directly related to the performance and stability of the database system. This article will start from the perspective of MySQL database, explore the impact of the number of connections on database performance, and analyze it through specific code examples. 1. What is the number of connections? The number of connections refers to the number of client connections supported by the database system at the same time. It can also be managed
