


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

AI Hentai Generator
Generate AI Hentai for free.

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).

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

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

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

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

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

Solution: 1. Check whether the logged-in user has sufficient permissions to access or operate the database, and ensure that the user has the correct permissions; 2. Check whether the account of the SQL Server service has permission to access the specified file or folder, and ensure that the account Have sufficient permissions to read and write the file or folder; 3. Check whether the specified database file has been opened or locked by other processes, try to close or release the file, and rerun the query; 4. Try as administrator Run Management Studio as etc.
