How to clean Up database log files under SQL Server R2

Source: Internet
Author: User

Nonsense not much to say, directly on the code, clean up after the log file is 1M

[SQL]View Plaincopyprint?
  1. Use [master]
  2. GO
  3. ALTER Database [db name] SET RECOVERY simple with no_wait
  4. GO
  5. ALTER Database [db name] SET RECOVERY Simple
  6. GO
  7. Use [database name]
  8. GO
  9. DBCC shrinkfile (N' [Database log file name] ', 0,truncateonly)
  10. GO
  11. Use [master]
  12. GO
  13. ALTER Database [db name] SET RECOVERY full with no_wait
  14. GO
  15. ALTER Database [db name] SET RECOVERY full
  16. GO
  17. --Query the log file name of the specified database
  18. Use [database name]
  19. GO
  20. SELECT name from sys.database_files WHERE type_desc=' LOG '

08r2 passed, other versions not tested

How to clean Up database log files under SQL Server R2

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.