Database Reference
In-Depth Information
RMAN_PIPE_IF Package Specification
The source code of the package specification of RMAN_PIPE_IF is shown in the next code section.
I have added numerous comments to the code to explain the purpose of the package's functions
and their arguments. Since the schema SYS is reserved for the data dictionary, the package is
created in the schema SITE_SYS with AUTHID CURRENT_USER , such that clients with SYSDBA privi-
leges may execute the package while retaining the SYSDBA privilege. Otherwise the package
would be executed with the privileges of its owner SITE_SYS and it would fail to access private
pipes used by RMAN.
create or replace package site_sys.rman_pipe_if authid current_user as
-- send: return codes identical to DBMS_PIPE.SEND_MESSAGE: 0 on sucess
function send(pipe_arg varchar2, -- same as argument to RMAN command line option
PIPE
msg varchar2) return number; -- message to send to RMAN via DBMS_PIPE, may c
ontain several lines
-- receive: returns 0 when pipe empty, otherwise items (one or more lines) recei
ved
function receive(pipe_arg varchar2,
msg out varchar2, -- message received from RMAN via DBMS_PIPE
-- wait_for_input: 0: RMAN not ready for next command
-- 1: RMAN ready for next command after RMAN sent RMAN-00572: waiting for
-- dbms_pipe input
wait_for_input out number,
rman_error out number, -- RMAN-nnnnn error from RMAN errorstack, 0 if no err
or
rman_msg out varchar2, -- RMAN-nnnnn error message, NULL if no RMAN error
ora_error out number, -- ORA-nnnnn error from RMAN errorstack, 0 if no erro
r
ora_msg out varchar2 -- ORA-nnnnn error message, NULL if no ORA error
) return number;
end;
/
Since the package is owned by SITE_SYS, EXECUTE permission on DBMS_PIPE must be granted to
user SITE_SYS. The file rman_pipe_if.sql in the source code depot contains the package body,
which is too large to reproduce here.
Using the Package RMAN_PIPE_IF
In this section, I show the intended use of the package RMAN_PIPE_IF with SQL*Plus. A backup
and recovery tool, which leverages the pipe interface, would make exactly the same calls that I
show in SQL*Plus from a programming language such as PL/SQL, C (with Pro*C), or Perl (with
DBI and DBD::Oracle). The next sections address both examples of failure that I mentioned at
the beginning of this chapter:
￿
Failure to connect to the catalog, causing RMAN to abort the script executed
Data file corruption, causing RMAN to abort the BACKUP command and the script executed
￿
 
Search WWH ::




Custom Search