IT Community - Software Programming, Web Development and Technical Support

Reducing size of .ndf file in Ms Sql 2005

This is a discussion on Reducing size of .ndf file in Ms Sql 2005 within the Database Support forums, part of the Web Development category; Reducing size of .ndf file in Ms Sql 2005 I am having some space problems here, would appreciate if anyone ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 05-14-2009, 03:52 AM
nnraja nnraja is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 144
nnraja is on a distinguished road
Default Reducing size of .ndf file in Ms Sql 2005

Reducing size of .ndf file in Ms Sql 2005


I am having some space problems here, would appreciate if anyone can help.

I have a huge table (table A) with 20 million records in filegroup FILE1 (having one .ndf file). I had to create a copy of this table (table B), move data from table A to table B and then delete Table A. After deleting Table A I see that the .ndf file size has grown to more than double its original size, and I am not able to free up space from it.

dbcc shrinkfile (FILE1, truncateonly)
dbcc shrinkfile (FILE1, notruncate)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-14-2009, 03:53 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: Reducing size of .ndf file in Ms Sql 2005

HI,

Did you do them in that order?
Did the notruncate take a long time?
If so try the truncate one again.

How much free space do you have in the file?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-14-2009, 03:54 AM
nnraja nnraja is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 144
nnraja is on a distinguished road
Default Re: Reducing size of .ndf file in Ms Sql 2005

Hi,

no I ran it in this order
1. dbcc shrinkfile (FILE1, notruncate) (took 15 secs to run)
2. dbcc shrinkfile (FILE1, truncateonly)

i tried doing 1. a couple of times and everytime it takes about 15 decs

how do I find out free space in the file?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 05-14-2009, 03:56 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: Reducing size of .ndf file in Ms Sql 2005

Hi,

Easiest way is in management studio.
Right click on database, tasks, shrink, files
Select the file and it will shhow the free space.

Also run dbcc opentran to see if there are open transactions

Also check sysprocesses to make sure the checkpoint task isn't stuck.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 05-14-2009, 04:06 AM
nnraja nnraja is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 144
nnraja is on a distinguished road
Default Re: Reducing size of .ndf file in Ms Sql 2005

Hi,

no open transactions
checkpoint task is not stuck
The ID i'm using does not have access to see the files in enterprise manager...could that be a reason?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 05-14-2009, 04:06 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: Reducing size of .ndf file in Ms Sql 2005

Hi,

>> The ID i'm using does not have access to see the files in enterprise manager...could that be a reason?
It could be but I would expect an error.

You will at least need to be dbo.

try sp_spaceused
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 05-14-2009, 04:07 AM
nnraja nnraja is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 144
nnraja is on a distinguished road
Default Re: Reducing size of .ndf file in Ms Sql 2005

HI,

is it true that for shrinkfile to work, the table should have a clustered index?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 05-14-2009, 04:07 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: Reducing size of .ndf file in Ms Sql 2005

Hi,

No - you're shrinking a database file not a table
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I run all VS Pro 2003, 2005 and 2008 as clients with VS Team System 2005? shaalini Server Management 1 05-08-2009 03:08 AM
How to create a Setup file in VS 2005 to start a installer from a installer file? $enthil C# Programming 2 11-16-2007 02:10 AM
MSSQL Log File Is Growing Fast in MSSQL 2005 ? bluesky Server Management 5 11-12-2007 04:12 AM
File Upload Size Limit KiruthikaSambandam ASP and ASP.NET Programming 9 09-27-2007 02:16 AM
How to Minimize PNG file size for mobile appl..? itbarota Mobile Software Development 1 07-21-2007 12:43 AM


All times are GMT -7. The time now is 04:14 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0