473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Shrinking database files

I have a database file LEAR_Index(yes, it hold index data) from a have
have recently removed a bunch of data.
It is about 120 Gb, 100Gb of which is not used. I wan´t to shrink the
file to lean 30-40Gb.

I´ve been trying this:

dbcc shrinkfile('LEAR_Index',40000)

But to no apparent avail; the file did not shrink.
I´ve tried using enterprise manager for this but it consistenly
crashes when performing this operation.#

Any thoughs, idear as to what i might be doing wrong?

Jul 23 '05 #1
6 3066
Is LEAR_Index also the logical name of the database's data file? If
not, then you may have mixed up the syntax for DBCC SHRINKFILE and DBCC
SHRINKDATABASE:

DBCC SHRINKDATABASE(LEAR_Index, 30)
DBCC SHRINKFILE(LEAR_Index_Data, 40000)

If that doesn't help, perhaps you can post the result set from the DBCC
execution, or whatever output you get. This KB article might also be
relevant:

http://support.microsoft.com/default...b;en-us;324432

Simon

Jul 23 '05 #2
Jens (je************@lycos-europe.com) writes:
I have a database file LEAR_Index(yes, it hold index data) from a have
have recently removed a bunch of data.
It is about 120 Gb, 100Gb of which is not used. I wan´t to shrink the
file to lean 30-40Gb.

I´ve been trying this:

dbcc shrinkfile('LEAR_Index',40000)

But to no apparent avail; the file did not shrink.
I´ve tried using enterprise manager for this but it consistenly
crashes when performing this operation.#

Any thoughs, idear as to what i might be doing wrong?


You may first have to run DBCC DBREINDEX to defragment fragmented
tables.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3
I recall shrinking a database using enterprise manager and thinking it had
locked up (i.e. crashed) but it hadn't - it came back when it had finished
shrinking.

If Enterprise Manager appears to lock up then try shrinking using it before
you go home and see if it has finished by the following morning.

Brian.

www.cryer.co.uk/brian
Jul 23 '05 #4

Jens wrote:
I have a database file LEAR_Index(yes, it hold index data) from a have have recently removed a bunch of data.
It is about 120 Gb, 100Gb of which is not used. I wan´t to shrink the file to lean 30-40Gb.

I´ve been trying this:

dbcc shrinkfile('LEAR_Index',40000)

But to no apparent avail; the file did not shrink.
I´ve tried using enterprise manager for this but it consistenly
crashes when performing this operation.#

Any thoughs, idear as to what i might be doing wrong?


It takes many hours on even good hardware to perform this operation.
you did not mention your disk setup.
In any event, if the actual usage is only 20gb, it may be cheaper to
create another file of 30gb, move the objects to it and drop the old
file.
alternatively you should consider partitioning, which will allow you do
make this move gradually.

Jul 23 '05 #5
Erland - why do you think this will help? Fragmented tables don't affect
shrink in the least, and also, shrink will most likely remove all the work
done by DBREINDEX as it tends to introduce fragmentation.

Thanks

--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine

This posting is provided "AS IS" with no warranties, and confers no rights.

"Erland Sommarskog" <es****@sommarskog.se> wrote in message
news:Xn*********************@127.0.0.1...
Jens (je************@lycos-europe.com) writes:
I have a database file LEAR_Index(yes, it hold index data) from a have
have recently removed a bunch of data.
It is about 120 Gb, 100Gb of which is not used. I wan´t to shrink the
file to lean 30-40Gb.

I´ve been trying this:

dbcc shrinkfile('LEAR_Index',40000)

But to no apparent avail; the file did not shrink.
I´ve tried using enterprise manager for this but it consistenly
crashes when performing this operation.#

Any thoughs, idear as to what i might be doing wrong?


You may first have to run DBCC DBREINDEX to defragment fragmented
tables.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Jul 23 '05 #6
Paul S Randal [MS] (pr*****@online.microsoft.com) writes:
Erland - why do you think this will help? Fragmented tables don't affect
shrink in the least, and also, shrink will most likely remove all the work
done by DBREINDEX as it tends to introduce fragmentation.


Ok, thanks for the correction, Paul!
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Mosey | last post by:
A huge (and never used) database log was taking up about 4 GB of HD space. We want the data for historical capacity, however, don't care about the transactions log. After a bit of research I ran...
2
by: Jaeger | last post by:
Hi all. I'm having trouble shrinking a database. In short, using the SQL Query Analyzer, I enter the following commands: DBCC SHRINKDATABASE (database, 80) GO The command returns the...
1
by: willie | last post by:
Hi all: I restored one backup database (7.9 GB mdf) on two diffrent servers. I shrunk them by clicking "Move pages to beginning of file before shrinking". After shrinking, one mdf file is 6.7...
1
by: jeffreyv | last post by:
Hi! I'm studying to have my MCSE 70-228 certification and I'm trying some things with backing up transaction logs and shrinking it. Here's what I do: There is no activity in the database by...
2
by: Marc C | last post by:
Hello, I am trying to clean up a database I inherited. I have an 80GB SQL 2000 database with 20 datafiles each 4096 in size. I have been able to remove unneeded data and am now trying to clean...
3
by: Bopolissimus Platypus Jr | last post by:
hello all, i've got a database that takes up 4G of space. when i run a script that deletes all rows and then vacuum, the data directory gets down to around 3-3.5G. what i'd like is to get a...
2
by: William | last post by:
I've been tasked with taking over the support for a client's SQL Server database. I'm not a DBA by profession, I'm a software developer who uses SQL Server as a database designer. The clients...
7
khickyphutz
by: khickyphutz | last post by:
Good day! I would like to ask for a technical advice regarding transaction logs. Right now, our server only have 2.8GB due to the transaction log of our database which is 65GB now. Its database...
0
by: kazper | last post by:
Good day, I have some problems regarding my Hard disk space for my logs in SQL Server 2005. When I try shrinking the database it returns an error not letting me to do anything about the size of...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.