Sometimes you run into log files (and sometimes data files) that run away with you in size. To shrink or reduce the size of a SQL server file, especially logs, you need to trick the system into thinking you've written this data elsewhere. Here's how I do it.
use
{database name}
go
backup log {database name} with truncate_only;
checkpoint;
dbcc shrinkfile ('{database filename}',{new file size}) ;
USE [master]
GO
ALTER DATABASE [{database name}] MODIFY FILE ( NAME = N'{database filename}', MAXSIZE = {new max size}KB )
GO
No comments:
Post a Comment