RMAN is Piping Hot
Posted by Joel Goodman on 24/11/2009
The RMAN “PIPE” Interface
Tips and Tricks for the Oracle DBA #1
RMAN is traditionally managed using the command line interface RMAN executable or by using Enterprise Manager. But there is a “third way” known as the “pipes” interface to RMAN, which uses the “DBMS_PIPE” Oracle, supplied package to provide PL/SQL programmes with an interface to RMAN.
The Oracle Documentation contains an example bit of code, which I have wrapped inside a demo to demonstrate the pipes interface. Essentially the RMAN command line executable must be started with the PIPE option and must specify the pipe name. Optionally a timeout value may be specified to terminate the RMAN executable if no command is sent down the named pipe within the timeout period. In my SQL*PLUS demo script RMAN is invoked automatically by shelling out to the host and running RMAN disconnected from the main script so that control returns to the SQL*PLUS script. One could of course drive this all from a shell script as well by running RMAN in the background and then running SQL*PLUS.
Here is an example of invoking RMAN to accept input from a pipe:
|
Two pipes will be created called ORA$RMAN_DEMO_PIPE_IN and ORA$RMAN_DEMO_PIPE_OUT and used for inbound commands to RMAN and output from the commands.
The demo is commented and does the following:
- Starts the RMAN Session in the background by hosting out
- Checks that a session is waiting on a “pipe get” event
- Uses DBMS_PIPE.PURGE to clean the two pipes
- Uses the code from the documentation to create a stored procedure called RMAN_CMD
- Checks for compilation errors
- Uses the V$DB_PIPES view to show the two pipes’ attributes
- Invokes the RMAN_CMD procedure several times with various RMAN commands
- Invokes the RMAN_CMD procedure, passing EXIT as the message to terminate the RMAN executable that is running in the background.
Possible used for the pipes interface are:
- Applications coded to automatically invoke one or more backup and recovery functions to achieve their design objectives
- Third party tools which whish to provide their own interface to RMAN
- DBA tools that wish to incorporate some RMAN functionality
The demo and spooled output are:
- rman_pipes_sql – this contains the script
- rman_pipes_spool – this is the spooled output of the script running on Linux.
Smartree said
A good train of thought, Thanks
Smartree said
A GOOD WAY… THKS