RE: Ergh..banging head against a wall here (sqlplus...recover..until time...sysdate)

  • From: Warren Puziewicz <warren.puziewicz@xxxxxxxxxxxxxxxxxx>
  • To: "ChrisDavid.Taylor@xxxxxxxxxxxxxxx" <ChrisDavid.Taylor@xxxxxxxxxxxxxxx>, "'oracle-l@xxxxxxxxxxxxx'" <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 3 Aug 2010 15:05:43 +0100

Could you pass the current time to the script via the command line?

sqlplus user/pass@db script.sql '2010-02-08:08:54:00'


Then your statement becomes:

 recover database using backup controlfile until time '&1';

From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Taylor, Chris David
Sent: 03 August 2010 14:59
To: 'oracle-l@xxxxxxxxxxxxx'
Subject: Ergh..banging head against a wall here (sqlplus...recover..until 
time...sysdate)

Ok, I'm trying to setup an automated job to recover a database within sqlplus.  
Everything works fine until I try to add an "UNTIL TIME" with SYSDATE.  Is 
there no way to configure UNTIL TIME with SYSDATE?


This works:
SQL> recover database using backup controlfile until time '2010-02-08:08:54:00';


Here's what I'm trying (and need) to do:

/* sysdate -5 minutes */
SQL> recover database using backup controlfile until time 
to_char(sysdate,'YYYY-DD-MM:HH24:MI:SS')-5/1440;
ORA-00285: TIME not given as a string constant

I've tried:
SQL> recover database using backup controlfile until time 
'to_char(sysdate,'YYYY-DD-MM:HH24:MI:SS')-5/1440';
ORA-01841: (full) year must be between -4713 and +9999, and not be 0

SQL> recover database using backup controlfile until time 
''to_char(sysdate,'YYYY-DD-MM:HH24:MI:SS')-5/1440'';
ORA-01840: input value not long enough for date format

SQL> recover database using backup controlfile until time 
'''to_char(sysdate,'YYYY-DD-MM:HH24:MI:SS')-5/1440''';
ORA-01841: (full) year must be between -4713 and +9999, and not be 0

So, how can I get SYSDATE -5/1440 into this "UNTIL TIME" ?


Chris Taylor
Sr. Oracle DBA
Ingram Barge Company
Nashville, TN 37205
Office: 615-517-3355
Cell: 615-663-1673
Email: chris.taylor@xxxxxxxxxxxxxxx<mailto:chris.taylor@xxxxxxxxxxxxxxx>

CONFIDENTIALITY NOTICE: This e-mail and any attachments are confidential and 
may also be privileged. If you are not the named recipient, please notify the 
sender immediately and delete the contents of this message without disclosing 
the contents to anyone, using them for any purpose, or storing or copying the 
information on any medium.


____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System

____________________________________________________________________
DISCLAIMER

This message and any attachments contain privileged and confidential 
information intended for the use of the addressee named above. If you are not 
the intended recipient of this message, you are hereby notified that any use, 
dissemination, distribution or reproduction of this message is prohibited. 
Please note that we cannot guarantee that this message or any attachment is 
virus free or that it has not been intercepted and amended. The views of the 
author may not necessarily reflect those of Realtime Worlds Ltd.

 

Realtime Worlds Ltd is registered in Scotland, number 225628. Registered 
Office: 152 West Marketgait, Dundee, DD1 1NJ.

Other related posts: