December 10, 2003 at 8:51 am
Hi there.
In a nutshell the problem is:
We have a database on one server that claims it's size is 1,803MB.
Yet if we export that database to another server, its size decreases to only 875MB.
WHY?
I've carried out DBCC CHECKDB, and everything checks out ok. There's no actual data missing from the smaller database.
Carrying out DBCC SHRINKDATABASE yields nothing very exciting.
Have also done;
DBCC CHECKTABLE on all tables;
DBCC CHECKALLOC WITH ALL_ERRORMSGS
.. and not a thing.
Something that may be related;
Recently we need to change some column data types from text to ntext to accommodate some international customers. Without the ability to change these types easily, we:
- created a new temp column;
- copied all the data across;
- deleted all the data from the original column;
- changed the column data type to ntext;
- copied all the data from the temp col;
- dropped the temp col.
Could this be related in any way?
Any help and advise would be great.
Thanks in advance,
Ollie.
December 10, 2003 at 9:08 am
What is the size of the log files for the database in question on the two servers?
K. Brian Kelley, GSEC
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
K. Brian Kelley
@kbriankelley
December 10, 2003 at 9:14 am
Hi,
The allocated space for the files are as follows;
On the oversized database;
Data file: 1801
Trans log: 3
On the small database;
Data file: 872
Trans log: 4
Thanks,
Ollie.
December 11, 2003 at 7:06 am
When you talk size you do not mean the datafile size?
And export/import could be a means of defragmentation/index rebuilds and that should account for a little decrease in the database size.
Mike
December 11, 2003 at 7:28 am
"When you talk size you do not mean the datafile size?"
- Yes, I do mean the data file size. The size that's allocated when (in Enterprise manager) you right click and view properties.
Like I say, we can't get it to allocate any less space.
"defragmentation/index rebuilds should account for a little decrease "
... but prehaps not a gigabyte on an 800Mb database?? What do you think?
Any advice would be greatly recieved.
Thank you.
Ollie.
December 11, 2003 at 9:03 am
Using EM Right Click on the original large database, Choose All Tasks, the chose Shrink Database. At the top of this window you should be able to see the Space Allocated and Space Free. What is that?
If you now click the files button at the bottom a new window will pop up. Near the bottom of this window it will say Shrink file to ... and just to the right the minimun size to which you can shrink the data file. Here can you shrink the file to about the 872 M size?
Francis
December 11, 2003 at 11:02 am
Have you tried running sp_spaceused on both databases? That stored procedure (refer to BOL for more information on it's usage) will show you how much space is being used and what is using it. It shows the total space used, how much for indexes, unallocated space, data, etc.
Run it on both servers and compare the two. The difference might be the unallocated space or it might show that something wasn't copied over.
-SQLBill
December 11, 2003 at 12:50 pm
I had a similar situation we had a 10 Gig
database and it comes over as 1.XG.
The database was badly in need of a reorg though.
Among many things we deleted 90Million rows in a table that had 100M rows.
Yes you can loose more than a Gigabyte due to database reorganization.
And I will not worry to much about it if It could be verified that all the objects are present.
Mike
December 11, 2003 at 4:26 pm
I had a problem yesterday with the transaction log fle being far too big. In the end we had to do run the command
"backup log DBase_Name with Truncate_Only"
from OSQL to force the truncation of the log (we had previously done a full back up of the database). The we ran
"DBCC Shrinkfile (DBase_Logfile_name)"
This shrunk the log file to just 1 MB. Now I realise that this isn't a transaction log but rather a database problem, but perhaps you could try
"DBCC Shrinkfile (Database_Filename)" ?
February 17, 2004 at 9:17 am
Hello Ollie!
I guess you should look into DBCC CLEANTABLE
BOL:
DBCC CLEANTABLE DBCC CLEANTABLE reclaims space after a variable length column or a text column is dropped using the ALTER TABLE DROP COLUMN statement. It does not reclaim space after a fixed length column is dropped.February 18, 2004 at 6:56 am
hello,
i suggest you should correctly shrink your DB. That means, you alternate shrinking and Backups until the free space is 0.
Then have look at the real size
fred
February 18, 2004 at 9:11 am
My co-worker had the same issue.
When he was shrinking the database, he was shrinking the database without having the "Move pages to beginning of file" option checked. When the shrink ran, the size stayed about the same.
When he ran with the "Move pages to beginning of file" option checked, the database shrunk by 4 gig.
Are we having fun yet....
EP
February 18, 2004 at 11:47 am
-dbcc updateusage can help out. statistics get a bit messy when you use truncate table every now and then.
-then dbcc spaceused your db and look for fragmentation rates.
-make sure you have clusterd indexes on your objects. and rebuild them whenever you can.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply