Forum Stats

  • 3,769,714 Users
  • 2,253,014 Discussions
  • 7,875,157 Comments

Discussions

How do I copy archivelogs from one log_archive_dest to another

Duncan Gardner
Duncan Gardner Member Posts: 122
edited Jul 22, 2020 8:27AM in Recovery Manager (RMAN)

I temporarily ran out of disc space in log_archive_dest_2, which is a file system. log_archive_dest_1 was ok (ASM). I got error:

ARC0: Error 19504 Creating archive log file

So now I want to copy files from log_archive_dest_1 to log_archive_dest_2 (which now has sufficient space). AND have them reflected in v$archived_log where dest_id =2. I know I can copy the file to the file system, but I end up with a record in v$archive_log where dest_id = 1 (using RMAN> copy archivelog '+FRA...' to '/u01...';)

Is this possible? Oracle 11g RAC, Standard Edition.

Thanks, Duncan

Answers

  • Dude!
    Dude! Member Posts: 22,826 Black Diamond
    edited Jul 18, 2020 5:46AM

    You can use the RMAN CATALOG command to add the missing records. For example:

    RMAN> catalog start with '/u02/.../;

    Then you can use the following to delete records of archivelogs that no longer exist.

    RMAN> <code>crosscheck archivelog all;

    RMAN> delete expired archivelog all;

  • EdStevens
    EdStevens Member Posts: 28,529 Gold Crown
    edited Jul 18, 2020 3:30PM

    IN addition to Dude's reply, please be aware that, as far as rman is concerned, there is/was no need to move the archivlogs.  When an archivelog is created, it's complete location is written to the repository records, and it is this information that is used to locate the archive logs when needed.  The setting of archive log destination only where archlogs are subsequently written.  RMAN does not use that setting to locate them.

  • Duncan Gardner
    Duncan Gardner Member Posts: 122
    edited Jul 21, 2020 2:52AM

    Thanks Dude! & Ed Stevens. It seems it isn't possible.

  • EdStevens
    EdStevens Member Posts: 28,529 Gold Crown
    edited Jul 21, 2020 8:30AM
    Duncan Gardner wrote:Thanks Dude! & Ed Stevens. It seems it isn't possible. 

    Of course it is possible.  Dude! showed you how with the CATLOG command.  I was explaining that it is probably unnecessary.

    Why did the first location get filled in the first place?  If you are taking regular rman backups of the archivelogs, and using some form of the DELETE option of the BACKUP ARCHIVELOG command, your destination usage should be pretty much steady-state.

  • Dude!
    Dude! Member Posts: 22,826 Black Diamond
    edited Jul 21, 2020 9:38AM

    Are you getting RMAN-00000: It doesn't seem to work or what clues exist.

    Please be more specific.

  • Duncan Gardner
    Duncan Gardner Member Posts: 122
    edited Jul 21, 2020 9:25PM

    I asked if was possible to get the record in v$archive_log where dest_id = 2. I'm getting ORA-MI Mission Impossible.

    When I catalog the file it ends up in dest_id =1, even though the file is in the same file system as log_archive_dest_2

    Briefly, the reason why I want this is because we ship log files from log_archive_dest_2 to a disaster recovery box using a script that queries v$archived_log where dest_id =2.

    RMAN> catalog archivelog '/u01/app/grid/acfsmounts/fra_logreplica/MYDB/1_317040_822848177.dbf';

    using target database control file instead of recovery catalog

    cataloged archived log

    archived log file name=/u01/app/grid/acfsmounts/fra_logreplica/MYDB/1_317040_822848177.dbf RECID=132088 STAMP=1046430276

    select recid, name, dest_id, thread#, sequence# from v$archived_log where thread# = 1 and sequence# = 317040;

    RECID      NAME                                                                                                                         DEST_ID THREAD# SEQUENCE#

    130302      +FRA/MYDB/archivelog/2020_07_17/thread_1_seq_317040.5523.1045993693      1           1                317040

    132088      /u01/app/grid/acfsmounts/fra_logreplica/MYDB/1_317040_822848177.dbf               1           1                317040

  • Dude!
    Dude! Member Posts: 22,826 Black Diamond
    edited Jul 22, 2020 12:32AM

    Ok,I see what you mean. DEST_ID is the original destination from which the archive log was generated. Perhaps the question is how is DEST_ID is determined when you recatalog the log files, e.g.: is it part of the name, header, or path? Who knows?

    After moving archivelogs from DEST_1 to DEST_2 did you do a crosscheck and delete the expired records? Just wondering if the recatalog might otherwise simply update the existing records.

    Briefly, the reason why I want this is because we ship log files from log_archive_dest_2 to a disaster recovery box using a script that queries v$archived_log where dest_id =2.

    I don't really understand the involvement with RMAN here. This looks like a XY problem to me, where you hope to fix X with Y. However, I think the problem is you are relying on a script that queries DEST_ID. Perhaps the better plan would be to copy/sync files in DEST_2 at the OS level, since you're also using the filesystem to copy files around.

  • EdStevens
    EdStevens Member Posts: 28,529 Gold Crown
    edited Jul 22, 2020 8:27AM
    Duncan Gardner wrote:<snip>Briefly, the reason why I want this is because we ship log files from log_archive_dest_2 to a disaster recovery box using a script that queries v$archived_log where dest_id =2.<snip>

    I agree with Dude.  This is an x-y problem.  Your actual problem is to have the archivelogs at an offsite location.  That is a commendable goal. But for this, you do NOT need to involve rman, you do NOT need to have second archivelog destination. and you do NOT need to be querying v$archived_log, or anything else.  Just copy use OS commands to copy the files from their primary location to the offsite location.  Or why not simply have your backup script copy the backups after rman is finished?  I don't understand why you are trying to make this so much more difficult than it is.