How to - AI recovery

Posted by goo on 23-Jan-2019 09:58

11.7.4

Trying to understand how the AI works. This is testing, if I delete all AI files, how to I build them again? Trying to understand this Kbase 46256

It seems that I have to do a prostrct builddb ......

 

Is it so that I need to get all the .ai files back before doing anyting? I assumed I could rebuild the .ai files and ENABLE the AI again?

 

Feel a bit confused...

**********************

RECOVERY: 
 
3.  Remove the ai file references from the dbname.st file lines starting "a "

$ vi dbname.st

 4.  Remove the dummy ai files on disk previously created

$ rm dbname.a*

Although this methodology was never supported, in OpenEdge 10.0B and previous versions, it was possible to run PROSTRCT REMOVE against After Image files which did not exist. In OpenEdge 10.1A it's no longer possible to do this so "PROSTRCT builddb" with an up-to-date copy of the <dbname>.st file needs to be used to recreate the database Control Area, which can also be used in earlier versions. Do not list the After Image files that have already been removed in the modified .st file, but be sure to include all other database extents and their full paths.

$ mv dbname.db REN_dbname.db
$ prostrct builddb dbname dbname.st

 View dbname.st to see ai files are no longer present but all others are

$ prostrct list dbname

 
RENABLE AI : 

5.  Truncate the bi file

$ proutil dbname -C truncate bi

6.  Add the required AI extents

$ prostrct add dbname dbname_ai.st

Where the st text file which contains only the ai file definitions (dbname_ai.st)

# dbname_ai.st example

a . f 512000
a . v 512000
a .  

7.  Enable After-Imaging, AI Management (and replication if needed according to site procedures.)

$ rfutil dbname -C mark backedup
$ rfutil dbname -C aimage begin
$ rfutil dbname -C aiarchiver enable

 8.  Start the database and take an online PROBKUP

$ proserve dbname [+params]
$ probkup online dbname dbname_newbaseline.backu

*****************************************************************************

Posted by George Potemkin on 24-Jan-2019 13:26

> And I will be good to go?

As Ruanne has pointed out you need to edit the .st file and to use prostrct builddb to create new .db file.

Alternate approach:

Disable AI logging, copy any existent AI file to replase the lost one(s) and then enable AI logging.

You can make the replacement of the lost AI files before disabling AI. The order of steps does not matter.

All Replies

Posted by goo on 23-Jan-2019 10:03

First I have to do this:

But I have a windows platform, so touch is not possible. I also get a SYSTEM ERROR .....a1 is too small 0, blocksize 8192 extend failed.

How can I build a dummy-file that will be ok?

*********************************

A. Recovering from loss of all or some AI files that include the current BUSY AI extent to keep production online until downtime can be scheduled:

OPTION 1: Disable After-Imaging online

(Starting point after the AI files have been removed eg: rm dbname.a*)

1.  Replace ALL ai files with the same permissions as the Control Area dbname.db file after reviewing "prostrct list dbname dbname.st" to count current ai files in control area:

$ touch dbname.a1

$ touch dbname.a2

$ touch dbname.a3

2.  Disable After-Imaging online

$ rfutil dbname -C aimage aioff

At this point, AI is disabled against the database (and AIMGT and Replication if enabled), new connections can now be made to the database without error, production continues. But the database still has dummy ai files in its Control Area structure which needs to be corrected at the next opportunity to shut the database down.

$ proshut dbname -by -shutdownTimeout immed

************************************

Posted by goo on 23-Jan-2019 11:42

I ended up with a prorest, much simpler, but still not sure how to fix it in windows, without the .ai file

Posted by goo on 23-Jan-2019 11:42

I ended up with a prorest, much simpler, but still not sure how to fix it in windows, without the .ai file

Posted by bronco on 23-Jan-2019 12:17

touch can be "emulated" by:

type nul > dbname.a1

As far as unix cli commands go: I recommend downloading Git for Windows which has good set of fulle functional *nix commands to use on a DOS prompt.

See: https://gitforwindows.org/

Posted by George Potemkin on 23-Jan-2019 12:19

On Windows you will not lose AI files while db is online because the files are locked on OS level.

Offline you can disable AI logging even if  some AI files are lost:

proenv>proserve sports
OpenEdge Release 11.7 as of Mon Mar 27 10:21:51 EDT 2017
15:15:36 BROKER     This broker will terminate when session ends. (5405)
15:15:36 BROKER     The startup of this database requires 17Mb of shared memory.  Maximum segment size is 128Mb.
15:15:36 BROKER  0: ** Cannot find or open file D:\Proapps\Wrk_11.7\sports.a1, errno = 2. (43)
15:15:36 BROKER   : Removed shared memory with segment_id: 41025536 (16869)
15:15:36 BROKER     ** This process terminated with exit code 1. (8619)
proenv>rfutil sports -C aimage end
OpenEdge Release 11.7 as of Mon Mar 27 10:21:51 EDT 2017
** Cannot find or open file D:\Proapps\Wrk_11.7\sports.a1, errno = 2. (43)
After-image disabled. (846)

Posted by Ruanne Cluer on 23-Jan-2019 12:30

Yes, prorest is the way to go. These are instructions of last resort ;)

The Article 000046256, is specifically for UNIX. The objective of the instruction is to keep production running until you can fix the database structure again.

On Windows you'd get "Permission denied" trying to delete your ai files while the database is running.

The offline repair and recover instruction should work

If you've deleted all AI files, you build them again by ensuring the Control Area is repaired:

$  del foo.a*

$  prostrct list foo (now remove the ai extents from the .st file)

$  del foo.db

$  prostrct builddb foo foo.st (this has every extent except ai files in it)

$  prostrct add foo foo_ai.st (this only has the ai files in it)

Posted by George Potemkin on 23-Jan-2019 12:38

prostrct remove command removes a description of extent (a record in _AreaExtent) as the first step.

Then it tries to delete the file itself. And who care if it fails? ;-)

proenv>prostrct remove sports ai
OpenEdge Release 11.7 as of Mon Mar 27 10:21:51 EDT 2017
** Cannot find or open file D:\Proapps\Wrk_11.7\sports.a1, errno = 2. (43)
D:\Proapps\Wrk_11.7\sports.a2 successfully removed. (6968)
 
proenv>prostrct remove sports ai
OpenEdge Release 11.7 as of Mon Mar 27 10:21:51 EDT 2017
** Cannot find or open file D:\Proapps\Wrk_11.7\sports.a1, errno = 2. (43)
Error locating last extent record of area 12 : After Image Area 1. (6957)

proenv>prostrct remove sports ai
OpenEdge Release 11.7 as of Mon Mar 27 10:21:51 EDT 2017
Database contains no ai areas. (6954)

There are no needs to use prostrct builddb

Posted by goo on 23-Jan-2019 13:02

What does this command?
prostrct builddb foo foo.st
 
Is it so that deleting the db i.e. xxxx.db , and then do a prostrct builddb xxxx xxxx.st  do not harm any data in the database? As long as all the .b and .d extents exists ?
 
//Geir Otto
 

Posted by goo on 23-Jan-2019 13:02

Thanks, nice to know.
 

Posted by George Potemkin on 23-Jan-2019 13:11

> What does this command?

> prostrct builddb foo foo.st

It creates the records in _Area and _AreaExtent system tables based on information in st file.

Control Area (area # 1 or .db file) contains only those two tables.

Posted by Ruanne Cluer on 23-Jan-2019 13:46

"proenv>prostrct remove sports ai

OpenEdge Release 11.7 as of Mon Mar 27 10:21:51 EDT 2017

Database contains no ai areas. (6954)

There are no needs to use prostrct builddb"

Actually there is. Try to add ai extents back again without rebuilding the Control Area:

del foo.a3

prostrct remove foo ai

prostrct add foo foo_ai.st

Database add extent: ERROR adding extent: -20010. (6976)
A logical error in shared memory has occurred while adding extents online.
Recovery is performed by restarting the database. (12547)
prostrct add FAILED. (12867)

Posted by George Potemkin on 23-Jan-2019 14:13

Ruanne, you're right.

But next 'prostrct add foo foo_ai.st' will be successful.

The lost extent stays in _AreaExtent but not in _FileList.

We can use a database (e.g. start it in multi-user mode) even though we're getting the error # 43 while opening db:

** Cannot find or open file D:\Proapps\Wrk_11.7\sports.a1, errno = 2. (43)

I'd say it's a bug.

Posted by goo on 24-Jan-2019 08:33

So to clearify:

I can do:

(if the example.db has 9 ai extents and I have deleted them all)

prostrct remove example ai

prostrct add example example_only_ai_that_are_removed.st

And I will be good to go?

Posted by George Potemkin on 24-Jan-2019 13:26

> And I will be good to go?

As Ruanne has pointed out you need to edit the .st file and to use prostrct builddb to create new .db file.

Alternate approach:

Disable AI logging, copy any existent AI file to replase the lost one(s) and then enable AI logging.

You can make the replacement of the lost AI files before disabling AI. The order of steps does not matter.

Posted by goo on 24-Jan-2019 13:44

What I did, that seemed to work:
Prostrct remove dbname ai
*I did this for each ai extent, could have done this by script (9 times)
Prostrct add dbname dbname_ai.st
*Dbname_ai.st has only the AI extents
Probkup dbname dbname.bck
Rfutil dbname -C aimage begin
 
Then I restarted the server, and it seems like everything is working as it should.
 
//Geir Otto
 
 
 
 

Posted by goo on 24-Jan-2019 13:48

Nups, did not work …..
 
[2019/01/24@14:43:14.371+0100] P-9004 T-8840 I ABL 10: (43) ** Cannot find or open file F:\AI\DEV\mydbname.a1, errno = 5.
[2019/01/24@14:43:14.371+0100] P-9004 T-8840 I ABL 10: (43) ** Cannot find or open file F:\AI\DEV\mydbname.a1, errno = 0.
 
 

Posted by goo on 24-Jan-2019 13:58

I tried to open it in dataadmin without -H and -S. But if I connected with -H and -S I came in without any error. It is a windows server x64. I can proably not do a direct connection when it is started as a server?

How do I check if the AI is working as it should ?

//Geir Otto

Posted by George Potemkin on 24-Jan-2019 14:16

Compare the list of _AreaExtent._Extent-path and _Filelist._FileList-Name.

Or simply count the records in both tables.

Posted by George Potemkin on 24-Jan-2019 14:19

> But if I connected with -H and -S I came in without any error.

Because broker/servers at startup has already complained about the missed AI extent.

This thread is closed