November 9, 2012 at 11:41 pm
Dear,
I have the following codes to shrink my log file. But I dont know the difference of these two codes. Would you please explain to me that which is the effective one?
1.
USE myDB
GO
DBCC SHRINKFILE ('myDB_Log', 1)
BACKUP LOG myDB WITH TRUNCATE_ONLY
DBCC SHRINKFILE ('myDB_Log', 1)
GO
2.
GO
alter database myDB
set recovery simple;
GO
dbcc shrinkfile (myDB_log, 1);
GO
alter database myDB
set recovery full;
GO
use myDB;
Thank You
Regards,
Akbar
November 10, 2012 at 12:30 am
The first one won't work on SQL 2008, the second one will. Otherwise they're the same, both bad forms of log mismanagement.
Please read through this: http://www.sqlservercentral.com/articles/Administration/64582/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 10, 2012 at 4:09 am
GilaMonster (11/10/2012)
The first one won't work on SQL 2008, the second one will. Otherwise they're the same, both bad forms of log mismanagement.Please read through this: http://www.sqlservercentral.com/articles/Administration/64582/
Would you please tell me that why do dbcc shrinkfile (myDb_log, 1);
is used in between set recovery simple
and set recovery full
?
November 10, 2012 at 7:57 am
The DBCC is the one that actually shrinks the log file.
Please go and read that article.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply