14 Replies Latest reply on Jul 1, 2020 2:49 PM by EdStevens

    How move/copy  ( selecting related backup by time) old RMAN backups to new location

    orasiya

      Hi firends,

       

      How to move / copy RMAN old backup  pieces (under asm) completely to new location?e.g. from asm drive (completely) to /old_backup_archive  , with  all related pieces

       

      ASMCMD [+REC1/TEST] > ls

      ARCHIVELOG/

      AUTOBACKUP/

      BACKUP/

      BACKUPSET/

      CONTROLFILE/

       

      best regards

        • 1. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
          Dude!

          What is /old_backup_archive? Is this a directory inside an ASM diskgroup or OS filesystem? I assume the later.

           

          Below is an example how to copy files from ASM to a directory on the file system using ASMCMD, e.g. /tmp

           

          [grid@localhost ~]$ . oraenv <<< +ASM

          [grid@localhost ~]$ asmcmd

          [grid@localhost ~]$ asmcmd

          ASMCMD> cd FRA/CDBASM/BACKUPSET/2020_06_27

          ASMCMD> cp * /tmp

          copying +FRA/CDBASM/BACKUPSET/2020_06_27/annnf0_TAG20200627T164240_0.337.1044200561 -> /tmp/annnf0_TAG20200627T164240_0.337.1044200561

          copying +FRA/CDBASM/BACKUPSET/2020_06_27/nnndf0_TAG20200627T164242_0.336.1044200567 -> /tmp/nnndf0_TAG20200627T164242_0.336.1044200567

          copying +FRA/CDBASM/BACKUPSET/2020_06_27/annnf0_TAG20200627T164535_0.331.1044200735 -> /tmp/annnf0_TAG20200627T164535_0.331.1044200735

           

          Neither ASM nor ASMCMD has any knowledge about RMAN. What you are trying to do seems unusual, which often means you should probably reconsider the concept. If you need something more sophisticated, you will have to query the RMAN repository using SQL. You may find some useful example at:

           

          https://hemantoracledba.blogspot.com/2015/09/rman-9-querying-rman-views-catalog.html

           

          But I'm afraid any details required you will have to work out yourself.

          1 person found this helpful
          • 2. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
            EdStevens

            Siyavuş AK wrote:

             

            Hi firends,

             

            How to move / copy RMAN old backup pieces (under asm) completely to new location?e.g. from asm drive (completely) to /old_backup_archive , with all related pieces

             

            ASMCMD [+REC1/TEST] > ls

            ARCHIVELOG/

            AUTOBACKUP/

            BACKUP/

            BACKUPSET/

            CONTROLFILE/

             

            best regards

            As is so often the case, I'd want to step back and ask WHY do you want to do this?  What constitutes "old" backup pieces, and WHY do you want to move them?

            • 3. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
              orasiya

              Dear Ed

              Let's say I would like to garantee to restore this backup (with all pieces, backup files, controlfiles,spfiles) on the test server 1 year later.

               

              regards

              • 4. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                Dude!

                As I mentioned briefly in your previous thread, I suggest to use a files system that you can access from the OS level. You you prefer, you can also use ASM and assign a special diskgroup for such purpose. Please google ASM ACFS for more info. Then use whatever backup software to backup the RMAN backups, and run a cron script to delete old stuff as required. If you need to restore the database from 10 years ago, you restore the RMAN backup using your backup software.

                 

                It's probably best to use an RMAN catalog database for such prupose, however, you don't necessarily have to. You can also specify the path to the RAMN backupset that contains your database spfile and controlfile and restore the database. The restored controlfile includes the appropriate RMAN metadata. RMAN also automatically performs a recatalog of your specified backup location when you use the backup controflile.

                 

                Here's an example of the restore and recover process:

                Oracle Database 11g: Disaster Recovery Example

                • 5. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                  EdStevens

                  Siyavuş AK wrote:

                   

                  Dear Ed

                  Let's say I would like to garantee to restore this backup (with all pieces, backup files, controlfiles,spfiles) on the test server 1 year later.

                   

                  regards

                  OK.

                  Others have shown how to copy files from ASM to os file system.  Consider also ...

                   

                  rman> backup backupset .....

                   

                  and or

                   

                  rman> backup ... KEEP UNTIL.

                   

                  And for your given scenario,  consider how you will guarantee the following:

                  1) That a year from know, when the need to restore from that backup occurs, anyone even remembers that the backup is there for that purpose.

                  2) If anyone does remember that the backup is there, they know how to use it.

                   

                  I sometimes have a requirement to create an 'archival' backup of a database, to be used at some undetermined point in time.  Usually that time is within a month, but it really doesn't matter.  I have written a script to take an offline backup of the database, using the KEEP clause.  And a companion script that 1) prompts for the database to be recovered, 2) reads the catalog to find any archival backups for the selected database, and present a select list of those backups, then 3) restore from the selected backup.

                  • 6. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                    Dude!

                    Backup backupset as I recall will backup to tape only.

                     

                    Corporations In Europe, for example, need to archive data for 10 years. I don't think RMAN is the best tool to maintain that long of a history. It's no problem, however, for a any sophisticated backup software to maintain that long of information and to locate the media, like any file that needs to be restored, independent of RMAN or Oracle.

                     

                    You will need to document the procedure, in particular DBID and exact Oracle version. The backup software and backup media may change over the yeas. You could run into problems finding an interface for a old disk, for example, but LTO tapes are backward compatible and will be fine for decades if stored properly. People often think tape is slower than disk, but that's not true.

                    • 7. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                      orasiya

                      Dear Dude;

                      Only think I need is simple,

                       

                      In my test database, I need to return to the production database status with 10 days ago data. Therefore I need to prevent all backup pieces for restore / recovery ( Backup pieces ! / level 0 piceses, related controlfile ??? , related spfile ??? )

                       

                      regards

                      • 8. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                        EdStevens

                        Siyavuş AK wrote:

                         

                        Dear Dude;

                        Only think I need is simple,

                         

                        In my test database, I need to return to the production database status with 10 days ago data. Therefore I need to prevent all backup pieces for restore / recovery ( Backup pieces ! / level 0 piceses, related controlfile ??? , related spfile ??? )

                         

                        regards

                        Ten days ago?  Earlier you said "Let's say I would like to garantee to restore this backup (with all pieces, backup files, controlfiles,spfiles) on the test server 1 year later."  So which is it - 10 days or 1 year?  The  fundamental technique is the same, but the 'one year' presents complications in terms of institutional memory, as i pointed out earlier.

                         

                        A simple rman 'list backup' on your prod database will show you all of the files (backup pieces) you need to save.  You've been shown the commands to copy the files from ASM to os file system.

                        • 9. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                          Dude!

                          Can you rephrase your last post? What do you mean by "prevent"?

                           

                          If what you need is a guarantee that you can restore your database up to 10 days ago, than you can setup a RMAN retention policy, using a recovery window of 11 days, and adjust the control_file_record_keep_time accordingly, e.g. 12 days. You then make sure you periodically run RMAN delete obsolete to remove backups that are no longer required to meet your retention policy to maintain your backup space or use FRA. The later is an will automatically remove obsolete data when there is only 10-15 % space left.

                           

                          Also keep in mind, as I mentioned previously, that the retention policy is no guarantee for obsolete backups to be deleted. For example, your retention is 10 days, but when your last full backup was two weeks ago, two weeks are required to fulfill the retention policy. It all boils down to having a reasonable backup strategy that meets your retention policy. And one more thing, if you relocate backups using the OS or ASMCMD, RMAN has no more knowledge about backup until you re-catalog backups in the database target controlfile again.

                          • 10. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                            orasiya

                            Dear Dude,

                            many thanks for your attention,

                             

                            how to we mount,  +REC1/   (source server)   under destination server (  RMAN>catalog start with  '192.168.............'; )

                             

                            regards

                            • 11. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                              orasiya

                              Dear Dude,

                              many thanks for your attention,

                               

                              Anyway, I want to show the entire backup instead of copying !

                               

                              how to we mount,  +REC1/   (source server)   for destination server (  RMAN>catalog start with  '192.168.............'; )

                               

                              regards

                              • 12. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                                EdStevens

                                orasiya wrote:

                                 

                                Dear Dude,

                                many thanks for your attention,

                                 

                                how to we mount, +REC1/ (source server) under destination server ( RMAN>catalog start with '192.168.............'; )

                                 

                                regards

                                Who said anything about mounting the source ASM under the destination?

                                Your original question was how to move/copy the files from ASM to a file system.  You've been given the command for that. Once you have copied them to the file system (on the source system), then use ftp or (better) scp to copy them to some directory on the destination.  At this point, rman will not know anything about them, so they will not be subject to rman 'delete' commands.  When you need them, use the rman 'catalog' command to make rman aware of them.

                                • 13. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                                  Dude!

                                  ASM does not provide any means of network sharing. You also cannot share disks between different systems without any kind of clustering software. That's why, for example, every RAC node has it's own ASM instance. Starting with 12c (12.2?) you also have Oracle Flex ASM, but it's not suitable for your purpose.

                                   

                                  If you need to copy data from ASM to another server, you can do so by mounting a remote network share, and use ASMCMD or SQL to copy files the files as mentioned. The way I see it, your better off storing your RMAN backups on an OS mounted filesystem in the first place, which will then give you more options to copy, share and manage online data in the context of what you are trying to accomplish. Or use tape backup. ASM provides an option to mount a diskgroup at the OS level (ADVM/ADFS), but the again, it's either ASM or filesystem, not both, and won't help you with your existing backups.

                                  1 person found this helpful
                                  • 14. Re: How move/copy  ( selecting related backup by time) old RMAN backups to new location
                                    EdStevens

                                    Clarification - when I said "At this point, rman will not know anything about them, so they will not be subject to rman 'delete' commands. "  I was referring to the copies, not the originals.