Crazy file size on SQL Server

DenSter
Member Posts: 8,307
I have a customer whose database file is about 700 MB when restoring into a C/SIDE database file. When I use the same backup file to create a new SQL Server database, that same database file size is about 1.5 GB, so about twice as big. The kicker is that my customer's production database, the one that they created the backup from, is 28 GB!! He says he ran the optimization on all tables, so there's nothing to be gained there.
Does anyone know how this might have happened, and possibly how to reduce the size back to a manageable size? They are moving their production database over to a new hosted server, and if they can recuce the production database size to the 1.5 GB, the cost is going to be about half of what the current size would cost.
Does anyone know how this might have happened, and possibly how to reduce the size back to a manageable size? They are moving their production database over to a new hosted server, and if they can recuce the production database size to the 1.5 GB, the cost is going to be about half of what the current size would cost.
0
Comments
-
what are the size of
ldf
ndf
mdf
and how much free space does each have?
They could do a navision backup, and restore it in a new db.
I'm guessing the log file could be the reason, or they have a maintance job that changes the large filfactor on index nightly?
If it's the same database that they went live on, they probably had test companies etc that they deleted afterwards.0 -
I would also have a look at the empty space of the SQL files and the default fill factor.
Are there manualy created (large) SQL tables or indexes in the database that Navision would not backup?0 -
Guys... it's me... I checked that already
The 28GB is the used part of the NDF file. The used part of the new NDF is about 1.5GB. They don't have anything but NAV data in the database. I doubt that they created indexes manually, since they needed my help to create a new database.
The thing is, they are going to create a new database on 25GB drive space (I told them to use 100GB but that is too expensive), so in my mind it's only a matter of time before they grow out of that space. If I can figure out why it grew and what to do about it, I can help them keep control of the file sizes.
What could have caused the growth? How can I fix it?0 -
Is there any customistation in the database that does a RENAME of a record? This can cause a huge transaction to roll-back.0
-
Wouldn't that be in the TL though? The TL is another 17GB, and that gets cleared when they do a full backup.0
-
hi! DenSter,
what is the size of log file - ?, may be that is one reason or try to shrink database, then check the size of database.
Anil Kumar.Anil Kumar Korada
Technical Consultant0 -
Just a long shot:
What about the "zero sift records"? Did you check these with the toolkit?
You say that the 28 Gb is the used part of the NDF file, so shrinking the database won't give much of a difference.
For analysing the data, this can be useful:
To get a list of tables with largest rowcount:SELECT [TableName] = so.name, [RowCount] = MAX(si.rows) FROM sysobjects so, sysindexes si WHERE so.xtype = 'U' AND si.id = OBJECT_ID(so.name) GROUP BY so.name ORDER BY 2 DESC
You can use this list of tables, and analyse the size of the tables with the statement:exec sp_spaceused 'tablename'
And before you do that, I would use this statement to update the usages. It will make sure you get correct information from the "sp_spaceused"-stored procedure:DBCC UPDATEUSAGE
0 -
Sorry if it is stupid but why not just stop the server after business hours, create a backup and restore it to the new server? Shouldn't take more than a few hours.0
-
I think the question was asked to seek the cause for the big file size. I think Denster already mentioned there are several solution to fix it.0
-
Miklos Hollender wrote:Sorry if it is stupid but why not just stop the server after business hours, create a backup and restore it to the new server? Shouldn't take more than a few hours.
Your "solution" does not address the problem, so therefore it is not a solution. Over here we call that a band-aid. You're treating a symptom, not the problem.0 -
DenSter wrote:Miklos Hollender wrote:Sorry if it is stupid but why not just stop the server after business hours, create a backup and restore it to the new server? Shouldn't take more than a few hours.
Your "solution" does not address the problem, so therefore it is not a solution. Over here we call that a band-aid. You're treating a symptom, not the problem.
Just curious, but did you analyse the data on usage per table?0 -
Hello. I ran into the same problem today for one of our client. The db is 3 gig, but the log file was 68 gig. This is 4.0 sp2. SQL 2K5.
I did notice that in the log file the unrestricted growth was unchecked and the max size was set to 60 gig.
hmmm. I didn't have time to look into detail. So i had to do a back and restore.
I tried to shrink the log file, but nothing.
This could be a sql bug.0 -
Are Denster and you both using the same add-on or component from Tectura?
There might be some piece of code doing a crazy change on the database0 -
ara3n wrote:Hello. I ran into the same problem today for one of our client. The db is 3 gig, but the log file was 68 gig. This is 4.0 sp2. SQL 2K5.
I did notice that in the log file the unrestricted growth was unchecked and the max size was set to 60 gig.
hmmm. I didn't have time to look into detail. So i had to do a back and restore.
I tried to shrink the log file, but nothing.
This could be a sql bug.
Shrinking the log can result into nothing ... I usually always have success with putting the recocvery model to "simple", then shrinking, then putting back to "full"... after full backup off course...0 -
Mark Brummel wrote:Are Denster and you both using the same add-on or component from Tectura?
There might be some piece of code doing a crazy change on the database
Nope no addon.
If you have setup a nightly plan to reindex the keys, are they written to log file?0 -
Your maintenance should run on a simple recoverymodel.
This is one of the default options in the SQL Perform tools.0 -
Yes, that is true, but after the maintenanceplan you want to restore the previous value which can be different per customer.0
-
ara3n wrote:Hello. I ran into the same problem today for one of our client. The db is 3 gig, but the log file was 68 gig. This is 4.0 sp2. SQL 2K5.
I did notice that in the log file the unrestricted growth was unchecked and the max size was set to 60 gig.
hmmm. I didn't have time to look into detail. So i had to do a back and restore.
I tried to shrink the log file, but nothing.
This could be a sql bug.
To truncate the log file you either do a TL backup or you truncate it manually, like this:backup log MyDatabase with truncate_only
After this, the TL file should be mostly empty. I would personally not shrink it, because that will only frgment the file, and it's going to grow anyway.
To automatically have the log truncated you either set up a log backup in a maintenance plan (if you're running on full recovery model) or a full backup should take care of it (if you're running on simple recovery model).0 -
Hi,
I would suspect some customization involving new or modified index with SIFT fields, including one or more DATETIME variables, and without properly set SIFT Levels to maintain.
In such a case every DATETIME field gives you 7 SIFT levels, so on some big table can gives you HUGE SIFT table.
But in this case just after restoring backup the database should be quite big. On the other side frequent insert or modifications on such a table causes many many pages in SQL file do get dirty, so database grows quite fast.
Regards,
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
You know I could spend days trying to find that out, and it would be much less expensive for the customer to just get a couple of extra disks...0
-
[Topic moved from Navision to SQL General forum]0
-
Just FYI.
You can easily check the file size per table via a built-in report in SQL2005.
In SQL Server Management Studio, select the database in the object explorer. Click "Report" in the summary. In that report, expand "Disk Space Used by Tables".
Hope it's useful.0 -
Thanks I had found that one too. This customer has moved to a new server, and has just come back around to me with the same issue, so I'll have the opportunity to check again. I'll come back with what I found.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions