Sunday, February 19, 2012

How can I truncate the log file

Dear All,
The database XXX has size 1GB and the log has size 1.5GB.
The recovery model is FULL. (SQL-2000)
How can I truncate the log file (reduce the size) through
a plan'
HarrisDo you have any log shipping or any other log backup jobs scheduled? If yes,
have the job run more often, so that it truncates the log after the log
backup is taken (may be every hour or so, depending on the transaction
volume) . If no, set the recovery model to SIMPLE and do a truncate log.
Everything should be OK after you do either of these.
Rathna Raj
"Harris Aristotelous" <harris@.glprodata.com> wrote in message
news:667101c4754e$15e58a00$a501280a@.phx.gbl...
> Dear All,
> The database XXX has size 1GB and the log has size 1.5GB.
> The recovery model is FULL. (SQL-2000)
>
> How can I truncate the log file (reduce the size) through
> a plan'
>
> Harris|||Hi,
You need to perform a backup log if the database recovery model is FULL or
BULK_LOGGED. Otherwise the inactive trasnaction logs will not be removed and
though your shrinkfile command will shrink. in case if you donot need the
trasnactions you could truncate the logs
backup log <dbname> with truncate_only
go
DBCC SHRINKFILE (db1_log1_logical_name,truncateonly)
If you need the transaction log backup do:-
backup log <dbname> to disk='d:\backup\dbname.trn'
go
DBCC SHRINKFILE (db1_log1_logical_name,truncateonly)
Now execute the below command to see log file size and usage.
DBCC SQLPERF(LOGSPACE)
Note:
If your data is not that critical (Development Server) and if you do not
require a time based
recovery go for SIMPLE recovery Model for your database. This require less
monitoring of tranasction log usage
Thanks
Hari
MCDBA
"Harris Aristotelous" <harris@.glprodata.com> wrote in message
news:667101c4754e$15e58a00$a501280a@.phx.gbl...
> Dear All,
> The database XXX has size 1GB and the log has size 1.5GB.
> The recovery model is FULL. (SQL-2000)
>
> How can I truncate the log file (reduce the size) through
> a plan'
>
> Harris

No comments:

Post a Comment