| 1 |
<HTML> |
| 2 |
|
| 3 |
<HEAD> |
| 4 |
<TITLE> ACEDB source code documentation: database recovery </TITLE> |
| 5 |
|
| 6 |
<LINK rel=stylesheet type="text/css" |
| 7 |
href="./wdoc.css" |
| 8 |
title="Style sheet for wdoc developer documents"> |
| 9 |
|
| 10 |
</HEAD> |
| 11 |
|
| 12 |
<BODY> |
| 13 |
|
| 14 |
<H1>Database Recovery</H1> |
| 15 |
|
| 16 |
<PRE> |
| 17 |
|
| 18 |
|
| 19 |
In some rare occasions, the following crash has occured. |
| 20 |
Acedb works ok up to say session 100, but then when you attempt to |
| 21 |
save session 101, you get a crash: |
| 22 |
duplicate block in fusebat |
| 23 |
or some other low lying cryptic message. |
| 24 |
This amounts to a fatal unrecoverable error in session 100, which |
| 25 |
probably happenned while acedb was writing to disk during session 100. |
| 26 |
In some cases, we traced the bug back to wrong file authorizations, |
| 27 |
please verify that all files in the database directory belong to |
| 28 |
the database owner. |
| 29 |
If secveral user have write access, all these files should eb unix writable |
| 30 |
by those users. Forexample, you may |
| 31 |
chmod 775 database |
| 32 |
chmod 664 database/* |
| 33 |
chown -R acedb_group database |
| 34 |
and verify that all users are in the 'acedb_group' unix group |
| 35 |
or that the code is set group id: |
| 36 |
chmod 2755 xace tace |
| 37 |
|
| 38 |
Anyway, you may be able to recover from the crash in 3 different |
| 39 |
ways: |
| 40 |
|
| 41 |
################################################################ |
| 42 |
## First method, a bit heavy, but no data is lost |
| 43 |
|
| 44 |
1) Open xace, it opens again as session 101. |
| 45 |
Dump the database from the menu of the main window |
| 46 |
create a new acedb in a fresh directory: |
| 47 |
cd somewhere |
| 48 |
mkdir wspec database |
| 49 |
cp oldwspec/* wspec |
| 50 |
setenv ACEDB `pwd` |
| 51 |
tace // or xace |
| 52 |
|
| 53 |
and read back the dump files. |
| 54 |
|
| 55 |
If you crash while dumping because the address of some object |
| 56 |
is wrong, you can jump that object from beeing dumped by inserting |
| 57 |
it in a special keyset called DoNotDump |
| 58 |
|
| 59 |
create a new keyset from the menu in the keyset window |
| 60 |
use add/remove option |
| 61 |
add inthat keyset the object you want to avoid for |
| 62 |
example by using the main window to select them or |
| 63 |
by using the query language |
| 64 |
Find myclass myobject |
| 65 |
|
| 66 |
save this keyset under the name DoNotDump |
| 67 |
|
| 68 |
then dump the database |
| 69 |
during all this process, do not save the database and do |
| 70 |
not attempt to open the falty objects |
| 71 |
|
| 72 |
################################################################ |
| 73 |
##Second method, very simple, but data from last session is lost |
| 74 |
|
| 75 |
|
| 76 |
2) You may backtrack to session 99 |
| 77 |
To do so, from the menu of the main window, use session manager |
| 78 |
and then use the destroy_last_session button |
| 79 |
|
| 80 |
Then restart acedb, it will open on session 100, now a new |
| 81 |
daughter of session 99, and hopefully the problem is fixed. |
| 82 |
|
| 83 |
################################################################ |
| 84 |
## Third method, totally crazy, avoid if possible |
| 85 |
|
| 86 |
3) If none of this works and you are a real hacker and |
| 87 |
you are totally desperate and the database will not open at all |
| 88 |
and you are completelly sure of the way you manipulate unix |
| 89 |
and you do not have any other way to recover your data from |
| 90 |
ace files, and you do not mind losing a whole day in vain, you |
| 91 |
may try the following which worked once for us: |
| 92 |
|
| 93 |
If the new superblock gets saved in a database, but not the |
| 94 |
control blocks it points to, the database becomes unreadable. By default, |
| 95 |
1 previous copies of the control blocks are kept, so it's possible |
| 96 |
to roll back the state of the database to a previous session. Here's |
| 97 |
how to do it. |
| 98 |
|
| 99 |
1) Look in the log.wrm file and determine the session number of the last |
| 100 |
saved session, attempt to roll back to a few less than this. |
| 101 |
|
| 102 |
2) Look in sysclass.wrm for the class no of _VGlobal. |
| 103 |
( I don't know how to determine this in a new databse without sysclss.wrm |
| 104 |
assume that it's one. ) |
| 105 |
|
| 106 |
3) Execute diskdump on the database blocks.wrm file. Each line represents |
| 107 |
one black and the fields are: |
| 108 |
class, actual address, stored address, next address, key, session |
| 109 |
|
| 110 |
4) Look for all the blocks with class Global, class number is given by c=xx |
| 111 |
where xx is the hex class number. |
| 112 |
|
| 113 |
5) search in these blocks for ones whose session is equal to that |
| 114 |
you want to roll back to. Session is the last number on the line. |
| 115 |
eg, diskdump | grep 'c= 1' | grep '612$' |
| 116 |
|
| 117 |
6) The keys have top eight bits class, and bottom 24 bits index. |
| 118 |
look for a key which is in one block only, probably 2. |
| 119 |
Hence a key of 1000002. Note the address of this block |
| 120 |
|
| 121 |
7) Run diskfix <session> <block address> |
| 122 |
|
| 123 |
8) See if it worked. |
| 124 |
|
| 125 |
9) If it didn't, try an earlier session and repeat, that is, if any |
| 126 |
earlier session is available, which would be wrong by default. |
| 127 |
|
| 128 |
################################################################ |
| 129 |
################################################################ |
| 130 |
|
| 131 |
|
| 132 |
<PRE> |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
</BODY> |
| 137 |
</HTML> |
| 138 |
|