Hi Experts,
In my organization we are Using MS NAV 2009 R2 with MS SQL2008 R2 Database.
MS SQL2008 R2 Database of NAV is become very huge and increasing like anything. Ex: 10 GB per month.
Here the mdf, ndf and ldf file sizes:
mdf --> 435MB
ndf --> 153GB
ldf --> 6.17GB
I have shrinked the database then,by below shrink query and the ldf file came to under 50MB. but still the ndf file size is not shrinked.
ALTER DATABASE [Database]
SET RECOVERY SIMPLE;
GO
DBCC SHRINKFILE ([Database_Log], 1);
GO
ALTER DATABASE [Databse]
SET RECOVERY FULL;
GO
Could you please help me out on controlling this database size growing?
Expecting your favorable reply.
Regards
S.A.K.Ahamed Meeran
0
Comments
Running Shrinkfile is the worse thing you can be doing.
Thanks for your immediate response.
Actually, My Whole database size is arround 160GB. We have gone live on one year back only.
For one year 160GB means, it is very huge. Specially while taking daily autobackup.
Is there any way to solve or we can control the size by doing some thing.
Please note that MDF size only 430MB only.
Thanks in Advance
My Concern is, why the Database ndf file is more than 150GB in size?
Is there any setup related things gone, while implementing the NAV?
Thanks for your answers in Advance
Where is the growth occurring? WHat are your 10 largest tables in terms of record counts? In terms of size?
You seem to have a concern with backup times. How long does it take you to do a full database backup? What are you backing up to? Do you also to transaction log backups?
Can you descibe your hardware?
Unnecessary dimensions, partial shipments/receipts of large orders, unnecessary analysis reports ect. may create huge volume increase. If it is certain that every and each setup is necessary, then you may try SQL partitioning of ndf files over disks.
Regards.
Dynamics NAV Developer since 2005
Why even be concerned with a 150 GB database? What issues is it causing or perceived to cause? We support many databases of 150 GB or even larger. Of course, if the growth is not legit then it should be addressed.
Dynamics NAV Developer since 2005
Why? You can't make a generic statement like that. You have to first determine where the growth is from and if it is legit. Yes, there are cases where it would not be legit. For example, a database that is too heavily indexed.
But I would not say this growth is a problem, without more information.
In addition to the tools SQL Server supplies, NAV provides a very nice view of the record count in each table.
You just need to do a little analysis.
http://mibuso.com/blogs/davidmachanick/
Is that advisable to optimize the tables? Coz, I have created one test database (Replica of Live) and optimized Value Entry table, then table size came from 13GB to 9GB (Found thru database information-->Tables in NAV).
Is that advisable to optimize all tables?
Thanks
Regards.
Dynamics NAV Developer since 2005
mdf size = 900MB
ldf size = 9000MB
So this seams normal!?
Regards.
Dynamics NAV Developer since 2005
How big is your ndf? That's where all the growth is.
No, 150 GB per year may not be typical of many NAV sites. But it's not abnormal either.
I would disagree with this in most situations.
1. With full recovery, you just need to do a normal log backup. Not special switches are needed.
2. I would say that FULL recovery is the more common settign for NAV databases. If you use SIMPLE recovery, then your restore points are only at the times of your backups. FULL recovery gives you must broader recovery points. Now, some sites, may be OK with the few recovery points provided by SIMPLE. A site by site decisions.
3. NEVER do a shrink on a regular basis.
4. Why would you want to "get rid of the log file"? By the way it's required.
Why?
Why do I need 9 GB of transaction log file?
Regards.
Dynamics NAV Developer since 2005
4. The size of the transacation log depends on your system. With full recovery, it need to be large enough to hold all transaction activity between backups. WIth SIMPLE it needs to be large enough to hold the largest set of active transactions. SIMPLE recovery does not "turn off" the log file. As is commonly misunderstood.
To the original poster (sakameeran) my advice would be to first study NAV a bit more. The answers you are looking for are very easy to find on this forum and other NAV community places or MSDN.
To cemkaraer I would like to advice to catch up on some best practices on installing and maintaining SQL databases in general.
Sorry for the interruption.
Thank you for sharing.
Regards.
Dynamics NAV Developer since 2005
I have no ndf file. Don't need it.
I think the ldf file size is this large (relative to the mdf) because we started with FULL en changed it later on to SIMPLE.
Regards.
Dynamics NAV Developer since 2005
Im not sure if "truncate log" is available/needed with SIMPLE. For cleaning it up once, ok, but (after shrinking) then at what size must I set it? I think a restore of a NAV backup will take up most of the log size, but how much?
Maybe it's easier to set it to FULL..but in our setup we must synchronize with other types of database and restore to a certain time is not needed. Im open to suggestions ofcourse. We can always learn.
Regards.
Dynamics NAV Developer since 2005
Please scroll up a few post and read Mark's suggestion.
Regardless of your recovery model, you do not want your transaction log to auto-grow. You also do not want to be shrinking it below the size that it needs to be. What that size is wil vary with how the system is used. But you would never want to keep shrinking it to the minimum size.
And also
Do I miss something?
Regards.
Dynamics NAV Developer since 2005
That is actually not accurate. In older SQL versions the setting "Simple Recovery" use to be called "Truncate on CheckPoint". Which is a more accurate description of what it does. Checkpointing is the process of SQL writing database changes from memory to the disk files. In "Simple Recovery", this also truncates the transaction log. Truncation removes the inactive portions of the log. It does not reduce the physical size of the transaction log file.
In terms of shrinking the log, just because you can doesn't mean you should. That quote from MSDN is a good description of what shrink does. But it's still a bad practice to use it on a regular basis.
Regards.
Dynamics NAV Developer since 2005