November 14, 2007 at 5:47 am
my .ldf file has grown over 2 GB and i need to shrink it or clear it. or even delete completely.
is it possible?
thank you.
edit: i'm a developer using SQL express so the log is useless to me.
November 14, 2007 at 6:01 am
vadimt (11/14/2007)
my .ldf file has grown over 2 GB and i need to shrink it or clear it. or even delete completely.is it possible?
thank you.
edit: i'm a developer using SQL express so the log is useless to me.
Well, it is possibly useful :), but that is another story. If it is not useful for you, then switch to simple recovery.
What recovery mode are you running this database in? (you can get this information from the master.sys.databases view)
If you are in full, then change to simple recovery model.
alter database mydb set recovery simple
You can also then truncate the log:
DBCC SHRINKFILE ('mydb_log',1)
GO
Regards,
Andras
November 14, 2007 at 6:16 am
You ca also add: BACKUP LOG [Yourdatabase] WITH NO_LOG
Finally, you have:
BACKUP LOG [Yourdatabase] WITH NO_LOG
ALTER DATABASE [Yourdatabase] SET RECOVERY SIMPLE
DBCC SHRINKDATABASE ( [Yourdatabase], TRUNCATEONLY )
November 14, 2007 at 6:20 am
Thakns.
helped a lot.
November 14, 2007 at 2:50 pm
If you just want to shrink the log:
select name from sysfiles (to get logfile name)
dbcc shrinkfile(logfilename, SizeInMB)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply