Home Backend Development PHP Tutorial Quick solution to full Sql server database log_PHP tutorial

Quick solution to full Sql server database log_PHP tutorial

Jul 13, 2016 pm 05:02 PM
server sql about Method compression complex fast supply database method log of solve

First, a complex method is provided to compress log and database files as follows:
1. Clear logs
DUMP TRANSACTION library name WITH NO_LOG
2. Truncate transaction log:
BACKUP LOG database name WITH NO_LOG
3. Shrink the database file (if not compressed, the database file will not be reduced
Enterprise Manager--right-click the database you want to compress--All tasks--Shrink database--Shrink file
--Select Log file--choose to shrink to XXM in the shrink mode. There will be a minimum number of M allowed to be shrunk. Enter this number directly and confirm
--Select the data file--choose in the shrink mode. Shrink to XXM, here will give a minimum number of M that is allowed to shrink to, just enter this number and confirm
You can also use SQL statements to complete
--Shrink database
DBCC SHRINKDATABASE (Customer Information)
--Shrink the specified data file, 1 is the file number, which can be queried through this statement: select * from sysfiles
DBCC SHRINKFILE(1)
4. In order to maximize the shrinkage of the log file (if It is sql 7.0, this step can only be performed in the query analyzer)
a. Detach database:
Enterprise Manager--Server--Database--right-click--Detach database
b. In my Delete the LOG file on the computer
c. Attach database:
Enterprise Manager - Server - Database - Right click - Attach database
This method will generate a new LOG, the size is only more than 500K
Or use code:
The following example detaches pubs, and then attaches a file in pubs to the current server.
a. Detach
E File
c. Attach
E :
Enterprise Manager--Server--Right-click the database--Properties--Options--Select "Auto Shrink"
--SQL statement setting method:
E , 'TRUE'
6. If you want to prevent the log from growing too large in the future
Enterprise Manager--Server--Right-click Database--Properties--Transaction Log
--Limit the file growth to xM (x is the maximum data file size you allow)
--SQL statement setting method:
alter database database name modify file (name=logical file name, maxsize=20)
Special attention:
Please follow the steps. Please do not do the following steps without completing the previous steps
Otherwise, your database may be damaged.
It is generally not recommended to do steps 4 and 6
Step 4 is not safe , it is possible to damage the database or lose data
Step 6. If the log reaches the upper limit, subsequent database processing will fail and can only be restored after clearing the log.
In addition, a simpler method is provided. I have tried it repeatedly and it is recommended. Used by everyone.
An easier way:
1. Right-click the database properties window--Failure Recovery Model--set to Simple
2. Right create all tasks of the database--Shrink the database
3. Right-click the database properties window--Failure Recovery Model--Set to large-capacity logging



http://www.bkjia.com/PHPjc/631064.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631064.htmlTechArticleFirst provide a complex method to compress log and database files as follows: 1. Clear the log DUMP TRANSACTION Library name WITH NO_LOG 2. Truncate the transaction log: BACKUP LOG database name WITH NO_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

Video Face Swap

Video Face Swap

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

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)

7-zip maximum compression rate setting, how to compress 7zip to the minimum 7-zip maximum compression rate setting, how to compress 7zip to the minimum Jun 18, 2024 pm 06:12 PM

I found that the compressed package downloaded from a download website will be larger than the original compressed package after decompression. The difference is tens of Kb for a small one and several dozen Mb for a large one. If it is uploaded to a cloud disk or paid space, it does not matter if the file is small. , if there are many files, the storage cost will be greatly increased. I studied it specifically and can learn from it if necessary. Compression level: 9-Extreme compression Dictionary size: 256 or 384, the more compressed the dictionary, the slower it is. The compression rate difference is larger before 256MB, and there is no difference in compression rate after 384MB. Word size: maximum 273 Parameters: f=BCJ2, test and add parameter compression rate will be higher

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

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 to connect to remote database using Golang? How to connect to remote database using Golang? Jun 01, 2024 pm 08:31 PM

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.

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.

How to save JSON data to database in Golang? How to save JSON data to database in Golang? Jun 06, 2024 am 11:24 AM

JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.

Quickly learn how to unlock PUK (easily solve the problem of mobile phone lock screen) Quickly learn how to unlock PUK (easily solve the problem of mobile phone lock screen) Jun 01, 2024 pm 01:38 PM

We often encounter the embarrassing situation of forgetting the password or entering the wrong password and being unable to unlock the phone while using the phone. Let us regain the right to use our mobile phones, and PUK unlocking techniques can help us easily solve these problems. It also provides some practical tips to help readers better deal with mobile phone lock screen problems. This article will teach you the simplest method to unlock PUK and introduce the basic concepts and steps of PUK unlocking. Paragraph 1. What is PUK unlocking? The PUK code is a special code on the mobile phone card. PUK unlocking is a technology used to solve the problem of mobile phone lock screen and is used to unlock the PIN code of the SIM card. Understanding the basic concepts of PUK unlocking is the first step in learning this technique. 2. How to obtain the PUK code? The phone screen will display

See all articles