Forum Stats

  • 3,854,257 Users
  • 2,264,344 Discussions
  • 7,905,623 Comments

Discussions

RMAN Restore an oracle 12.1 to a different DB after upgrading it to oracle 19

Hesipesi
Hesipesi Member Posts: 188 Blue Ribbon
edited Apr 30, 2020 5:48PM in Database Upgrade

Hi,

I had an oracle 12.1 database which I took a level 0 backup and upgraded it to Oracle 19.

The database is registered in an oracle 19 RMAN Catalog.

Now I want to test my restore process and restore it with another name to work as the old oracle 12 database.

I've got couple of RMAN errors when I try different scenarios:

My database was a primary database and had one Standby database.

Here is the scripts i've executed was failed in different steps.

[[email protected] restore]$ . orause

ORCL          /oracle/oracle19

ORCL12        /oracle/12.1.0.2

ORACLE_SID = [oracle] ? ORCL

[[email protected] restore]$ rman

Recovery Manager: Release 19.0.0.0.0 - Production on Tue Apr 28 15:20:07 2020

Version 19.6.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect catalog user1/[email protected]

connected to recovery catalog database

RMAN> connect target sys/[email protected]

connected to target database: ORCL (DBID=3255963214)

RMAN> connect auxiliary sys/[email protected]

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-06429: AUXILIARY database is not compatible with this version of RMAN

RMAN-06618: RMAN client and database version mismatch; indicated database version is 12.1.0.2

RMAN>Recovery Manager complete.

[[email protected] ~]$ . orause

ORCL          /oracle/oracle19

ORCL12        /oracle/12.1.0.2

ORACLE_SID = [oracle] ? ORCL12

[[email protected] ~]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Tue Apr 28 11:26:05 2020

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL12 (not mounted)

RMAN> connect catalog user1/[email protected]

connected to recovery catalog database

recovery catalog schema release 19.06.00.00. is newer than RMAN release

RMAN> connect target sys/[email protected]

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-06167: already connected

RMAN> connect auxiliary sys/[email protected]

connected to auxiliary database: ORCL12 (not mounted)

RMAN>run {

set command id to 'rman_restore_ORCL to ORCL12';

set until scn 21128449072;

allocate auxiliary channel 'dev_0' type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';

allocate auxiliary channel 'dev_1' type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';

allocate auxiliary channel 'dev_2' type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';

allocate auxiliary channel 'dev_3' type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';

DUPLICATE TARGET DATABASE TO ORCL12 NOFILENAMECHECK

DB_FILE_NAME_CONVERT=(

'/oracle/DB/oradata/DB','/oracle/ORCL12/oradata/ORCL12'

)

  LOGFILE

  GROUP 1 ('/oracle/ORCL12/redo01/ORCL12_redo01a.rdo','/oracle/ORCL12/redo02/ORCL12_redo01b.rdo') SIZE 500M,

  GROUP 2 ('/oracle/ORCL12/redo01/ORCL12_redo02a.rdo','/oracle/ORCL12/redo02/ORCL12_redo02b.rdo') SIZE 500M,

  GROUP 3 ('/oracle/ORCL12/redo01/ORCL12_redo03a.rdo','/oracle/ORCL12/redo02/ORCL12_redo03b.rdo') SIZE 500M;

}

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of allocate command at 04/28/2020 11:34:06

RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog

RMAN> list incarnation of database ORCL;

List of Database Incarnations

DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time

------- ------- -------- ---------------- --- ---------- ----------

30093   30257   ORCL     3255963214       PARENT  21083959908 2020-01-21 19:54:09

30093   30094   ORCL     3255963214       PARENT  21084501894 2020-01-23 12:03:29

30093   89351   ORCL     3255963214       CURRENT 21128765183 2020-04-24 14:09:34

RMAN> exit

Now I'm wondering if such a RESTORE is even possible? ( I think it should be but i'm not sure?!)

It's strange that I have 3 instance of the same database in my rman catalog since it should be just 2 I think. one primary and one standby.

Do you think the latest problem is because of the incoorect number of the same database in my rman catalog?!?!

Or What do you think is the problem here and what do you generally suggest for such a scenario?!

Thanks a lot for all your comments!!

Regards

/Hesipesi

Mike NavickasHesipesi

