Scope of "DBEngine.SetOption dbMaxLocksPerFile, 50000"

I am writing a conversion that is totally data orientated.  Reading legacy records in an old format then reformatting and writing them many time.  Some files with several million records.

I was having some issues and got some very good advice on EE, which was to use this statement to increase the number of locks permitted.
DBEngine.SetOption dbMaxLocksPerFile, 50000

Open in new window


I used the statement in the procedure I was having issues with and it solved the issue.  Now I am wondering what the scope of the statement is.  Meaning, do I have to put it in every module doing the heavy processing or is it a 'set once and it becomes the default throughout your application, until you exit the application.

As a precaution I was thinking of putting the statement at the beginning of every one of my heavy processing routines.  However I am guessing there is overhead related to this command so I don't want to execute it unless necessary.
LVL 1
mlcktmguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
hi Mick,

it should stay set unless changed.  Realize, however, this changes the client settings too.

have an awesome day,
crystal
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<As a precaution I was thinking of putting the statement at the beginning of every one of my heavy processing routines. >>

 Do it at app startup.  It will remain in effect as long as you don't close Access.

<< However I am guessing there is overhead related to this command so I don't want to execute it unless necessary.>>

  No, there is not.   What it is is a sanity check on the number of locks that can be placed.    It was introduced WAY back when Novell servers were popular.  Novell would come to it's knees with too many locks, so the limit was added.

  The default is 9,500 locks, which is woefully inadequate in today's times.  Why Microsoft hasn't upped this by now I don't have a clue, and matter of fact, even 50,000 is too low.   I would not set this to less than 100,000, and usually do 1,000,000.

Jim.
2
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.