Forum Stats

  • 3,768,004 Users
  • 2,252,739 Discussions
  • 7,874,407 Comments

Discussions

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

orasiya
orasiya Member Posts: 427 Bronze Badge
edited Jul 1, 2020 10:49AM in Recovery Manager (RMAN)

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

orasiyaDude!
«1

Answers

  • Dude!
    Dude! Member Posts: 22,826 Black Diamond
    edited Jun 27, 2020 9:58AM

    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

    [[email protected] ~]$ . oraenv <<< +ASM[[email protected] ~]$ asmcmd[[email protected] ~]$ asmcmdASMCMD> cd FRA/CDBASM/BACKUPSET/2020_06_27ASMCMD> cp * /tmpcopying +FRA/CDBASM/BACKUPSET/2020_06_27/annnf0_TAG20200627T164240_0.337.1044200561 -> /tmp/annnf0_TAG20200627T164240_0.337.1044200561copying +FRA/CDBASM/BACKUPSET/2020_06_27/nnndf0_TAG20200627T164242_0.336.1044200567 -> /tmp/nnndf0_TAG20200627T164242_0.336.1044200567copying +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.

    orasiyaorasiya
  • EdStevens
    EdStevens Member Posts: 28,519 Gold Crown
    edited Jun 27, 2020 12:34PM
    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 piecesASMCMD [+REC1/TEST] > lsARCHIVELOG/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?

  • orasiya
    orasiya Member Posts: 427 Bronze Badge
    edited Jun 27, 2020 6:55PM

    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

  • Dude!
    Dude! Member Posts: 22,826 Black Diamond
    edited Jun 28, 2020 12:53AM

    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:

  • EdStevens
    EdStevens Member Posts: 28,519 Gold Crown
    edited Jun 28, 2020 11:22AM
    Siyavuş AK wrote:Dear EdLet'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.

  • Dude!
    Dude! Member Posts: 22,826 Black Diamond
    edited Jun 28, 2020 12:09PM

    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.

  • orasiya
    orasiya Member Posts: 427 Bronze Badge
    edited Jun 29, 2020 11:48AM

    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

  • EdStevens
    EdStevens Member Posts: 28,519 Gold Crown
    edited Jun 29, 2020 12:16PM
    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.

    Dude!
  • Dude!
    Dude! Member Posts: 22,826 Black Diamond
    edited Jun 29, 2020 12:32PM

    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.

  • orasiya
    orasiya Member Posts: 427 Bronze Badge
    edited Jul 1, 2020 9:27AM

    Dear Dude,

    many thanks for your attention,

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

    regards