There are several ways to organize output of rman script.
I prefer 'set echo on' way, because it affords to see the output of each command consequently, although the output of block { } goes only after the entire block, and output line from the previous command can potentially interleave with the output of next command.
Let suppose we've got the following script to test :
set echo on
connect target 'c##ddi/password@orcl2 as sysbackup'
select user from dual ;
exit
You might notice 'set echo on' here, it does the main job to obtain easy to read output. According the documentation it can be useful when the opportunity exists to manipulate standard input and standard output (inside of Unix like operating systems, for example).
You can use several ways of getting the stuff to work (it is not a full list of possibilities) :
$ cat conn2.rman | rman > conn2.rman.out
$ rman @ $(pwd)/conn2.rman > conn2.rman.out
$ rman < conn2.rman > conn2.rman.out
$ rman @ $(pwd)/conn2.rman | tee conn2.rman.out
The output with 'set echo on' but without 'tee' looks like this:
Recovery Manager: Release 12.1.0.2.0 - Production on Wed Sep 1 17:25:54 2021
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
RMAN> ;
echo set on
connect target *
connected to target database: ORCL2 (DBID=1043166856)
RMAN>
RMAN> select user from dual ;
using target database control file instead of recovery catalog
USER
------------------------------
SYSBACKUP
RMAN>
RMAN> exit
Without 'set echo on' the output looks like 'list of all the commands --> output of all the commands' (with help of 'tee'):
Recovery Manager: Release 12.1.0.2.0 - Production on Wed Sep 1 23:08:47 2021
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
RMAN> set echo on
2>
3> connect target *
4>
5> select user from dual ;
6>
7> exit
echo set on
connected to target database: ORCL2 (DBID=1043166856)
using target database control file instead of recovery catalog
USER
------------------------------
SYSBACKUP
Recovery Manager complete.
Another output without 'set echo on' and without 'tee' looks like this:
Recovery Manager: Release 12.1.0.2.0 - Production on Wed Sep 1 17:26:50 2021
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
RMAN>
connected to target database: ORCL2 (DBID=1043166856)
RMAN>
RMAN>
using target database control file instead of recovery catalog
USER
------------------------------
SYSBACKUP
RMAN>
RMAN>
Recovery Manager complete.
P.S. Sometimes we can see the output from connect command trapped into output of select statement.
No comments:
Post a Comment