January 18, 2005 at 10:12 pm
How to truncate the Transation Log of a given database file by using a T-SQL script
My Blog:
January 18, 2005 at 10:44 pm
Look for BACKUP in Books Online.
--------------------
Colt 45 - the original point and click interface
January 19, 2005 at 6:52 am
hai Dinesh,
You can use ,
backup Log <database name> with truncate_only
or
Backup Log <database name> with no_log
this will not reduce the size of the physical log file
subban
January 19, 2005 at 9:36 am
BACKUP LOG [dbname] WITH TRUNCATE_ONLY
Note:
The "Backup Log Truncate Only" command should be used if you are out of disk space and can't backup the db.
January 19, 2005 at 9:07 pm
Thnk you all. simple thing great help
My Blog:
January 20, 2005 at 2:27 am
after you had truncated the log file you can shrink the file by:
DBCC SHRINKFILE
( { file_name | file_id }
{ [ , target_size ]
| [ , { EMPTYFILE | NOTRUNCATE | TRUNCATEONLY } ]
}
)
January 24, 2005 at 10:28 am
I truncate the log after the weekly maintenance tasks have run, where there is no production. I do this because we archive the logs for HIPAA reasons, and I'd prefer not to save a 1GB transaction log that just records the maintenance tasks. Then, I immediately back up the database.
There is a little risk, in that if the backup fails, I could have a problem the next (production) day, but, I've been lucky so far.
If someone knows of a better way, or a setting that won't log the maintenence transactions, let me know, please. (I'm using the DB Maint plan rather than raw T-SQL scripts to do the weekly stuff.)
So long, and thanks for all the fish,
Russell Shilling, MCDBA, MCSA 2K3, MCSE 2K3
January 25, 2005 at 2:05 am
During your meintenance task, set you recovry model to SIMPLE
subban
January 25, 2005 at 4:32 am
Now that would be a silly thing to do if the database is operational 24x7
--------------------
Colt 45 - the original point and click interface
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply