Consultor Eletrônico



Kbase P125711: How to convert an absolute path database into a relative path database?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   30/01/2009
Status: Verified

GOAL:

How to convert an absolute path database into a relative path database?

GOAL:

How to create a relative path database from an absolute path database?


FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x

FIX:

Once the absolute path is written into the database Control Area (.db file), the database will then remain an absolute path database. Please refer to the Database Administration Guide and Reference Documentation for clarifications on 'relative' and 'absolute' database. Progress Solution P4759,"Relative Path Database FAQ" also provides some history on the topic.

It is possible to create a new relative path database from an absolute path one, by taking a copy of the current datbase with Progress utilites - as described through example from Step 4 onwards below.

Example:
using OE 10.1C on Windows 2003, with /usr/testdb as the database directory.

1. $ procopy $DLC/empty testdb
2. $ prostrct add testdb add.st

# add.st
d "Not Schema Area":8,32;1 .

3. $ prostrct list testdb

# testdb.st
b /usr/testdb/testdb.b1
d "Schema Area":6,32;1 /usr/testdb/testdb.d1
d "Not Schema Area":8,32;1 /usr/testdb/testdb_8.d1
So for test purposes we now have an absolute path database. It is isn't possible to change this particular database back to relative path, but it is possible to create a copy of it that will have relative paths. This is particularly useful if this database is later copied with OS utilites so that it maintains it's relative path status.
4. Create a new directory under the one above, i.e. /usr/testdb/bakloc, and cd into it.
5. Copy the originating database structure file - testdb.st into this location and modify the absolute to relative paths:

# testdb.st
b .
d "Schema Area":6,32;1 .
d "Not Schema Area":8,32;1 .

NOTE: If there are multiple .st files to be considered, the editing could be automated with UNIX (sed) or WINDOWS () utilities.

:: ---------FINDREPLST.BAT-----------
@ECHO OFF
:: --------------
:: change path as appropriate
:: --------------
set DIR=D:\101B\WRK

FOR /R %DIR% %%F in (*.st) DO (
SET FILEPATH=%%~dpF
SET FILE=%%F
SET FNAME=%%~nxF
CALL :READTXT
)
GOTO :EOF

:READTXT
pushd %FILEPATH%
FOR /F "tokens=1 delims=" %%F in (%FILE%) DO (
SET TEXT=%%F
CALL :FRTXT
)
DEL %FILE%
REN newFile.txt %FNAME%
popd
GOTO :EOF
:FRTXT
:: --------------
:: Change "Find" and "Replace"
:: --------------
ECHO %TEXT:Find=Replace% >>newFile.txt
:: ---------FINDREPLST.BAT-----------

METHOD #1

6. Copy the absolute path database to the new location. The relative-path .st file in the new location will be used to create the database:
$ prodb testdb ../testdb .
7. prostrct list confirms that the copyied database has a relative path database, and this database can then be copied to where it is required without further changes being required to its st file.

METHOD #2

6. Create first a empty database. This is preferable if this is a large database
$ prodb testdb empty

7. copy the absolute path database to the relative path database
$ echo y | procopy ../testdb testdb

8. Another means of verifying the absolute or relative paths in the control area is the the _areaextent VST:

FOR EACH _areaextent:
DISPLAY _extent-path format "x(32)".
END.

METHOD #3:
Since OpenEdge 10.1A the -relative parameter can be specified with procopy to achieve the same result. The procopy must be run from the target directory and the target directory must contain the relative-path .st file:

$ procopy ../testdb testdb -relative