Re: ** UNIX : set echo on in shell

  • From: Jared Still <jkstill@xxxxxxxxx>
  • To: william@xxxxxxxxxxxxxxxxxxxx
  • Date: Wed, 4 Mar 2009 15:18:21 -0800

On Wed, Mar 4, 2009 at 2:36 PM, William Robertson <
william@xxxxxxxxxxxxxxxxxxxx> wrote:

> How about:
>
> exec > mylogfile.log 2>&1
>

Keep in mind that while this type of logging is great for debugging,
it can be a problem for general logging purposes.

Everything gets written to the logfile, which may not be what you want.

"Everything" could include passwords.

Here's one example:

$RMAN_CMD  <<-EOF | $GREP -ivE 'connect target|connect catalog' | tee
$LOGFILE
set echo on;
connect target $DB_USER/$DB_PASSWORD@$DATABASE;
connect catalog $RCAT_USER/$RMAN_PASSWORD@$RMAN_CATALOG;
show all;
RUN
{
        set until time "to_date('$TARGET_DATE','mm/dd/yyyy hh24:mi')";
        restore database validate;
        restore validate archivelog from time
"to_date('$ARCH_BEGIN_DATE','mm/dd/yyyy hh24:mi')"
                until time "to_date('$TARGET_DATE','mm/dd/yyyy hh24:mi')";
}
EOF

The grep is used to strip out the CONNECT commands in the log output.

In 10g this will appear as "connect *" in the output.

In anything older than 10g, it appears as "connect username/password@db"
which is probably not something you want in a logfile.


Jared

Other related posts: