• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 506
  • Last Modified:

restore orcle 10g database to point in time every night

Guys

I want to create a script that will restore a database to  23:00 everynight

im after the "set until time" parameter

its easy to create a script that has the date time manually entered but I want to set and forget

regards
0
DarrenJackson
Asked:
DarrenJackson
  • 6
  • 3
1 Solution
 
slightwv (䄆 Netminder) Commented:
>>its easy to create a script that has the date time manually entered but I want to set and forget

If creating the script with a hard coded date is easy can you not then just add to it to replace the hardcoded time with a derived date or use parameters?

There is something similar here:
http://www.oracle.com/technetwork/issue-archive/2009/09-sep/o59recovery-085185.html
0
 
DarrenJacksonAuthor Commented:
I want to set and forget its for when im not in the office to manually adjust
0
 
DarrenJacksonAuthor Commented:
the link supplied explains rman but not what i am after
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
slightwv (䄆 Netminder) Commented:
How are you backing up and restoring?
0
 
DarrenJacksonAuthor Commented:
To bacup i run a script

#!/bin/ksh
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=/u01/app/oracle/product/10.2.0/db_1/bin:/u01/app/oracle/product/10.2.0/crs_1/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
cd /home/oracle/scripts
export ORACLE_SID=IFSL1
rman target / cmdfile=backup_database.rcv >>ifsl_backup.log

contents of
back_database.rcv

run {
backup database include current controlfile plus archivelog delete all input;
delete noprompt obsolete recovery window of 5 days;
}



to restore on another server

#!/bin/ksh
export ORACLE_SID=IFSL_STBY_01
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_2
sqlplus /nolog << EOF
CONN / as sysdba
shutdown immediate
startup nomount;
EXIT;
EOF
#  RMAN restore IFSL database onto IFSL24
rman target sys/toshiba@IFSL_live auxiliary / cmdfile=/home/oracle/scripts/recreate_IFSL24.rcv
# put into no archive log mode and remove additional udo tbs
sqlplus /nolog << EOF
CONN / as sysdba
shutdown immediate
startup mount;
alter database noarchivelog;
alter database open;
EXIT;
EOF



contents of recreate_IFSL24.rcv

run {
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
set newname for datafile 1 to '/oradb/oradata/IFSL/system.281.657570759';
set newname for datafile 2 to '/oradb/oradata/IFSL/undotbs1.282.657570781';
set newname for datafile 3 to '/oradb/oradata/IFSL/sysaux.283.657570845';
set newname for datafile 4 to '/oradb/oradata/IFSL/users.1477.753106049';
set newname for datafile 5 to '/oradb/oradata/IFSL/undotbs2.286.657570853';
set newname for datafile 7 to '/oradb/oradata/IFSL/ifsinfo_index.301.657628921';
set newname for datafile 8 to '/oradb/oradata/IFSL/ifsinfo_data.302.657628967';
set newname for datafile 9 to '/oradb/oradata/IFSL/ifsapp_data.305.657629229';
set newname for datafile 10 to '/oradb/oradata/IFSL/ifsapp_index.304.657629361';
set newname for datafile 11 to '/oradb/oradata/IFSL/ifsapp_lob.306.657628673';
set newname for datafile 12 to '/oradb/oradata/IFSL/ifsapp_report_data.307.657628691';
set newname for datafile 13 to '/oradb/oradata/IFSL/ifsapp_report_index.308.657628701';
set newname for datafile 14 to '/oradb/oradata/IFSL/ifsapp_archive_data.309.657628701';
set newname for datafile 15 to '/oradb/oradata/IFSL/ifsapp_archive_index.310.657628703';
set newname for datafile 16 to '/oradb/oradata/IFSL/ifsapp_data.1349.670720685';
set newname for datafile 17 to '/oradb/oradata/IFSL/ifsapp_index.1608.686942219';
set newname for datafile 18 to '/oradb/oradata/IFSL/ifsapp_data.2523.713283867';
set newname for datafile 19 to '/oradb/oradata/IFSL/undotbs3.2129.713995819';
set newname for datafile 20 to '/oradb/oradata/IFSL/audit.2878.724498205';
set newname for tempfile 1 to '/oradb/oradata/IFSL/temp01.dbf';
set until time "sysdate -1";
#set until time "to_date('21/08/2012 01:00:00','DD/MM/YYYY HH24:MI:SS')";
DUPLICATE TARGET DATABASE TO IFSL
LOGFILE GROUP 1 ('/oradb/oradata/IFSL/APP2_log1A.rdo',
                   '/oradb/oradata/IFSL/APP2_log1B.rdo') SIZE 10M REUSE,
          GROUP 2 ('/oradb/oradata/IFSL/APP2_log2A.rdo',
                   '/oradb/oradata/IFSL/APP2_log2B.rdo') SIZE 10M REUSE,
          GROUP 3 ('/oradb/oradata/IFSL/APP2_log3A.rdo',
                   '/oradb/oradata/IFSL/APP2_log3B.rdo') SIZE 10M REUSE,
          GROUP 4 ('/oradb/oradata/IFSL/APP2_log4A.rdo',
                   '/oradb/oradata/IFSL/APP2_log4B.rdo') SIZE 10M REUSE,
          GROUP 5 ('/oradb/oradata/IFSL/APP2_log5A.rdo',
                   '/oradb/oradata/IFSL/APP2_log5B.rdo') SIZE 10M REUSE,
          GROUP 6 ('/oradb/oradata/IFSL/APP2_log10A.rdo',
                    '/oradb/oradata/IFSL/APP2_log10B.rdo') SIZE 10M REUSE;
release channel aux1;
release channel aux2;
release channel aux3;
}
0
 
DarrenJacksonAuthor Commented:
I want to alter the set until time "sysdate -1" to be that it restores until 23:00 of sysdate -1
0
 
slightwv (䄆 Netminder) Commented:
Try this:

set until time "trunc(sysdate -1)+23/24";
0
 
DarrenJacksonAuthor Commented:
ahh ok i will thanks
0
 
DarrenJacksonAuthor Commented:
Thanks works a treat

Cheers
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now