Solved

Shrink logfile - meaning of this commad

Posted on 2012-03-18
3
392 Views
Last Modified: 2012-04-02
I found this command:

DBCC SHRINKFILE(<TransactionLogName>, 1)
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLogName>, 1)

Does this truncate the log file or shrink it??not sure what the commands exactly mean.
0
Comment
Question by:Camillia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Assisted Solution

by:Ramesh Babu Vavilla
Ramesh Babu Vavilla earned 167 total points
ID: 37736676
when the database is i full recoery mode
DBCC SHRINKFILE(<TransactionLogName>, 1)

this command shrinks the log file to 1 MB.

BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
takes the backup of log file using truncate command

DBCC SHRINKFILE(<TransactionLogName>, 1)

this command shrinks the log file to 1 MB.


note:
if you are not intrested in shrinking the log file (ldf) , then make a habbit of  taking the transaction log file backup
0
 
LVL 25

Accepted Solution

by:
jogos earned 167 total points
ID: 37737089
When taking a transactionlog backup the space in the file is freed to be reused , but the file won't shrink. And that's a good thing while allocationg space is time consuming and always allocating and deallocating space will fragment your transactionlog on disk.
It's better to see what's a decent 'maximum usage' of your transaction log and allocate that space for it so it never has to expand and also does not have tor shrink either.
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 166 total points
ID: 37738830
Does this truncate the log file or shrink it??not sure what the commands exactly mean.
It means:
1.  They are not using SQL Server 2008 as "WITH TRUNCATE_ONLY" is thankfully no longer supported on that version.
2.  They are fragmenting the database.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question