Wednesday, March 28, 2012

How Can I reduce my transacion log file?

I Have a Database with a transaction log file 31 Gb, and I have problem to
backup it.
I want decresea it but don't remember How.
LorenaHi,
It seems you have set recovery model for this database to FULL. In this
recovery model all the activity inside the
database is logged. So you have schedule a transaction log backup to clear
of the trasnaction logs. THis backup can
be used when a recovery is needed.
Show to set to simple
ALTER database <dbname> set recovery SIMPLE
How to clear the existing logs and shrink the file:-
Since the file is really huge, I recomment you to set the database to single
user model before doing the below steps.
-- Setting database single user.
Alter database <dbname> set single_user with rollback immediate
-- Truncate the transaction log
BACKUP log <dbname> with truncate_only
-- shrink the transacton log file
DBCC SHRINKFILE('logical_ldf_name',truncateon
ly)
After doing the above steps execute the below command to see the transaction
log size and usage.
DBCC SQLPERF(LOGSPACE)
-- Now set the database multi user
Alter database <dbname> set multi_user
Thanks
Hari
MCDBA
"Lorena" <Lorena@.discussions.microsoft.com> wrote in message
news:6B7189C4-2904-4000-BD28-1A89C8BA9866@.microsoft.com...
> I Have a Database with a transaction log file 31 Gb, and I have problem
to backup it.
> I want decresea it but don't remember How.
> Lorena

No comments:

Post a Comment