When you need to restore a backup and you do not have .st file you can get information about the database structure from a backup file using –list option of prorest
# prorest db-name backup-name -list
You can redirect output to a file and use that file in the following
program to create .st file for your database.
It
works with Progress version 9, 10 and 11.
/* create_st_file.p
The following program will create .st file of the database from output of
prorest foo bkup -list
*/
define variable progress-ver as integer init 9 no-undo.
define variable db-name as character no-undo.
define variable db-directory as character no-undo.
define variable block-size as integer init 8192 no-undo.
define variable prorest-list-file as character no-undo.
define variable str as character no-undo.
define variable sub-str as character no-undo.
define variable area-name as character no-undo.
define variable i as integer no-undo.
define variable i2 as integer no-undo.
define variable area-size as character no-undo.
define variable RPB as character no-undo.
define variable area-number as character no-undo.
define variable area-size-GB as decimal no-undo.
define variable cluster-size as character no-undo.
update
progress-ver format "z9" label "Progress version " skip
db-name format "x(20)" label "Database Name "
db-directory format "x(50)" label "Database Directory "
block-size format ">>>>" label "Database Blocksize "
prorest-list-file format "x(50)" label "prorest -list output"
with side-labels centered.
if progress-ver < 9 then do:
message "Sorry it does not work before version 9" view-as alert-box.
return.
end.
input from value(prorest-list-file).
output to value(db-directory + "/" + db-name + ".st").
put unformatted
'b ' + db-directory + '/' + db-name + '.b1' skip. /* You may want to add more than 1 bi extent here */
repeat:
import unformatted str.
if str matches "*Area Name*" then
area-name = trim(substring( str, index(str,":") + 1 )).
if str matches "*Records/Block*" then do:
put unformatted "#" skip.
do i = 1 to num-entries(str):
sub-str = entry(i,str).
if sub-str matches "*Size:*" then
area-size = trim(substring( sub-str, index(sub-str,":") + 1 )).
if sub-str matches "*Records/Block*" then
RPB = trim(substring( sub-str, index(sub-str,":") + 1 )).
if sub-str matches "*Area Number*" then
area-number = trim(substring( sub-str, index(sub-str,":") + 1 )).
if progress-ver > 9 and sub-str matches "*Cluster Size*" then
cluster-size = trim(substring( sub-str, index(sub-str,"Size") + 4 )).
end.
area-size-GB =
int(area-size) / 1073741824 /*1GB*/ * block-size / int(RPB).
do i2 = 1 to int(area-size-GB / 2) + 1:
put unformatted
'd "' + area-name + '":' + area-number + ',' + RPB +
( if progress-ver > 9 then ';' + cluster-size else '' ) +
' ' + db-directory + '/' + db-name +
( if int(area-number) > 6 then '_' + area-number
else '' ) + '.d' + string(i2) +
if i2 <= int(area-size-GB / 2) then ' f 2000384' else ''
skip.
end.
end.
end.
input close.
output close.