Thursday, March 29, 2012

dbcc shrinkfile

hi, can I shrink the database file, not only the trans log file?You can shrink individual files using DBCC SHRINKFILE. See the Books Online
for details.
Hope this helps.
Dan Guzman
SQL Server MVP
"js" <js@.someone.com> wrote in message
news:udr2WIcWFHA.1044@.TK2MSFTNGP10.phx.gbl...
> hi, can I shrink the database file, not only the trans log file?
>|||Hi JS
Check for DBCC SHRINKDATABASE if you want to shrink the size of the data
files in the specified database
http://msdn.microsoft.com/library/d...
pd1.asp
If you are trying to reduce the size of a single file, then u need to check
DBCC SHRINKFILE
http://msdn.microsoft.com/library/e...asp?frame=true
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.examnotes.net/gurus/default.asp?p=4223
---
"js" wrote:

> hi, can I shrink the database file, not only the trans log file?
>
>|||Thanks,
When to shrink database and when to shrink file usually?
"Chandra" <Chandra@.discussions.microsoft.com> wrote in message
news:950B4DD6-B2B1-4AC8-991A-A8C9F4FB6778@.microsoft.com...
> Hi JS
> Check for DBCC SHRINKDATABASE if you want to shrink the size of the data
> files in the specified database
> http://msdn.microsoft.com/library/d...r />
_3pd1.asp
> If you are trying to reduce the size of a single file, then u need to
> check
> DBCC SHRINKFILE
> http://msdn.microsoft.com/library/e...s.blogspot.com/
> http://www.examnotes.net/gurus/default.asp?p=4223
> ---
>
> "js" wrote:
>|||Another question:
how to show the database files in size use query? Thanks.
"Chandra" <Chandra@.discussions.microsoft.com> wrote in message
news:950B4DD6-B2B1-4AC8-991A-A8C9F4FB6778@.microsoft.com...
> Hi JS
> Check for DBCC SHRINKDATABASE if you want to shrink the size of the data
> files in the specified database
> http://msdn.microsoft.com/library/d...r />
_3pd1.asp
> If you are trying to reduce the size of a single file, then u need to
> check
> DBCC SHRINKFILE
> http://msdn.microsoft.com/library/e...s.blogspot.com/
> http://www.examnotes.net/gurus/default.asp?p=4223
> ---
>
> "js" wrote:
>|||js
exec sp_helpdb 'databasename'
"js" <js@.someone@.hotmail.com> wrote in message
news:ednshxhWFHA.228@.TK2MSFTNGP12.phx.gbl...
> Another question:
> how to show the database files in size use query? Thanks.
> "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> news:950B4DD6-B2B1-4AC8-991A-A8C9F4FB6778@.microsoft.com...
http://msdn.microsoft.com/library/d...s_dbcc_3pd1.asp[c
olor=darkred]
http://msdn.microsoft.com/library/e...asp?frame=true
>|||Usually never. You really only want to shrink the files when they have
grown due to a one time data load or similar type operation. Since
operations such as reindexing require lots of free space int he files you
should always have plenty of free space available.
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
Andrew J. Kelly SQL MVP
"js" <js@.someone@.hotmail.com> wrote in message
news:Oizi9mhWFHA.2448@.TK2MSFTNGP12.phx.gbl...
> Thanks,
> When to shrink database and when to shrink file usually?
> "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> news:950B4DD6-B2B1-4AC8-991A-A8C9F4FB6778@.microsoft.com...
>|||In addition to sbcc shrinkfile, you can use dbcc showcontig to determine the
level of data and index fragmentation. Much space within a table can be
wasted if you perform frequent updates and deletes on a table with a
clustered index or insert rows in an order other than the clustered order.
Also, you can use dbcc indexdefrag to defragment indexes prior to shrinking
the file or database.
"js" <js@.someone.com> wrote in message
news:udr2WIcWFHA.1044@.TK2MSFTNGP10.phx.gbl...
> hi, can I shrink the database file, not only the trans log file?
>|||BTW - Do you know that you're a month ahead of the rest of the world?
Joe Webb
SQL Server MVP
~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/t...il/-/0972688811
I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)
On Tue, 14 Jun 2005 22:50:50 -0400, "js" <js@.someone.com> wrote:

>hi, can I shrink the database file, not only the trans log file?
>sql

No comments:

Post a Comment