Answers

  • Mike Navickas
    Mike Navickas Member Posts: 137 Blue Ribbon
    edited Apr 28, 2020 10:39PM

    Hesipesi,

    In your first attempt you did tried to connect to auxiliary database using RMAN version 19c. I am assuming that you are trying to duplicate 12.1 database into 12.1 database ... so you should be using RMAN version 12.1.

    On your second attempt database that you are trying to duplicate is ORCL  and your "duplicate" database is ORCL12 (started but not mounted and it is on host from which you run rman).

    You should be connecting to ORCL as "target"  (I know... it's confusing... indeed it is "source" database):

    connect target sys/[email protected]  -- in your example this failed because first you connected to target as "rman target /" which connected to ORCL2 and did not re-connected when you issued "connect target" again

    Then you should be connecting to "duplicate" database:

    connect auxiliary /

    Now run DUPLICATE database (all RUN block)... it should run fine.

    Regards

    Mike Navickas

    Hesipesi
  • Hesipesi
    Hesipesi Member Posts: 188 Blue Ribbon
    edited Apr 29, 2020 4:16AM

    Hi,

    Thanks for your reply!

    Now I did what you said:

    [[email protected] ~]$ . orause

    ORCL          /oracle/oracle19

    ORCL12        /oracle/12.1.0.2

    ORACLE_SID = [oracle] ? ORCL12

    [[email protected] restore]$ rman

    Recovery Manager: Release 12.1.0.2.0 - Production on Wed Apr 29 10:05:45 2020

    Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

    RMAN> connect catalog user1/[email protected]

    connected to recovery catalog database

    recovery catalog schema release 19.06.00.00. is newer than RMAN release

    RMAN> connect target sys/[email protected]

    RMAN-00571: ===========================================================

    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

    RMAN-00571: ===========================================================

    RMAN-06429: TARGET database is not compatible with this version of RMAN

    RMAN-06618: RMAN client and database release mismatch; indicated database release is 19.6.0.0

    RMAN> connect auxiliary /

    connected to auxiliary database: ORCL12 (not mounted)

    RMAN>

    RMAN client is 12.1 and when it tries to connect to ORCL database(target database) which is an oracle19 database (right now, because this database has been upgraded from 12.1 to 19) it return an error.

    Strange!!! so how is it possible to restore an already upgraded database when the application teams requests to get back to the old oracle12 database?!?!

    Shouldn't this be possible?!?!

    /Hesi

  • Mike Navickas
    Mike Navickas Member Posts: 137 Blue Ribbon
    edited Apr 29, 2020 8:25AM

    Hesi,

    No, you can not restore version 19 database into version 12 database or version 12 database into version 19 database. It has to be the same version, the same PSU level. If you want to create database at lower version than a source, create shell 12.1 database and then import data using impdp.

    Regards

    Mike

    Hesipesi
  • Daniel Overby Hansen-Oracle
    Daniel Overby Hansen-Oracle Posts: 93 Employee
    edited Apr 29, 2020 8:41AM

    Hi Mike,

    No, you can not restore version 19 database into version 12 database or version 12 database into version 19 database. It has to be the same version, the same PSU level.

    This is partly not true. Any version of RMAN can restore a backup set or image copy created by a previous release RMAN client:

    Any release of Oracle Database can restore backup sets and copies created by any prior Oracle Database release.

    https://docs.oracle.com/en/database/oracle/oracle-database/19/rcmrf/rman-compatibility.html#GUID-7D5B70B1-D585-4C89-9080…

    During restore of the backup you have to specify that RMAN should not open the database at the end of the restore. You can use the NOOPEN keyword for that. RMAN will then leave the database in MOUNT mode and you can then open the database in UPGRADE mode and do the upgrade.

    Here are a few good blogs showing how to restore an old release backup into a new release Oracle Home:

    https://gavinsoorma.com/2014/12/minimal-downtime-database-upgrade-from-oracle-10g-to-oracle-12c/

    https://www.thegeekdiary.com/upgrading-to-oracle-12c-using-rman-duplicate-with-noopen-clause-and-backup-location/

    Regards,

    Daniel

    Mike NavickasHesipesi
  • Mike Navickas
    Mike Navickas Member Posts: 137 Blue Ribbon
    edited Apr 29, 2020 9:12AM

    Thank you for pointing this out, yes I did not considered this option... but, I think, it would work for upgrade only. OP actually wants to do a downgrade from 19c to 12.1. I do not think that would be possible...
    Mike

    Hesipesi
  • Hesipesi
    Hesipesi Member Posts: 188 Blue Ribbon
    edited Apr 29, 2020 9:35AM

    Thank you!

    Yeah, as you say, I want to restore the old oracle 12 backup into a new orcle 12 database while the actuall TARGET database is already upgraded to oracle 19c.

  • Mike Navickas
    Mike Navickas Member Posts: 137 Blue Ribbon
    edited Apr 29, 2020 11:41AM

    Hesi,
    I might be misreading again what you are trying to achieve. From your last post you are saying that you have 12 backup somewhere on the disk and you want to duplicate database from that backup (not from the live database). In this case, I would try:

    Use Oracle 12 client

    connect  AUXILIARY /

    you do not need to connect to target

    You do not need to connect to catalog if you know backup location... at least were controlfile backups are.

    DUPLICATE DATABASE TO ORA12  SPFILE  BACKUP LOCATION '<location where backup is made>'  NOFILENAMECHECK;
    You can also try connecting to catalog as well ... but do not connect to TARGET. In that case you do not need to specify backup location.
    Hope this time suggestion helps... I do not have ability to test at this time, so typing just from memory and hoping that I got the syntax correctly.
    Regards

    Mike

    HesipesiHesipesi
  • Dude!
    Dude! Member Posts: 22,830 Black Diamond
    edited Apr 29, 2020 1:05PM
    I had an oracle 12.1 database which I took a level 0 backup and upgraded it to Oracle 19.The database is registered in an oracle 19 RMAN Catalog.Now I want to test my restore process and restore it with another name to work as the old oracle 12 database.

    As already outlined, RMAN can use backups from previous versions, but target or auxiliary instance need to match the version of your RMAN client. Also the catalog needs to be the same version as your client. You can create a 19c auxiliary instance and restore/dupliate your 12c database, followed by upgrading the database to 19c. If I recall correctly, you can duplicate a database to a higher version, but you need to use the NOOPEN parameter to allow for the ‘open upgrade’ option to be performed manually.

    RMAN> connect auxiliary sys/[email protected]

    The connect string most likely points to a 12c database with a 12c database home in the listener configuration. You cannot create a 12c instance using 19c server software. So if you want restore a 12c database and use it as 12c as you mentioned, you need to install and use the 12c software anyway. So why bother with 19c to restore/duplicate the 12c database? Just do it in 12c. You do not necessarily need the catalog database to restore your database.

  • Hesipesi
    Hesipesi Member Posts: 188 Blue Ribbon
    edited Apr 30, 2020 5:48PM

    Thanks Mike!

    Your solution really make sence!

    I'll try to do it exactly as you said and will get back to you with the results soon!

    Thanks alot for the help!