The Blog from the DBA Classroom

By: Joel Goodman

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:

SQL> Host rman pipe demo_pipe timeout 600 target / \&

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:

  1. Starts the RMAN Session in the background by hosting out
  2. Checks that a session is waiting on a “pipe get” event
  3. Uses DBMS_PIPE.PURGE to clean the two pipes
  4. Uses the code from the documentation to create a stored procedure called RMAN_CMD
  5. Checks for compilation errors
  6. Uses the V$DB_PIPES view to show the two pipes’ attributes
  7. Invokes the RMAN_CMD procedure several times with various RMAN commands
  8. 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:

  1. Applications coded to automatically invoke one or more backup and recovery functions to achieve their design objectives
  2. Third party tools which whish to provide their own interface to RMAN
  3. DBA tools that wish to incorporate some RMAN functionality

The demo and spooled output are:

  1. rman_pipes_sql – this contains the script
  2. rman_pipes_spool – this is the spooled output of the script running on Linux.

About these ads

5 Responses to “RMAN is Piping Hot”

  1. Smartree said

    A good train of thought, Thanks

  2. Smartree said

    A GOOD WAY… THKS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 118 other followers

%d bloggers like this: