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

  • From: lyallbarbour@xxxxxxxxxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 03 Aug 2010 10:04:42 -0400

Can you store sysdate as a varchar string earlier in the program?  a little 
PL/SQL block in your SQL*Plus session?




-----Original Message-----
From: Taylor, Chris David <ChrisDavid.Taylor@xxxxxxxxxxxxxxx>
To: 'oracle-l@xxxxxxxxxxxxx' <oracle-l@xxxxxxxxxxxxx>
Sent: Tue, Aug 3, 2010 9:59 am
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
 
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.
 

Other related posts: