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.
0
Comments
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.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Are there manualy created (large) SQL tables or indexes in the database that Navision would not backup?
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?
RIS Plus, LLC
RIS Plus, LLC
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.
Technical Consultant
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:
You can use this list of tables, and analyse the size of the tables with the statement:
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:
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
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.
RIS Plus, LLC
Just curious, but did you analyse the data on usage per table?
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
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.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
There might be some piece of code doing a crazy change on the database
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...
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Nope no addon.
If you have setup a nightly plan to reindex the keys, are they written to log file?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
This is one of the default options in the SQL Perform tools.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
To truncate the log file you either do a TL backup or you truncate it manually, like this: 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).
RIS Plus, LLC
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,
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC
Oh ... OK :-k
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
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.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC