473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Further adventures in Jet database compaction

I am using Jet 4.0 through OLEDB and C++.

My travails with compaction are well known to regular readers of this NG.
Many of my problems were solved by disabling record locking.

I am now confronted with two remaining mysteries, which I suspect are
related:
-------------------------------------------------------------
The Mystery of the Zombie Session (a horror story)

I have a code fragment that opens a simple test database, then compacts it
using IJetCompact. Usually works fine.
The sequence is:

...set up dbinit as a propset, nothing special ..

CDataSource db;
HRESULT hr = db.Open(sDBProviderName, (DBPROPSET*)&dbinit,
(ULONG)ELEMCOUNT(dbinit));

...set up for compaction ..

CComPtr<IJetCompact> spJetCompact = NULL;

CComPtr<IDBCreateSession> spSession = NULL;

ATLASSERT(db.m_spInit != NULL);

hr = db.m_spInit->QueryInterface(IID_IDBCreateSession, (void**)&spSession);

hr = spSession->QueryInterface( __uuidof(IJetCompact),
(void**)&spJetCompact);

CDBPropSet propset_compact[2];

propset_compact[0].SetGUID(DBPROPSET_DBINIT);

propset_compact[0].AddProperty(DBPROP_INIT_DATASOURCE, wszDest);

long x = GetJetEngineType( sDBProviderName, wszSrc );

propset_compact[1].SetGUID(DBPROPSET_JETOLEDB_DBINIT);

propset_compact[1].AddProperty(DBPROP_JETOLEDB_ENGINE, x);

propset_compact[1].AddProperty(DBPROP_JETOLEDB_DATABASEPASSWORD, sPWD);

CSession * psession = new CSession;
delete psession;

hr = spJetCompact->Compact(ELEMCOUNT(propset_compact), propset_compact);

So the basic sequence is:

Open DB ---> Compact

This works.

Now I do this:

Open DB ---> Open Session on DB ---> Compact.

This fails, not surprisingly, as all sessions need to be closed to compact.

Now, the mystery:

OpenDB ---> Open Session on DB ----> Close the same session ---> Compact

FAILS (E_FAIL)

What is going on??? The session is closed before compaction starts.

So that is Mystery #1.

----------------------------------

The Galloping Bloat Mystery

I have code that watches my database to see when it has grown by X bytes (x
~= 250 MB usually)

When it crossed the magic line, it closes all sessions, and closes the DB,
and calls a function that opens the DB to compact it, then closes it again.
Compaction generally works and reduces database size (on the first try) by
about 30%. I am careful every time I open the DB, whether for compaction or
general use, to disable record locking, as this causes bloating.

After compacting, though, the database seems to grow massive again really
fast, forcing another compaction. This compaction is over quickly, and
reduces the database by some 80% very fast. The DB then starts growing very
quickly despite being stuffed with small amounts of data, and the process
repeats endlessly. I have walked away from computers in this state and come
back after a few hours to find the problem seems to have solved itself!

I suspect the Zombie Session is responsible - but can't be sure.

Anyone else encountered these nasties?

RDeW


Nov 13 '05 #1
4 1970
I have a client who is experiencing something similar enough that I
wanted to post this response, just in case we can find a common ground.

The program is composed of an Access 2003 front end and back end. They
are running it in a Terminal Server environment. We compacted their
data file last night after close of business and it was 144 MB. This
morning at 7:30 it was 1.75 GB. The growth seems to slow down once it
reaches 1.75 GB, but it has reached 2.05 GB before we discovered it and
compacted it.

We have many other clients that run this exact same program, and 28 of
the clients use Terminal Server. This is the only client that
experiences this problem. I know inserting images into a database can
cause huge bloat, but we do not do that.

If anyone has any ideas on what may be causing this, I'd be extremely
grateful to hear them. Thanks!

Nov 13 '05 #2
Is record-level locking enabled when the DB is opened? That was the root
cause of much of my bloating.
Be aware that there are several places where record locking can be enabled;
one of them is a global default set in the registry, you can find helpful
information here :
http://ewbi.blogs.com/develops/2004/..._corrupti.html . Of course,
you should think about what kind of locking you need before you turn it off
....
I have found another cause of bloat but it is a much more complicated
scenario, contact me if you still need help.

RDeW

"Kristina" <kr**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I have a client who is experiencing something similar enough that I
wanted to post this response, just in case we can find a common ground.

The program is composed of an Access 2003 front end and back end. They
are running it in a Terminal Server environment. We compacted their
data file last night after close of business and it was 144 MB. This
morning at 7:30 it was 1.75 GB. The growth seems to slow down once it
reaches 1.75 GB, but it has reached 2.05 GB before we discovered it and
compacted it.

We have many other clients that run this exact same program, and 28 of
the clients use Terminal Server. This is the only client that
experiences this problem. I know inserting images into a database can
cause huge bloat, but we do not do that.

If anyone has any ideas on what may be causing this, I'd be extremely
grateful to hear them. Thanks!

Nov 13 '05 #3
Thanks for your quick reply. I'm checking to see if record locking is
the cause of my problem. Thanks for your help!

Kristina

Nov 13 '05 #4
Thanks for your quick reply. I'm checking to see if record locking is
the cause of my problem. Thanks for your help!

Kristina

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Graham Mattingley | last post by:
Hello Groups, I have been testing a script I found that checks URL as valid... It uses the XMLHTTP.4.0 object sURL = "http://www.bbc.co.uk" Set obj = CreateObject("MSXML2.XMLHTTP.4.0") on...
19
by: dchow | last post by:
Our database size is currently 4G and is incrementing at a rate of 45M/day. What is the max size of a SQL database? And what is the size beyond which the server performance will start to go down?
1
by: Tom Vinson | last post by:
Is there a way to determine when an Access database was last compacted, or if it has not been modified since the last compaction? I need to run a utility program every night to compact databases,...
1
by: Riley DeWiley | last post by:
There is a way to ask a data source how much space would be freed if compaction were to be done. I saw the reference, but now cannot find it. Anyone know where that web page was? Even Google has...
5
by: MLH | last post by:
I've read a number of posts over the years that dealt with the issue of database bloat. I'm wondering if anyone has determined exactly what information comprises the bloat when it does occur. Has...
13
by: Chris Botha | last post by:
The machine is running XP Pro with all the latest service packs, etc. I must access an Oracle database so I installed the Oracle client stuff. I can query Oracle from a Windows app, no problem....
14
by: RSH | last post by:
I am exploring OOP and I am trying to get a grasp on the basics. Below is the code that creates a basic Person with basic properties. I also have an Orders Class where Orders are made by...
6
by: Adrian | last post by:
Hi From within a VB app how do you cause a global memory compaction or free up as per the many memory freeing applications? Can you say via VB to windows to clean-up/ free up memory used by just...
20
by: Shalini Bhalla | last post by:
i am not able to assign values ,can any one tell me whats wrong .... <script> function changeMySrc(nm,act) { alert("hi"+ nm ); if(act == 1) { ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.