Suppose you want to give the data backup option in Oracle Forms application to some client users, where you have installed Oracle 11g client or direct from server.
The following procedure executes a batch file placed in current working directory of the application and the batch file contains the following line:
exp.exe userid=%1 FULL=N FILE=%2
Means you have to pass two parameters to this batch file one is username/[email protected] and another is the filename with location. The following procedure runs this batch file and passes the required parameters.
Example:
PROCEDURE DO_BACKUP IS
USERID VARCHAR2(50) := GET_APPLICATION_PROPERTY(USERNAME);
PSW VARCHAR2(50) := GET_APPLICATION_PROPERTY(PASSWORD);
CSTRING VARCHAR2(50) := GET_APPLICATION_PROPERTY(CONNECT_STRING);
fPathName varchar2(200);
BDIR VARCHAR2(1000);
DMPFILENAME VARCHAR2(100);
BEGIN
MESSAGE( ‘Doing Backup...‘);
SYNCHRONIZE;
if bdir is null then
select BKPDIR into bdir
from URparam
where Pcode = ‘BACKUP‘;
end if;
if Substr(bdir,length(bdir),1) != ‘\‘ then
bdir := rtrim(bdir) || ‘\‘;
end if;
bdir := ltrim(rtrim(bdir));
dmpfilename := to_char(sysdate, ‘ddMONyy‘)||‘_‘||dbms_random.string(‘x‘, 5);
host(‘backup.bat ‘||USERID||‘/‘||PSW||‘@‘||cstRING||‘ ‘||bdir||dmpfilename);
exception
when others then
message(‘Please check parameters for the backup option.‘);
END;
Note: The connect string is used by oracle forms client should be the same as oracle 11g client or oracle servers connect string.