Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dbms_backup_restore.restoreDataFileTo fails in 12.2

Eli AbramsonOct 8 2017 — edited Oct 23 2017

Hi !

EDIT:

I've narrowed this issue down to "dbms_backup_restore.restoreDataFileTo(6, 'E:\oracle\oradata\mydbname\USERS01.DBF', 0, 'USERS');" being the problematic command.

I'm running a script that restores some data files using the dbms_backup_restore.restoreDataFileTo function. The script used to run fine in 11g and 12.1. Now, however, running it on 12.2, I'm getting :

declare

*

ERROR at line 1:

ORA-19583: conversation terminated due to error

ORA-06512: at "SYS.X$DBMS_BACKUP_RESTORE", line 6906

ORA-19870: error while restoring backup piece

E:\ORACLE\ORA12\ASSISTANTS\DBCA\TEMPLATES\SEED_DATABASE.DFB

ORA-19615: some files not found in backup set

ORA-19613: datafile 6 not found in backup set

ORA-06512: at "SYS.X$DBMS_BACKUP_RESTORE", line 6900

ORA-06512: at line 16

The script I'm running is:

connect SYS/mypass as SYSDBA

set echo on;

spool E:\oracle\admin\mydbname\create\rmanRestoreDatafiles.log

startup nomount;

set echo off;

set serveroutput on;

select TO_CHAR(systimestamp,'YYYYMMDD HH:MI:SS') from dual;

variable devicename varchar2(255);

declare

omfname varchar2(512) := NULL;

  done boolean;

  begin

    dbms_output.put_line(' ');

    dbms_output.put_line(' Allocating device.... ');

    dbms_output.put_line(' Specifying datafiles... ');

       :devicename := dbms_backup_restore.deviceAllocate;

    dbms_output.put_line(' Specifing datafiles... ');

    dbms_backup_restore.restoreSetDataFile;

      dbms_backup_restore.restoreDataFileTo(1, 'E:\oracle\oradata\mydbname\SYSTEM01.DBF', 0, 'SYSTEM');

      dbms_backup_restore.restoreDataFileTo(3, 'E:\oracle\oradata\mydbname\SYSAUX01.DBF', 0, 'SYSAUX');

      dbms_backup_restore.restoreDataFileTo(5, 'E:\oracle\oradata\mydbname\UNDOTBS01.DBF', 0, 'UNDOTBS1');

      dbms_backup_restore.restoreDataFileTo(6, 'E:\oracle\oradata\mydbname\USERS01.DBF', 0, 'USERS');

    dbms_output.put_line(' Restoring ... ');

    dbms_backup_restore.restoreBackupPiece('E:\oracle\ora12\assistants\dbca\templates\Seed_Database.dfb', done);

    if done then

        dbms_output.put_line(' Restore done.');

    else

        dbms_output.put_line(' ORA-XXXX: Restore failed ');

    end if;

    dbms_backup_restore.deviceDeallocate;

  end;

/

select TO_CHAR(systimestamp,'YYYYMMDD HH:MI:SS') from dual;

spool off;

exit;

Has anyone encountered anything like it?

I've also tried changing the first parameter passed to restoreDataFileTo to 1,2,3,4 with the exact same issue.

This post has been answered by Eli Abramson on Oct 23 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 20 2017
Added on Oct 8 2017
5 comments
651 views