Summary of how SQL Server compresses log files

Source: Internet
Author: User

 

  1. Method 1:
    Step 1:
    BackupLogDatabase_name with no _Log
    Step 2:
    Compress all data and log files of a specific database and execute DBCC shrinkdatabase (database_name)
  2. Method 2:
    Another method is risky becauseSQLServer log files are not written to the master database file in real time. improper processing may cause data loss.
    1: DeleteLog
    Detach Database Enterprise Manager-> server-> database-> right-click-> detach Database
    2: DeleteLogFile
    Attach Database Enterprise Manager-> server-> database-> right-click-> attach Database
    This method prompts "re-createLog"Generate a newLog, The size is only 500 kb.
    Note: The first method is recommended.
    If you do not want it to become larger later.
    SQL2000 use:
    Right-click the database and choose Properties> Options> fault recovery> model> select simple model.
    Or useSQLStatement:
    Alter database name set recovery simple
  3. Method 3:
    If the database uses the simple recovery mode, after the checkpoint is executed directly, and the database is shrunk again, all log records before the new minlsn are deleted.
Related Article

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.