Three good ways to reduce SQL log size

Source: Internet
Author: User

First method:

Suppose the Select is a database name

Executing in Query Analyzer:

backup log MuOnline with NO_LOG
backup log MuOnline with TRUNCATE_ONLY
DBCC SHRINKDATABASE(MuOnline)

Executes the above statement multiple times until the log file shrinks.

exec sp_dboption ' muonline ', ' autoshrink ', ' on '

Set up a job, log backups every half an hour, and a full database backup once a day.

After the log is shrunk to normal size, set the autoshrink option to off.

A second method

The database is growing because your logs are growing, previously discussed, the most simple and feasible way is in your database properties-> option-> failure to select a simple mode (the default is full mode), and then select the shrink database for a contraction, then your database basic will not be how to grow.

A third method

1. Enter Enterprise Manager, select database, such as MuOnline

2.-> separate database for all tasks

3. To the database file storage directory, will be muonline_log. LDF file deletion, in order to avoid errors, you can copy out.

4. Enterprise Manager-> Append database, select MuOnline, this time you will see log file This is a fork, do not matter, continue, at this time the database will prompt you that the database has no log whether to create a new, OK.

5. Remember that the user wants to reset the database after it is reattached.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.