Operating System - HP-UX
1752591 Members
2779 Online
108788 Solutions
New Discussion юеВ

Re: using a variable in the RMAN backup format parameter

 
Peter Heinemann
Frequent Advisor

using a variable in the RMAN backup format parameter

In the interest of maintainability, I'm trying to use an environment variable that contains the file system path in the format parameter. I've found that RMAN is able to interpret the $ORACLE_HOME and $ORACLE_BASE variables, but others give the error:

RMAN-03006: non-retryable error occurred during execution of command: backup
RMAN-07004: unhandled exception during command execution on channel t1
RMAN-10035: exception raised in RPC: ORA-07217: sltln: environment variable cannot be evaluated.
RMAN-10031: ORA-19583 occurred during call to DBMS_BACKUP_RESTORE.BACKUPPIECECREATE

Is there any more specific documentation about what variables are supported within RMAN? (I've found nothing in the manuals beyond the excerpt I included below.) Does anyone know if the "port-specific directory" mentioned in the excerpt below can be modified/customized?
I've posted this on OTN as well.

Thanks....
Peter

format 'format_string'
specifies the filename to use for the backup piece. Any name that is legal as a sequential filename on the platform is allowed, provided that each backup piece has a unique name. If backing up to disk, then any legal disk filename is allowed, provided it is unique. If you do not specify the format parameter, RMAN stores the backup pieces in a port-specific directory ($ORACLE_HOME/dbs on UNIX).
7 REPLIES 7
harry d brown jr
Honored Contributor

Re: using a variable in the RMAN backup format parameter

Peter,

Can you post the environment variable and the assignment you used?

live free or die
harry
Live Free or Die
Peter Heinemann
Frequent Advisor

Re: using a variable in the RMAN backup format parameter

Harry,

ORACLE_BACKUP=/db/oracle01/netbackup/


Here's the .rcv for RMAN. Using $ORACLE_BACKUP vs. ${ORACLE_BACKUP} made no difference.

Thanks...Peter

connect target ...
connect rcvcat ...
run {
# Hot database level 0 whole backup
allocate channel t1 type disk;
backup
incremental level 0
skip inaccessible
tag hot_db_bk_level0
filesperset 5
# recommended format
format '$ORACLE_BACKUP/bk_%s_%p_%t'
(database);
sql 'alter system archive log current';
# backup all archive logs
backup
filesperset 20
format '$ORACLE_BACKUP/al_%s_%p_%t'
(archivelog all
delete input);
}
harry d brown jr
Honored Contributor

Re: using a variable in the RMAN backup format parameter

Peter,

Try replacing the Apostrophes (') with QUOTES ("):

See the difference:
[root]pbctst: echo format '$ORACLE_BACKUP/bk_%s_%p_%t'
format $ORACLE_BACKUP/bk_%s_%p_%t
[root]pbctst: export ORACLE_BACKUP=CRAZY
[root]pbctst: echo format '$ORACLE_BACKUP/bk_%s_%p_%t'
format $ORACLE_BACKUP/bk_%s_%p_%t
[root]pbctst: echo format $ORACLE_BACKUP/bk_%s_%p_%t
format CRAZY/bk_%s_%p_%t
[root]pbctst: echo format "$ORACLE_BACKUP/bk_%s_%p_%t"
format CRAZY/bk_%s_%p_%t
[root]pbctst:



live free or die
harry
Live Free or Die
Peter Heinemann
Frequent Advisor

Re: using a variable in the RMAN backup format parameter

That kind of symbol substitution works find within the shell, but in RMAN itself it stops. Only the ORACLE_HOME and ORACLE_BASE seem to be interpretable.

Any other thoughts?

Thanks...
...Peter
harry d brown jr
Honored Contributor

Re: using a variable in the RMAN backup format parameter

Try:

format "${ORACLE_BACKUP}/bk_%s_%p_%t"

OR

format ${ORACLE_BACKUP}"/bk_%s_%p_%t"



live free or die
harry
Live Free or Die
Peter Heinemann
Frequent Advisor

Re: using a variable in the RMAN backup format parameter

Harry,

It's working now; problem ended up being with variable definitions within various parts of the "su -c" command.

Thanks for your help.
harry d brown jr
Honored Contributor

Re: using a variable in the RMAN backup format parameter

Congratulations! Too bad you can't assign yourself points :-))


live free or die
harry
Live Free or Die