Ways to remove bulk-logged SQL Server

Source: Internet
Author: User
Tags file size microsoft sql server

1: Delete Log

1: Detach Database Enterprise Manager-> Server-> database-> right key-> Detach database

2: Delete log file

3: Additional database Enterprise Manager-> Server-> database-> right key-> attached database

This method generates a new log with a size of more than 520 K

And then set this database to automatically shrink

or in code:

The following example separates 77169database and then attaches a file in 77169database to the current server.

EXEC sp_detach_db @dbname = '77169database'
EXEC sp_attach_single_file_db @dbname = '77169database',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\77169database.mdf'

2: Empty the Log

DUMP TRANSACTION Library name with NO_LOG

Again

Enterprise Manager--right you want to compress the database--All tasks--shrink the database--Shrink the file--select log file--in the contraction of the choice of contraction to XXM, here will give a allow to shrink to the minimum m number, directly enter this number, OK.

3: Don't Let it grow

Enterprise Manager-> Server-> database-> properties-> transaction log-> limit file growth to 2M

Automatically shrink the log, or you can use the following statement

alter DATABASE 数据库名
SETAUTO_SHRINK ON

The failover model is simple, with the statement

USE MASTER
GO
ALTER DATABASE 数据库名 SET RECOVERY SIMPLE
GO
----------------------------------------------------------

Truncate transaction log:

BACKUP LOG { database_name | @database_name_var }
{
[ WITH
{ NO_LOG | TRUNCATE_ONLY } ]
   }

--Compressed log and database file size

/*--Special attention

Please follow the steps and do not follow the steps above.

Otherwise, you may damage your database.

--*/

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.