SQL to find rman backup files required for recovery?

Hi folks,
I'm looking for a sql statement that I can use to query the database and return a list of the RMAN backup files needed for a successful recovery based on a SCN or a point in time. I want to do it through SQL (not though rman) because I want to script an automated refresh process. My databases are backed up online, so I would need any archive log backups done during the database backup as well. So for example...
I do a database backup
Then do an archive log backup.
Pass a SQL script the lowest and highest scn numbers during the backup.
It returns a list of the rman backup pieces needed to do a successful recovery.
I've got a script, below, which shows the lowest and highest scn during the last full backup (all datafiles which exist have been backed up), if someone understands what I'm looking for and has done something similar, I would really appreciate any insight you may have. What I'd want to get back from the SQL is the names of the rman backup files (handles) which would be needed to get the database recovered to the highest scn during the backup.
SELECT MIN(VBD.CHECKPOINT_CHANGE#), MAX(VBD.CHECKPOINT_CHANGE#)
FROM V$BACKUP_DATAFILE VBD, V$DATAFILE VDF,
(SELECT
CREATION_CHANGE#,
MAX(COMPLETION_TIME) COMPLETION_TIME
FROM V$BACKUP_DATAFILE
WHERE CREATION_CHANGE# IN (
SELECT CREATION_CHANGE# FROM V$DATAFILE)
GROUP BY CREATION_CHANGE#
) QUERY1
WHERE VBD.CREATION_CHANGE# = VDF.CREATION_CHANGE#
AND VBD.CREATION_CHANGE# = QUERY1.CREATION_CHANGE#
AND VBD.COMPLETION_TIME = QUERY1.COMPLETION_TIME;
Thanks very much for your time,
-Adam vonNieda

In case anyone's wondering, here's the answer. The following query returns the min and max SCN numbers contained in the last online backup.
SELECT MIN(VBD.CHECKPOINT_CHANGE#), MAX(VBD.CHECKPOINT_CHANGE#)
FROM V$BACKUP_DATAFILE VBD, V$DATAFILE VDF,
(SELECT
CREATION_CHANGE#,
MAX(COMPLETION_TIME) COMPLETION_TIME
FROM V$BACKUP_DATAFILE
WHERE CREATION_CHANGE# IN (
SELECT CREATION_CHANGE# FROM V$DATAFILE)
GROUP BY CREATION_CHANGE#
) QUERY1
WHERE VBD.CREATION_CHANGE# = VDF.CREATION_CHANGE#
AND VBD.CREATION_CHANGE# = QUERY1.CREATION_CHANGE#
AND VBD.COMPLETION_TIME = QUERY1.COMPLETION_TIME;
This next one gets the session key for that backup.
Select distinct session_key from v$backup_datafile_details
where checkpoint_change# >= <min scn# from above> and checkpoint_change# <= <max scn# from above>;
And finally, this one returns all files written out during that RMAN session, which includes control files, data files, and archived redo logs
Select handle from v$backup_piece_details
where session_key = <session key from above> order by completion_time;

Similar Messages

  • How to find total size of RMAN backup files?

    Hi there
    env: Oracle 10gR2, RHEL 64bit
    My client has a production database where rman backups are taken: Level-0 backup every Sunday and Level-1 Monday thru Saturday.
    I have very limited access to this production database because it is being managed by third party and they won't provide me my required info (not sure why). I do not have access to their rman repository. To connect to the database I have to login to an intermediate server and then login to the database server. I have no access to Enterprise Manager. So in short, my access is limited. I want to gather the information on total size of rman backup files - both for a Level-0 and Level-1 backups separately. I understand that this info can be retrieved from rman repository. Are there any data dictionary views/tables where I may get this info?
    Best regards

    Hi,
    Have you searched in  forum check this:https://forums.oracle.com/thread/1097939
    HTH

  • Where can I find the backup files in iTunes for my iPhone, I want a copy

    Where can I find the backup files in iTunes for my iPhone, I want to copy the backup files for all app's and phone numbers, I'm using Windows XP
    I just need to know where its hiding, a link that shows an address where would sure help

    First you'll need to make sure your XP is set up to view hidden files and folders.
    1. Open My Computer from the desktop or Start menu.
    2. In the Tools menu, click Folder Options.
    3. Click the View tab.
    4. In the "Advanced settings" pane under "Hidden files and folders" make sure that the "Show hidden files and folders" option is selected.
    5. Click OK.
    Now you should be able to track down your backup file at the location in the following document:
    [iTunes: "Backup could not be saved on the computer" alert message|http://support.apple.com/kb/TS2529]

  • I backup my iphone on my pc and copy backup file into drive D then i setup new OS on my pc. after that i copy the backup file into itunes backup folder but itunes can't find the backup file to restore my iphone. how can i restore my iphone?

    i backup my iphone on my pc and copy backup file into drive D then i setup new OS on my pc. after that i copy the backup file into itunes backup folder but itunes can't find the backup file to restore my iphone. how can i restore my iphone?

    Don't you just love changes in interfaces?
    I found the answer to my question.
    When you attach a device (iPhone, iPad) to your Mac, in iTunes 12 in appears as a tiny icon in the second "row" of the iTunes display. Click the icon and the familiar iTunes display for the device appears. From there, on the Summary screen, you can see the dates of the backups of the device (iCloud and backup to the computer). You can also use the button to backup to the computer.

  • I have just made a clean instalation of Lion, with a bootable disk, and I planned to restore my files (music, photos, etc.), but Lion doesn't find my backup files. So, I'm about to loose all of my iTunes library, work docum The installation run perfectly,

    I have just made a clean instalation of Lion, with a bootable disk, and I planned to restore my files (music, photos, etc.), The installation run perfectly, but Lion doesn't find my backup files. So, I'm about to loose all of my iTunes library, work documents (I'm a lawyer!!), my kid's photos.... How can I restore my files?? Help!!

    Since you seem to be using a new disk for Lion, Time Machine will consider previous backups to be for a "different" computer.  Try doing a control-click or click-and-hold on the Time Machine icon in the Dock, then choose "Browse Other Time Machine Disks".  This should allow Time Machine to see the previous backups.
    In the worst case you should be able to open those Time Machine backups and copy your documents from there to your home folder.
    By the way, you've been misled by poor field labeling on this forum into typing a large part of your message into the field intended for the subject.  In the future just type a short summary of your post into that field and type the whole message into the field below that.

  • Restore database to another host - I have only rman backup files

    Hi all,
    The PC where Oracle was installed is crashed.
    I have only the RMAN backup pieces in other computer.
    I want to restore/recover this RMAN backup to other PC.
    I know the commands, restore database, recover database,
    but I've always used these commands with rman into existing rman
    user. Now, I don't have anything. I have only the RMAN backup files.
    How can I restore/recover database to other PC using these files?
    The steps are? create other database, create a rman user, register
    the rman backup files in this new rman, and restore these files
    in this new database already created with the same name?
    thank you!!!!

    XM wrote:
    Hi all,
    The PC where Oracle was installed is crashed.
    I have only the RMAN backup pieces in other computer.
    I want to restore/recover this RMAN backup to other PC.
    I know the commands, restore database, recover database,
    but I've always used these commands with rman into existing rman
    user. Now, I don't have anything. I have only the RMAN backup files.
    How can I restore/recover database to other PC using these files?
    The steps are? create other database, create a rman user, register
    the rman backup files in this new rman, and restore these files
    in this new database already created with the same name?
    thank you!!!!You need to perform disaster recovery. For this, follow my step by step video tutorial:
    http://kamranagayev.wordpress.com/2010/03/29/rman-video-tutorial-series-performing-disaster-recovery-with-rman/

  • Jar files required for Java Proxies

    Hi,
    Can someone mail me the following jar files required for Java Proxies or tell me where exactly I can find them….?
    aii_proxy_xirt.jar
    aii_msg_runtime.jar
    aii_utilxi_misc.jar
    guidgenerator.jar
    Regards,
    Abhy

    Hi Abhy,
    aii_proxy_xirt.jar
    C:usrsapJ2EJC00j2eeclusterserver0 inextcom.sap.aii.proxy.xiruntime
    aii_msg_runtime.jar C:usrsapJ2EJC00j2eeclusterserver0 inextcom.sap.aii.messaging.runtime
    aii_utilxi_misc.jar C:usrsapJ2EJC00j2eeclusterserver0 inextcom.sap.xi.util.misc
    guidgenerator.jar C:usrsapJ2EJC00j2eeclusterserver0 inextcom.sap.guid
    check this link
    http://72.14.203.104/search?q=cache:kBa_MrHu8lAJ:https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/how-to%2520guides%2520-%2520rig%2520official/xi/how%2520to%2520work%2520with%2520xi%25203.0%2520java%2520proxies.pdfjarfilesforaii_proxy_xirt.jar&hl=en&gl=in&ct=clnk&cd=1
    just copy the total path and paste in IE..
    u will find the jar files required .... with path..
    Regards,
    Sridhar
    Message was edited by: sridhar reddy kondam

  • Where can i find the backup files stored on my mac?

    where can i find the backup files stored on my mac?

    If you are asking about where iTunes stores backup files, see this knowledge base article for the info.
    If a general statement of backups, then then you have to look at each application to see where it saves according to its preferences window.

  • JFS2 CIO (concurrent i/o) & RMAN backup files Options

    Hello,
    Does anyone have good or bad experience storing RMAN backup files &
    datapump or export files with CIO enabled jfs2 file systems on AIX 5.3 & Oracle
    10gR2? Is that supported? Metalink and IBM documents are not very
    clear about these files... i.e. it does not say anywhere it's
    supported or not supported.. So asking here..
    Thanks in advance for your answers.

    Can anyone from Oracle comment on this?
    Thanks,
    Rene

  • To change default backup file permission for dsconf

    Hi,
    I was wondering if it is possible and ADVISABLE to change the default backup file permission for dsconf util. We're having two OS users, once which runs the script, and other which runs the dsconf. We're not allowed to schedule crontab from the second user profile. Hence, the user which runs the script will not be able to purge the old backup files as part of the backup process.
    -rw------- 1 tty gis 32M Dec 15 22:00 usersConfig-15-12-11.ldif
    Any thoughts if anyone has come across such issue.
    Thanks, JPrince

    So if I understand correctly, there is one user which creates the backups, and can run cron scripts. A second user runs some script on the backup, but doesn't have permissions to remove the backup once the script finishes.
    Changing the permissions on the file itself is not enough, you have to have write permission on the directory which contains it as well. This doesn't sound (to me) like something you really want to do.
    What I would suggest thinking about is having directory or file somewhere that both users can read/write.
    When the script finishes processing, write the name of the backup into that file (or create an empty file in the directory with the same name as the backup).
    Run a cron script from the first user (the one that creates the backups) which checks for names of processed files. If it finds any, it removes those backups, and the names from the file/directory.

  • When i look at how much hard drive space i have available, my mac says i have 250 gigs used up in backup.  I can not find this backup file to delete it and free up the space

    When i look at how much hard drive space i have available, my mac says i have 250 gigs used up in backup.  I can not find this backup file to delete it and free up the space

    OmniDiskSweeper is a free utility that checks HD space.
    FreeSpace cost $1 or is a free utility that checks HD space.
    SpaceControl is a free utility that checks HD space.

  • RMAN backup files are still exist since long time, how to delete?

    Dear sir;
    I'm using the below script to do daily backup, however there are many rman backup files are still exist and consumes HD size, how could I delete these files in daily bases? some files dated in FEB, MAR, APR,
    ============Daily RMAN script=========
    rman target /<<!
    backup incremental level=0 as compressed backupset database format '/u15/rman/full_backup_%U.rman';
    backup archivelog all not backed up 2 times format '/u15/rman/arc_backup_%U.rman';
    backup current controlfile format '/u15/rman/control_%U.rman';
    delete archivelog all backed up 2 times to device type disk completed before 'sysdate-7';
    delete noprompt obsolete;
    ================================END
    Thanks and best regards
    Ali

    Hi;
    Our backup policy should have 7 days; however we have here some files from JAN, FEB,MAR, APR /2012 WHICH ARE BEYOND THE RETENTION DATE and these files should be deleted by executing " delete noprompt obsolete; ".
    All files are exist in /u15/rman/
    -rw-r----- 1 oracle oinstall 1151763968 Jan 21 01:36 arc_backup_7kn19h4a_1_1.rman
    -rw-r----- 1 oracle oinstall 1136882176 Jan 21 01:36 arc_backup_7ln19h4q_1_1.rman
    -rw-r----- 1 oracle oinstall 1135984640 Jan 21 01:36 arc_backup_7mn19h5a_1_1.rman
    -rw-r----- 1 oracle oinstall 1126627328 Jan 21 01:37 arc_backup_7nn19h5q_1_1.rman
    -rw-r----- 1 oracle oinstall 880606720 Mar 12 02:53 arc_backup_7nn5ldhp_1_1.rman
    -rw-r----- 1 oracle oinstall 1093043712 Jan 21 01:37 arc_backup_7on19h6a_1_1.rman
    -rw-r----- 1 oracle oinstall 9797632 Dec 15 01:04 control_04mu7tcp_1_1.rman
    -rw-r----- 1 oracle oinstall 36896768 Mar 3 02:55 control_4cn4tm9k_1_1.rman
    -rw-r----- 1 oracle oinstall 36896768 Mar 4 02:53 control_4on50ahm_1_1.rman
    -rw-r----- 1 oracle oinstall 36896768 Mar 5 02:55 control_56n52v1j_1_1.rman
    -rw-r----- 1 oracle oinstall 16252928 Jan 23 01:40 control_8tn1eq3t_1_1.rman
    -rw-r----- 1 oracle oinstall 16252928 Jan 24 01:40 control_9cn1heg0_1_1.rman
    -rw-r----- 1 oracle oinstall 202940416 Dec 15 01:04 full_backup_01mu7t50_1_1.rman
    -rw-r----- 1 oracle oinstall 1097728 Dec 15 01:04 full_backup_02mu7tcc_1_1.rman
    -rw-r----- 1 oracle oinstall 201285632 Dec 14 01:04 full_backup_0nmu58ou_1_1.rman
    -rw-r----- 1 oracle oinstall 5957304320 Feb 29 02:46 full_backup_2ln4g9l1_1_1.rman
    -rw-r----- 1 oracle oinstall 4128768 Feb 29 02:47 full_backup_2mn4gft8_1_1.rman
    -rw-r----- 1 oracle oinstall 6027075584 Mar 1 02:49 full_backup_32n4o6ov_1_1.rman
    -rw-r----- 1 oracle oinstall 4128768 Mar 1 02:49 full_backup_33n4od66_1_1.rman
    -rw-r----- 1 oracle oinstall 6187171840 Mar 2 02:51 full_backup_3gn4qr50_1_1.rman
    -rw-r----- 1 oracle oinstall 4145152 Mar 2 02:51 full_backup_3hn4r1kn_1_1.rman
    -rw-r----- 1 oracle oinstall 6115786752 Mar 3 02:51 full_backup_40n4tfgu_1_1.rman
    above is a short list of contents.
    to do our daily backup we perform the following script (in daily)
    ==================
    backup incremental level=0 as compressed backupset database format '/u15/rman/full_backup_%U.rman';
    backup archivelog all not backed up 2 times format '/u15/rman/arc_backup_%U.rman';
    backup current controlfile format '/u15/rman/control_%U.rman';
    delete archivelog all backed up 2 times to device type disk completed before 'sysdate-7';
    delete noprompt obsolete;
    ==================
    Thanks and best regards
    Ali

  • Where to find Java Class File Specification for Java 5.0?

    Where to find Java Class File Specification for Java 5.0?
    thank you in advance.

    same place you found it for 1.4Can u give more details? I thought the class spec for Java 1.4 is the same as Java 1.2.
    anyone can tell where to find Java Class File Specification for Java 5.0?
    Thanks.

  • Where can I find the coupon code required for registration?

    Where can I find the coupon code required for registration? I purchased the design standard at Officeworks in Australia and given the box a thorough check, but unless there is a number not labelled 'coupon code', it's definitely not there. I am using this product personally and not for business so I have no IT dept to assist.

    Find a serial number
    For anything else contact support directly or work things out with your reseller.
    Mylenium

  • Catalog addiional rman backup files

    Im trying to catalog addiional rman backup files, and getting this error:
    RMAN-07518: Reason: Foreign database file DBID: 2319619701 Database Name: SASP
    Previous activities: Database dictionary was recreated due to charset problems while exporting the database...
    Enterprise Manager was reconfigure with create repos due to same problems....
    Thanks in advance...
    Message was edited by:
    elvyscruz

    Previous activities: Database dictionary was
    recreated due to charset problems while exporting the
    database...
    Enterprise Manager was reconfigure with create repos
    due to same problems....I have not seen the full error messages that follows this one (post it if possible). However, if you recreated the database, then your database will now have a new DBID after it was recreated. You can see the current DBID of the database to see if it matches the one above.
    If it is a standby database and it is logical standby, then it will also have a different DBID.
    select dbid, name, database_role from v$database;

Maybe you are looking for