Database Reference
In-Depth Information
The risk incurred due to a missing backup as a consequence of a catalog outage could
easily be avoided. The problem is that a utility, which tells RMAN to run a whole sequence of
commands in a script, has no way of knowing why RMAN failed and at what point it failed. The
same applies to block corruptions, which also cause RMAN to abort without completing the
backup. Backups may be completed in spite of block corruptions by telling RMAN how many
block corruptions in a data file to tolerate. The command
SET
MAXCORRUPT
FOR
DATAFILE
is provided
for this purpose. A program controlling RMAN via the pipe interface could easily examine the error
stack RMAN returns when a backup fails due to a block corruption. If it finds the error message
“ORA-19566: exceeded limit of 0 corrupt blocks for file
filename
”, it could detect which data file is
affected by the corruption and reattempt the backup with a suitable
MAXCORRUPT
setting.
When passing scripts to RMAN, it is also good practice to use two different scripts—one for
backing up the database and another one for backing up archived redo logs—to make sure an
error while backing up the database does not cause RMAN to abort and thus omit the execu-
tion of the
BACKUP
ARCHIVELOG
command. Since everything including starting an instance of
RMAN can be done through PL/SQL (using
DBMS_SCHEDULER
and external jobs; see Chapter 19),
a third-party tool built with the pipe interface would be highly portable.
Introduction to DBMS_PIPE
DBMS_PIPE
is a package that enables asynchronous message passing between database clients.
In contrast to advanced queuing, persistence of messages is not implemented. Messages are
lost on instance shutdown. The package
DBMS_PIPE
may be used to give a database client access
to functionality of an application that is primarily unrelated to an ORACLE database, but can
handle requests through pipe messages. Since the introduction of the external procedure agent,
an alternative paradigm for accessing services external to the DBMS instance is available.
Pipe messages consist of one or more items, where each item is one of the fundamental
ORACLE DBMS data types such as
CHAR
,
DATE
,
NUMBER
,
RAW
, or
VARCHAR2
. Messages are unaffected
by transactions and are composed by adding items using
DBMS_PIPE.PACK_MESSAGE
and sent
using
DBMS_PIPE.SEND_MESSAGE
. To receive a message, the function
DBMS_PIPE.RECEIVE_MESSAGE
is called. Items in a message may be retrieved with the procedure
DBMS_PIPE.UNPACK_MESSAGE
.
There are two classes of pipes. Private pipes and public pipes. While public pipes may be
used by any database client, private pipes are reserved for use by sessions with
SYSDBA
privilege.
RMAN uses private pipes to ensure that only privileged database clients can send commands
to it.
Use the option
PIPE
to instruct RMAN to read commands from a private pipe.
$ rman target / pipe '"PIPE"' log rman.log
When started in this way, RMAN creates two private pipes—one for receiving messages
and another one for sending replies. The suffix “_IN” is used for the input pipe and the suffix
“_OUT” for the output pipe. The prefix “ORA$RMAN_” applies to both pipes. Thus, for the
preceding example, the following private pipe names are reported when querying the view
V$DB_PIPES
: