Databases Reference
In-Depth Information
SQL> SELECT :rv rv, :msg msg FROM dual;
RV MSG
--- ----------------------------------------------------------------------------
1 piece handle=DB-TEN-JHIN5G18.BKP tag=TAG20070718T172808 comment=NONE
After the successful backup, an entry describing the corruption is created in
V$DATABASE_BLOCK_CORRUPTION
.
SQL> SELECT * FROM v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTION_TYPE
---------- ---------- ---------- ------------------ ---------------
7 20 1 0 FRACTURED
Note that rows are not added to
V$DATABASE_BLOCK_CORRUPTION
after a
failed
backup due to
one or more corruptions. To repair the corruption, perform block media recovery by running
the RMAN command
BLOCKRECOVER
(e.g.,
BLOCKRECOVER
DATAFILE
7
BLOCK
20
).
To terminate RMAN, send a message containing the command
EXIT
as shown here:
SQL> BEGIN
:cmd:='exit;';
:rv:=site_sys.rman_pipe_if.send(:pipe_arg, :cmd);
END;
/
RMAN responds with another message and exits.
SQL> EXEC :rv:=site_sys.rman_pipe_if.receive(:pipe_arg, :msg, :wait_for_input, -
> :rman_error, :rman_msg, :ora_error, :ora_msg)
RV MSG
--- --------------------------
1 Recovery Manager complete.
Since RMAN has terminated, any subsequent attempts to read from the pipe fail with
“ORA-06556: the pipe is empty, cannot fulfill the unpack_message request”. For the conve-
nience of users of the
RMAN_PIPE_IF
package, this exception is caught and the package returns
a line count of 0 and an empty message. Note that this behavior is not necessarily an indication
that RMAN has terminated. While RMAN, or rather the DBMS instance, is working hard to
complete the commands initiated, there may not be any messages over long stretches of time.
The package
RMAN_PIPE_IF
waits one second for a message to arrive and returns a line count of
0 if no message arrived during the time-out period.
SQL> EXEC :rv:=site_sys.rman_pipe_if.receive(:pipe_arg, :msg, :wait_for_input, -
> :rman_error, :rman_msg, :ora_error, :ora_msg)
PL/SQL procedure successfully completed.
SQL> SELECT :rv rv, :msg msg FROM dual;
RV MSG
--- ----------------------------------------------------------------------
0 <NULL>