Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
Backups
»
transactional log
transactional log
Rate Topic
Display Mode
Topic Options
Author
Message
litu deb
litu deb
Posted Wednesday, January 30, 2008 6:09 AM
SSC Rookie
Group: General Forum Members
Last Login: Sunday, March 07, 2010 11:38 PM
Points: 46,
Visits: 266
If i need to truncate/shrink the transaction log file :
can I use dbcc shrinkdatabase(' ',truncateonly) instead of using dbcc shrinkfile(2,truncateonly).earlier I was using the 2nd option dbcc shrinkfile but had to do full backup after this.
If i do use shrinkdatabase cmd i think no need to take full backup.is it safe to use 'dbcc shrinkdatabase' rather than using 'dbcc shrinkfile' .Please advice me.
Thanks,
Litu
Post #449309
free_mascot
free_mascot
Posted Wednesday, January 30, 2008 6:53 AM
SSCommitted
Group: General Forum Members
Last Login: Yesterday @ 3:11 AM
Points: 1,790,
Visits: 1,320
In my openion both command do the same thing one shrinkfile will shrink single file while shrinkdatabase will shrink the set of files in the database. Also after executing any shrink command no need to do the full backup but on saffer side you can do it.
Also shrink command won't do any blocking or hold locks(Might be temporarily it can). BUT SHRINK COMMAND IS RESOURCE CONSUMING AND CONSUMES RESOURCES (CPU - MEMORY) OF THE SERVER HENCE ADVISABLE TO EXECUTE ON THE OFF-PICK HOURS.
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
Post #449351
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Wednesday, January 30, 2008 8:24 AM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 5:09 AM
Points: 31,526,
Visits: 13,864
You do not want to shrink the database. It causes fragmentation and messes with the index efficiency. If you need to shrink the log, shrink those files only.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #449441
GilaMonster
GilaMonster
Posted Wednesday, January 30, 2008 11:37 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:29 AM
Points: 38,113,
Visits: 30,401
Also note that truncating a log (removing inactive log entries) and shrinking the log (reducing the size on disk) are two separate things.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #449581
litu deb
litu deb
Posted Thursday, January 31, 2008 5:54 AM
SSC Rookie
Group: General Forum Members
Last Login: Sunday, March 07, 2010 11:38 PM
Points: 46,
Visits: 266
Thanks it is really helpful information for me.
I have one more query:
If i shrink the whole database how caome it is possible to
shrink the main database(except log file).
Thnks,
Litu
Post #449886
GilaMonster
GilaMonster
Posted Thursday, January 31, 2008 6:37 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:29 AM
Points: 38,113,
Visits: 30,401
Are you asking how to shink the database and not the log? You'd do it by shrinking each of the data files individually.
Note Steve's warning above. You don't want to shrink the database down, unless there's a good reason. See
this link
, and also check out the two links at the bottom of that article
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #449907
litu deb
litu deb
Posted Friday, February 01, 2008 12:01 AM
SSC Rookie
Group: General Forum Members
Last Login: Sunday, March 07, 2010 11:38 PM
Points: 46,
Visits: 266
I know how to shrink whole database and also individual file.
I would like to know if i shrink only the database what would be the impact
on database.how come it reduce the size of database.
Thnks,
Litu
Post #450333
GilaMonster
GilaMonster
Posted Friday, February 01, 2008 1:23 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:29 AM
Points: 38,113,
Visits: 30,401
litu deb (2/1/2008)
I know how to shrink whole database and also individual file.
DBCC shrink database to shrink the whole database. DBCC ShrinkFile to shrink individual files
I would like to know if i shrink only the database what would be the impact
on database.
See Steve's comments, see the blog post I linked to, and be sure to check the links at the end of that. (to Paul randal's blog and the storage engine team's blog) Between them, they cover all the issues quite nicely
how come it reduce the size of database.
It only reduces the size of the DB if there's unused space in the data or log files. Shrink releases that space to the OS, so the file size decreases.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #450349
litu deb
litu deb
Posted Friday, February 01, 2008 4:18 AM
SSC Rookie
Group: General Forum Members
Last Login: Sunday, March 07, 2010 11:38 PM
Points: 46,
Visits: 266
I understand used and free space in database.but what do you mean by unused space in database.
thnks,
Litu Deb
Post #450388
GilaMonster
GilaMonster
Posted Friday, February 01, 2008 5:19 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 4:29 AM
Points: 38,113,
Visits: 30,401
Unused = free
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #450404
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.