Windows 7 - datastore.edb removed, any way to get it back?

Asked By OHCO on 10-Mar-08 07:43 AM
Hi I have some failed updates and I search through some threads and perform a
delete on the software distribution folder and datastore.edb is removed.
This cause the history in windows update removed as well.  Is there a way of
getting it back?  My system is win XP home edition.  Thanks.




MowGreen [MVP] replied on 10-Mar-08 02:54 PM
Did you try to utilize System Restore to see if that brought it back ?
Other than that or backing up the entire Hard Drive, No, there is no way
to get it back.

There is a log located in WINDOWS\SoftwareDistribution named
ReportingEvents.log. That shows all successful updates done via
Automatic Updates, but is not as inclusive as the datastore.edb.
IF the failed updates were caused by a *corrupted* datastore.edb, then
restoring it will cause more updates to fail in the future.

You can attempt to determine the integrity of the file using esentutl :
http://www.tomshardware.com/ucg/commands/esentutl-13450.html

Sometimes datastore.edb needs to be defragmented or repaired. One
*should* create a backup of it, but that's IF they original is not damaged.
To see what options esentutl has, open a Command Prompt and type in
esentutl /?
at the prompt and then press Enter.


MowGreen  [MVP 2003-2008]
===============
*-343-*  FDNY
Never Forgotten
===============
OHCO replied on 11-Mar-08 03:29 AM
Hi, just wondering as you say there is a windows\softwaredistribution
directory with a datastore subdirectory with the datastore.edb file.  I guess
what I have removed is the directory from
windows\system32\softwaredistribution, are these 2 the same?  If I copy one
over the other, will it get back my history?  Thanks.
MowGreen [MVP] replied on 11-Mar-08 01:59 PM
WINDOWS\system32\SoftwareDistribution contains subfolders that,
apparently, are temporary storage locations for previous and current
wuapi.dll, wups2.dll, and wups.dll. The active .dll files 'work' from
the WINDOWS\system32 subfolder. NO history is stored there.

WINDOWS\SoftwareDistribution\DataStore\datastore.edb is where the update
history shown on either the Windows or Microsoft Update sites.
By deleting all the WINDOWS\SoftwareDistribution subfolders one also
deletes the datastore.edb, too.
So, if you did NOT do that, then it should be present.
If you did, then the only recourse is to use System Restore to roll the
system back to a point in time when it existed.


MowGreen  [MVP 2003-2008]
===============
*-343-*  FDNY
Never Forgotten
===============
OHCO replied on 12-Mar-08 03:13 AM
Hi, well then I have a problem.  My WINDOWS\SoftwareDistribution directory
seems to be intact with the Datastore sub-directory and the Datastore.edb
file which is last updated 12/3/2008 18:07 probably I just tried the
windowsupdate website.  However, my windowsupdate website shows me in my
history that I have got no updates?  It tells me "You have not yet installed
updates from this website or by turning on automatic updating on your
computer. To select and install updates now, go to our Home page."  Why?  I
don't understand then.  Thanks.
MowGreen [MVP] replied on 12-Mar-08 03:38 PM
Is the installed antivirus/security suite scanning the DataStore folder?
If it has been then it is possible that datastore.edb has become
corrupted/damaged.

Virus scanning recommendations for computers that are running Windows
Server 2003, Windows 2000, or Windows XP
http://support.microsoft.com/kb/822158

*** BEFORE *** running any commands, advise you to make a Copy of
datastore.edb and move it to another location, for example, the Desktop,
*just in case * the file becomes damaged from running commands.
To do so you will have to Stop the Automatic Update service first.
Start > Run > type in

net stop wuauserv
Click OK or press Enter

Copy datastore.edb now
You can then restart the Automatic Updates service OR, leave it in the
Stopped state and run the following commands to check the Integrity of
datastore.edb.

Press enter after *each command*
Wait until the Integrity check is run [esentutl /g] and the results are
shown before entering the remaining commands.

Go to Start > Run > type in or copy and paste the below after the prompt

cmd
net stop wuauserv  [ use this if you restarted the AU service ]
esentutl /g %windir%\softwaredistribution\datastore\datastore.edb
net start wuauserv  [use this is you stopped the AU service above ]
exit

Depending on what the result is there are other commands that will
attempt to Defragment, Recover, and Repair datastore.edb. if the
Integrity check indicates that they should be run.

Please post back with the result of the Integrity check.


MowGreen  [MVP 2003-2008]
===============
*-343-*  FDNY
Never Forgotten
===============
OHCO replied on 13-Mar-08 03:22 AM
Hello, after running the command:
esentutl /g %windir%\softwaredistribution\datastore\datastore.edb
this is what I got:

Microsoft Windows XP [版本 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Microsoft(R) Windows(TM) Database Utilities
Version 5.1
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initiating INTEGRITY mode...
Database: C:\WINDOWS\softwaredistribution\datastore\datastore.edb
Temp. Database: TEMPINTEG944.EDB

Checking database integrity.

Scanning Status (% complete)

0    10   20   30   40   50   60   70   80   90  100
|----|----|----|----|----|----|----|----|----|----|
...................................................


Integrity check successful.

Operation completed successfully in 0.969 seconds.

I went to the windows update website and I still can't see my history of
updates.  Any more suggestions please?
MowGreen [MVP] replied on 13-Mar-08 02:28 PM
Apparently this issue is not related to the 'health' of the system's
update extensible database [datastore.edb]. It's most likely being
caused by security software [firewall, ActiveX and/or script monitoring,
popup|cookie blocker,etc] that is preventing the update site from
reading the file.

MowGreen  [MVP 2003-2008]
===============
*-343-*  FDNY
Never Forgotten
===============
OHCO replied on 13-Mar-08 10:16 PM
Hi, this is strange, I have downloaded an update from the website and its
showing in my history, just the other previous ones don't appear.  If
something is blocking, shouldn't the most recent one be not shown either?
Thanks.
MowGreen [MVP] replied on 14-Mar-08 03:39 PM
Yes, they should. And your correct ... this is strange.
See if you can locate TEMPINTEG944.EDB, the file created from running
the Integrity check. Open it with Notepad and perhaps that will provide
us a clue as to what's going on.
If the file was truly temporary and is now gone, suggest you run the
Recovery command from a Command Prompt to see if that fixes any
inconsistency in datastore.edb [* make a backup copy first if you have
not done so already* ]

esentutl /r %windir%\softwaredistribution\datastore\datastore.edb

A log *should* be created in the directory esentutl.exe resides in,
WINDOWS\system32

FWIW, all successfull updates done from the update sites and via
Automatic Updates are listed in the ReportingEvents.log, located in
WINDOWS\SoftwareDistribution
However, the log does not contain permanent entries rather, it's limited
in size and older entries are overwritten when it reaches a certain size.


MowGreen  [MVP 2003-2008]
===============
*-343-*  FDNY
Never Forgotten
===============