How to use SQL statements to make your database lose weight, below to net Fox 6603 database weight Loss Script Example!

Source: Internet
Author: User
Tags how to use sql truncated

Translated from: http://www.zccode.com/forum.php?mod=viewthread&tid=637&extra=page%3D1

NET Fox 6603 Special Database Weight Loss effect script (18G into 300M) is as follows:

Copy script statements to SQL Server new query, execute, clear redundant log

/*
* Database Super Weight loss, 18G can become 300M.

*/

--Truncate The log by changing the database recovery model to simple.
Use Qptreasuredb
ALTER DATABASE Qptreasuredb
SET RECOVERY Simple
GO
--Shrink The truncated log file to 1 MB. Shrink log file size (in units of M)
DBCC Shrinkfile (Qptreasuredb_log, 1)
GO
--Reset the database recovery model.
ALTER DATABASE Qptreasuredb
SET RECOVERY Full

Use QPRECORDDB
ALTER DATABASE QPRECORDDB
SET RECOVERY Simple
GO
--Shrink The truncated log file to 1 MB.
DBCC Shrinkfile (Qprecorddb_log, 1)
GO
--Reset the database recovery model.
ALTER DATABASE QPRECORDDB
SET RECOVERY Full

Use Qpaccountsdb
ALTER DATABASE Qpaccountsdb
SET RECOVERY Simple
GO
--Shrink The truncated log file to 1 MB.
DBCC Shrinkfile (Qpaccountsdb_log, 1)
GO
--Reset the database recovery model.
ALTER DATABASE Qpaccountsdb
SET RECOVERY Full
GO


Use Qpeducatedb
ALTER DATABASE Qpeducatedb
SET RECOVERY Simple
GO
--Shrink The truncated log file to 1 MB.
DBCC Shrinkfile (Qpeducatedb_log, 1)
GO
--Reset the database recovery model.
ALTER DATABASE Qpeducatedb
SET RECOVERY Full
Go
SELECT * FROM Sys.database_files--Find the logical name of the database log file

How to use SQL statements to make your database lose weight, below to net Fox 6603 database weight Loss Script Example!

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.