[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 627
  • Last Modified:

Backup log with truncate_only

Hello Experts

I am truncating some logs on SQL Server 2005 using the BACKUP LOG command.  The exact command I am running is:

BACKUP LOG [<databasename>] WITH TRUNCATE_ONLY

I've run the command and it executed successfully  However the transaction log file is exactly the same size.  I have noticed however that the log file does not have the same name as the database, ie the database is called <databasename>, but the log file is called <databasename>_1.ldf.

Is this the reason the file is still the same size?  Can I run the following command?

BACKUP LOG [<databasename>_1] WITH TRUNCATE_ONLY

Many thanks
0
equentin
Asked:
equentin
1 Solution
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
>> I've run the command and it executed successfully  However the transaction log file is exactly the same size.

Truncating the backup log will not shrink the log file..
However it would free up portions in the log file thereby reusing the log file..

>>  I have noticed however that the log file does not have the same name as the database, ie the database is called <databasename>, but the log file is called <databasename>_1.ldf.

Seems like you or someone have created the log file using that name or during some other time..
Doing truncate_only will not shrink the log file and if you want to do so, then use

DBCC SHRINKFILE ( ur_db_name_log, 1000);

where 1000 represents the size of your log file.

PS: Its not recommended to shrink the file to a very lower file size because its going to grow anyhow..
0
 
dervishiCommented:
You can shrink the file.
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now