0

I want to run an oracle online backup through the rman setup in 12c. I have 3 scripts that need to be run and they are:

  • rman target sys@[db_name]/[db_password] nocatalog
  • configure channel device type disk clear;
  • RUN {   ALLOCATE CHANNEL c1 DEVICE TYPE DISK FORMAT 'C:\Users\Administrator\Documents\Backup\%U';   BACKUP DATABASE PLUS ARCHIVELOG; }

I want to be able to run them as a single entry through a c# Process object. I want to emulate using a command line and not a batch file.

So, I've looked at a few questions/answers and have used && to try and combine the commands but that didn't quite work. It took the first two commands and connected me to the RMAN center but the RUN command didn't execute (most likely because of the ; within that part of the script).

EDIT* - actually only the first command was run. The second did not execute.

My question: Is there a way that I can combine these 3 script items into 1 to run through the c# Process.Start() method?

B-M
  • 1,231
  • 1
  • 19
  • 41
  • Have you tried to put the commands in a command file or use stored scripts? – Jon Tofte-Hansen Oct 09 '15 at 08:49
  • I had not at the time. I never could get it to run all as one line in a C# `Process`. Ended up storing the 2nd and 3rd in a `.rman` file and the first in a `.bat` file which called the `.rman` file and that worked so I went with that. – B-M Oct 12 '15 at 19:08

1 Answers1

0

Created two different files.

the first file was a batch file that contained:

  • rman target sys@[db_name]/[db_password] runRman.rman

The second was a RMAN file called runRman.rman which contained:

  • configure channel device type disk clear;
  • RUN { ALLOCATE CHANNEL c1 DEVICE TYPE DISK FORMAT 'C:\Users\Administrator\Documents\Backup\%U'; BACKUP DATABASE PLUS ARCHIVELOG; }

the c# process called the batch file, which in turn called the rman file and everything worked for me after that.

B-M
  • 1,231
  • 1
  • 19
  • 41