dbTalk Databases Forums  

RMAN on Windows: Dynamic Spool File

comp.databases.oracle.server comp.databases.oracle.server


Discuss RMAN on Windows: Dynamic Spool File in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
if_investor@yahoo.com
 
Posts: n/a

Default RMAN on Windows: Dynamic Spool File - 09-13-2010 , 03:50 PM






Hi,

We are running Oracle 10g on Windows 2003. We intend to run an RMAN
batch script as follows: "rman target=/ @backup_script.sql".

Backup_script.sql contains a "spool log" command; I want to
change that command to spool to a dynamic filename, with
a date and time script. How can this be done?

Backup_script.sql is as follows:

spool log to 'E:\RMAN\RMANbackup.log';
Run {
CONFIGURE CHANNEL ...
BACKUP DATABASE;
......
}
exit;
spool off;

Reply With Quote
  #2  
Old   
gazzag
 
Posts: n/a

Default Re: RMAN on Windows: Dynamic Spool File - 09-14-2010 , 10:58 AM






On 13 Sep, 21:50, "if_inves... (AT) yahoo (DOT) com"
<basis_consult... (AT) hotmail (DOT) com> wrote:
Quote:
Hi,

We are running Oracle 10g on Windows 2003. We intend to run an RMAN
batch script as follows: "rman target=/ @backup_script.sql".

Backup_script.sql contains a "spool log" command; I want to
change that command to spool to a dynamic filename, with
a date and time script. How can this be done?

Backup_script.sql is as follows:

spool log to 'E:\RMAN\RMANbackup.log';
Run {
* CONFIGURE CHANNEL ...
* BACKUP DATABASE;
* ......
*}
exit;
spool off;
To my knowledge, what you want to achieve is not possible from within
the script, but Windows does provide some shell functionality that you
could use.

For example:

C:\>echo %DATE%
14/09/2010

Obviously forward slashes in a log file name are about as much use as
ashtrays on a motorbike, but Windows provides the following
functionality to reformat the output:

echo %DATE:~<start_position> , <number_of_characters>% (Note:
<start_position> starts counting from zero)

E.g.

To display just the year portion of the output:

C:\>echo %DATE:~6,4%
2010

To display the month:

C:\>echo %DATE:~3,2%
07

And the day of the month:

C:\>echo %DATE:~0,2%
01

So, to generate a log file with the format <script_name>_ddmmyy.log,
set an environment variable as follows:

C:\>set LOG_FILE=script_%date:~0,2%%date:~3,2%%date:~8,2%. log

C:\>echo %LOG_FILE%
script_140910.log

Then start RMAN as follows:

C:\> rman target / cmdfile=<script_name> msglog=%LOG_FILE%

HTH
-g

Reply With Quote
  #3  
Old   
John Hurley
 
Posts: n/a

Default Re: RMAN on Windows: Dynamic Spool File - 09-14-2010 , 06:20 PM



On Sep 13, 4:50*pm, "if_inves... (AT) yahoo (DOT) com"
<basis_consult... (AT) hotmail (DOT) com> wrote:
Quote:
Hi,

We are running Oracle 10g on Windows 2003. We intend to run an RMAN
batch script as follows: "rman target=/ @backup_script.sql".

Backup_script.sql contains a "spool log" command; I want to
change that command to spool to a dynamic filename, with
a date and time script. How can this be done?

Backup_script.sql is as follows:

spool log to 'E:\RMAN\RMANbackup.log';
Run {
* CONFIGURE CHANNEL ...
* BACKUP DATABASE;
* ......
*}
exit;
spool off;
There are a ton of scripting alternatives available in a windows
environment.

Why don't you figure out which of the options you want to use and do
some learning about writing scripts in that specific environment?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.