Since OpenEdge 10.2B07, 11.1.0 enhancement OE00196570 / PSC00224026 adds
Primary Recovery Information in
prorest -list output. In prior versions, only
Storage Area Information is included.
There are times when the restore structure needed is not immediately known as only the PROBKUP volume(s) are available. If a pre-existing database or structure file (dbname.st) is not present in the directory to which the database is being restored, then the PROREST operation will restore to
one variable extent for each Storage Area in the current directory. This is not always desirable even with an Enterprise license which extends the size of extents beyond 2GB. The necessary information can be obtained with PROREST functionality prior to running the physical restore with PROREST:
- prorest -vp output described below, provides the originating database block size, which can otherwise be inferred from prorest -list.
- prorest -list output described below, provides the size of all data Storage Areas which suits offline probkups. The before-image file (bi) size information is provided since OpenEdge 10.2B07, 11.1.0 which suits online or -norecover offline probkups.
- Neither the PROREST -list nor -vp arguments result in the database being physically restored. They are in effect merely reporting information from the PROBKUP volume header.
Finding the database Storage Areas and extent sizes needed for a PROREST: 1. Find the
database blocksize needed:
$ prorest dbname backupfile -vp
Example:
This is a full backup of <dir>\dbname.db. (6759)
This backup was taken [ddd mmm DD HH:MM:SS YYYY]. (6760)
The blocksize is 4096. (6994)
Partial verification successfully read backup volume. (6765)
Verify pass started. (3751)
Verified nnnn db blocks in 00:00:00
Backup for <dir>\dbname.db verified ok. (6758)
2a. Find the
size needed from the probkup volumes:
$ prorest dbname backupfile -list
2b. From the PROREST -list output calculate the space needed per Storage Area for the restore:
- BI_Restore_Size = "Size_from_prorest" * biblocksize
- Area_Restore_Size = "Size_from_prorest" / RPB * databaseblocksize
The Database Blocksize can also be inferred from the Schema Area information from the PROREST -list output:
- If the Records/Block are 32, it's a 4K or less database blocksize (2K 1K are less used)
- If the Records/Block are 64, it's a 8K database blocksize
Example: prorest -list output
- The database blocksize is 4K or less
Area Name: Schema Area
Size: 11776, Records/Block: 32, Area Number: 6, Cluster Size: 1
The Size of the BI file (10.2B07, 11.1.0)
- The (sum) of the extents in the .st file for the BI file, will therefore need at least 1.13 GB for the restore.
Area Name: Primary Recovery Area
Size: 73728, Records/Block: N/A, Area Number: 3
1,179,648 = 73728 * 16
BI_Restore_Size = 1.13 GB
Finding the bi filesize needed prior OpenEdge 10.2B07, 11.1.0If the PROBKUP was an
online backup or a PROBKUP with the
-norecovery flag, then the size of the bi file at the time of the backup will be included in this backup volume, but
prorest -list output will not provide the bifilesize needed directly.
The BI size can be estimated by taking the difference between the
sum of the Storage Areas reported by the
prorest -list output, and the
backup volume size (or sum of the backup volume sizes). The size of the Storage Areas can be determined from the 'prorest -list' output as described below.
The size of each Storage Area (all versions)
- The (sum) of the extents in the .st file for these data Storage Areas, will need at least 254.03 GB and 2.74 GB respectively, for the restore.
Area Name: <Area_Name1>
Size: 2130958090, Records/Block: 32, Area Number: 9, Cluster Size: 1
<Area_Name1> Restore_Size = 254.03 GB == 266,369,761 = 2130958090 / 32 * 4
Area Name: <Area_Name2>
Size: 22982432, Records/Block: 32, Area Number: 21, Cluster Size: 8
<Area_Name2> Restore_Size = 2.74 GB == 28,72807 = 22982432 / 32 * 4
The resulting dbname.st file with one fixed and one variable extent:
b <fullpath>\dbname.b1 f 1179648
b <fullpath>\dbname.b2
d "Schema Area":6,32;1 <fullpath>\dbname.d1
d "Area_Name1":9,32,1 <fullpath>\dbname_9.d1 f 266369761
d "Area_Name1":9,32,1 <fullpath>\dbname_9.d2
d "Area_Name2":21,32,8 <fullpath>\dbname_21.d1 f 2872807
d "Area_Name2":21,32,8 <fullpath>\dbname_21.d2
The PROSTRCT -list output can be parsed with 4GL/ABL to provide a psudo .st file ready for editing. An ABL code example is provided below:
DEF VAR wFile AS CHAR NO-UNDO INIT ".\bklist.txt".
DEF VAR wDbBlockSize AS INT NO-UNDO INIT 4.
DEF VAR wAreaName AS CHAR No-Undo FORMAT "x(30)".
DEF VAR wC AS CHAR No-Undo FORMAT "x(100)".
DEF TEMP-TABLE ttAreaInfo
FIELD AreaNbr AS INT FORMAT "zzzz9"
FIELD AreaName AS CHAR FORMAT "x(30)"
FIELD AreaBPC AS INT FORMAT "zz9"
FIELD AreaRPB AS INT FORMAT "zz9"
FIELD AreaSize AS DEC FORMAT "zzz,zzz,zzz,zz9"
FIELD AreaKB AS DEC FORMAT "zzz,zzz,zzz,zz9"
INDEX AreaNr IS PRIMARY UNIQUE AreaNbr
INDEX AreaSize AreaSize.
/* CURRENT-WINDOW:WIDTH = 130. */
/* Update wDbBlockSize wFile view-as editor size 80 by 1. */
/* Update wDbBlockSize wFile. */
Hide all NO-PAUSE.
INPUT FROM VALUE(wFile) NO-ECHO.
SET ^.
REPEAT:
IMPORT UNFORMATTED wC.
IF wC = "" THEN
NullStill: DO:
wAreaName = "".
NEXT.
END.
IF wC BEGINS "Area" THEN
ASSIGN wAreaName = Trim(ENTRY(2, wC, ":")).
ELSE IF wC BEGINS " Size" THEN
DO:
CREATE ttAreaInfo.
ASSIGN
ttAreaInfo.AreaName = wAreaName
ttAreaInfo.AreaNbr = Int(Trim(Entry(2, ENTRY(3,wC,","), ":")))
ttAreaInfo.AreaBPC = Int(Trim(Entry(2, ENTRY(4,wC,","), ":")))
ttAreaInfo.AreaRPB = Int(Trim(Entry(2, ENTRY(2,wC,","), ":")))
ttAreaInfo.AreaSize = Int(Trim(Entry(2, ENTRY(1,wC,","), ":"))).
ttAreaInfo.AreaKB = ttAreaInfo.AreaSize / ttAreaInfo.AreaRPB * wDbBlockSize.
END.
END.
INPUT Close.
OUTPUT TO ".\bkupst.txt".
PUT UNFORM "# prorest -list Area Info in " + wFile SKIP.
PUT UNFORM "b . " SKIP.
FOR EACH ttAreaInfo:
PUT UNFORM 'd "' +
ttAreaInfo.AreaName +
'":' +
STRING(ttAreaInfo.AreaNbr) +
',' +
STRING(ttAreaInfo.AreaRPB) +
';' + STRING(ttAreaInfo.AreaBPC) +
' . f ' + STRING(ttAreaInfo.AreaKB)
SKIP.
END.