Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

transactional log Expand / Collapse
Author
Message
Posted Wednesday, January 30, 2008 6:09 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, March 7, 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
Posted Wednesday, January 30, 2008 6:53 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 21, 2014 2:56 AM
Points: 2,603, Visits: 2,061
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
Posted Wednesday, January 30, 2008 8:24 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 11:24 AM
Points: 33,088, Visits: 15,197
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
Posted Wednesday, January 30, 2008 11:37 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 6:28 AM
Points: 42,468, Visits: 35,538
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
Posted Thursday, January 31, 2008 5:54 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, March 7, 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
Posted Thursday, January 31, 2008 6:37 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 6:28 AM
Points: 42,468, Visits: 35,538
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
Posted Friday, February 1, 2008 12:01 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, March 7, 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
Posted Friday, February 1, 2008 1:23 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 6:28 AM
Points: 42,468, Visits: 35,538
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
Posted Friday, February 1, 2008 4:18 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, March 7, 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
Posted Friday, February 1, 2008 5:19 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 6:28 AM
Points: 42,468, Visits: 35,538
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 »

Add to briefcase

Permissions Expand / Collapse