Ask the Expert

Obtaining datetime from RMAN

I am currently using RMAN8i to backup several databases in our environment. I want to have filenames to include server name, database name and current datetime. It appears that Oracle RMAN does not have filename parameters for datetime but does allow the use of environmental variables. Can I dynamically use an environmental variable inside an RMAN script to obtain the current datetime?

    Requires Free Membership to View

The Recovery Manager Reference Guide (available via the TechNet site at or at can provide you with some information on this subject. The specific link to this guide is here, but you will not be able to access it without an account id (which is free to set up).

Here's some basic information:
The only system-independent, legal environment variables in RMAN quoted strings are ? for the Oracle home and @ for the SID. However, you can use operating system specific environment variables on the target system within quoted strings. The environment variables are interpreted by the database server and not the RMAN client.

Check out the PARMS clause with the ENV option to see if you can't get what you need there. The following brief example comes from MetaLink:

rman << ! 
allocate channel t1 type 'SBT_TAPE' 

This was first published in October 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: