How do I issue a O/S Command from inside RMAn script.
I know we can use the Host command but the command takes you to the command prompt.
How do I do it without breaking the continuity of the program.
host copy c:\a.txt d:\ (this does not work. i am looking for something similar)
Why not just do a rman copy?
copy datafile mydatafile to '/path/to/mydatafile.dbf.bk'
If you us an O/S command you will have to put the tablespace into hotbackup mode. If you copy through rman then the rman server process will do the copy and you will not have to put the tablespace into hotbackup mode.
You can use the OS command in quotes. e.g.
RMAN>host "ls -l";
But as Andrew said it is better to use RMAN copy instead of OS copy.
If you use OS copy you will have to put TS in backup mode and also you will have to catalog the datafile copy in recovery catalog.
Thanks a lot guys. It was teh quote.
I wanted to know this to copy init.ora files.
Another alternative is to wrap the RMAN code within a Perl script - then use the Perl system() command to perform any other tasks you might desire. I find that having a full-feature programming language available to me is a great help with many of the sys admin and DBA tasks I need to perform.
Here is a full-featured RMAN backup script I like to use for situations where I am not using a recovery catalog:
In this script I use File::Copy::copy() to copy the init.ora and orapwd files to back them up before doing the RMAN backup.