Can I shrink transaction log when database in online using below command ? DBCC SHRINKFILE(transactionloglogicalfilename, TRUNCATEONLY)
FYI my database is in production server & highly critical
Thanks in advance
regards Imra
Can I shrink transaction log when database in online using below command ? DBCC SHRINKFILE(transactionloglogicalfilename, TRUNCATEONLY)
FYI my database is in production server & highly critical
Thanks in advance
regards Imra
You could, but that doesn't mean you should.
Your goal, presumably, is to reduce the amount of space being used by your transaction logs because they're large, and the database is in the 'Full' recovery model.
However, the transaction log has grown this big for a reason. Have you dealt with this this first? If you don't, then it will grow again. Perhaps growing to the size it has isn't a problem, but normal operation?
If you have considered these factors, then you need to do a log backup to truncate the entries in the log file, and only then shrink the file. Be aware that shrinking a datafile is a highly I/O intensive operation and WILL have a performance impact on your system.
See https://msdn.microsoft.com/en-GB/library/ms190925.aspx#Truncation for info on backing up your transaction log and https://msdn.microsoft.com/en-GB/library/ms365418.aspx#ShrinkSize for details on shrinking.