Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 shrink

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2008-12-14 : 06:58:14
hi

i run this t-sql(2005):
DBCC SHRINKFILE(DB_Name, 1)

and i see in the folder that file get higher instead 1.2G it make 1.9G

what i should do?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-14 : 10:00:17
Which folder? Your question is not clear. You shouldn't shrink you DB like that as it will cause fragmentation and decrease performance as well.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-12-14 : 10:46:03
Can you confirm there isn't any other activity going on at the moment?
I agree with sodeep , generally you should only shrink a file if you have a large permanent delete of data and you need to relaim .
Are you trying to shrink a data or a log file?

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2008-12-14 : 12:25:18
i hope that now i more clearly.

i have a dataBase ,for example DB_Name,his size 1.2G and his logFile 1.7G.

i shrink (in ahe managment studio,right clock on the mouth->shrink) the DB and file. but in the folder i see that both files (DB and the log) growth. how it could be,what i should to decrease it?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-12-14 : 13:59:33
Why do you want to shrink? Databases tend to grow as more data gets put in them. It's in their nature.

Shrinking causes massive fragmentation and will just result in the data file growing again next time data gets added. When that happens, the entire system will slow down as the file is expanded. Also repeated shrinks and grows will cause fragmentation at the file-system level, which is hard to fix.

Regarding that log... What recovery model is that DB in and how often are you doing transaction log backups?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2008-12-15 : 01:36:11
GilaMonster

i dont think that you understand me.

shrink is decrease the size of DB?(if the DBfile is 1.2G it need to be smaller than 1.2 if i make shrink),no?

so why it growth(it be 1.9G)?


Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-12-15 : 02:57:10
I understand you perfectly.

I'm asking why you want to shrink the file in the first place. The file's 1.2 GB, how much data's within the file?
SQL data files aren't like word docs, where white space is wasted space. SQL needs a certain amount of free space within the file for normal operation.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2008-12-15 : 04:07:50
ok, i understand you, this is a DB portal of our organization.
i am sure that DB have word docs.

how can know which table with the much data?

you write :"SQL needs a certain amount of free space within the file for normal operation."

how can i certaint that?,what is next step to do?

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-12-15 : 06:19:25
You said the file is 1.2 GB. How much of that is used space? (sp_spaceused will tell you)

What the database stores (word docs, financial data, etc) is irrelevance. All I'm saying is that free space within the DB is not wasted space

--
Gail Shaw
SQL Server MVP
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2008-12-15 : 14:21:44
gilamonster,i undertand you but why the DB become growth after i shrink the db?
it need to be reduced.

the db have word docs,and meanwhile we dont input any data.(and still have the problem)

thanks
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-15 : 16:15:19
Log file will grow while you shrink DB because pages are moved during shrinking process and everything is logged in transaction log if you have full recovery model.
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2008-12-16 : 01:14:17
but it is not just the log ,it is file.mdf that growth too-this is the problem.
Go to Top of Page
   

- Advertisement -