How to disable transaction logs in SQL Server 2008

In SQL Server 2008, is there a way to disable the transaction log or clear the log file?

When I execute one request in my project (very large in terms of transaction), at this time the size of this log file will increase (from 2 to 3 GB).

Please offer me a good option.

+5
source share
4 answers

You can reduce it

DECLARE @sql NVARCHAR(MAX) = ''
SELECT @sql = @sql + N'DBCC SHRINKFILE('+CAST(file_id AS NVARCHAR)+N', 0);' 
FROM sys.database_files
WHERE type = 1

EXEC(@sql)

BUT it only works with a simple recovery model, instead you need to go back to the log and reduce it after

You cannot drop log files at all , even if your database is in read - only mode .

SQL- SQL. - !

+3

SQL Server. .

ALTER DATABASE YourDatabase SET RECOVERY SIMPLE

, SQL Server, .

+8

.

3 , . , .

,

+2
source

change recovery model to: simple

ALTER DATABASE myDB SET RECOVERY SIMPLE

and run

DBCC SHRINKFILE (MyLog, 1); // to 1 MB

But where do you get the name of the magazine?

sp_helpdb MyDb
0
source

All Articles