我最近将我的数据库软件从Oracle 11.2.0.4升级到Oracle 12c,它是一个干净的,没有任何实例或数据库。 该计算机是Windows Server R2 2012。
该过程本身是: 安装Oracle 11.2.0.4并升级(仅限软件)到Oracle 12c。 我没有安装任何方案,只是升级了软件。
当我尝试执行以下脚本时(升级后),我收到以下错误:
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK
WHENEVER OSERROR EXIT FAILURE ROLLBACK
-- PARAMS:
define NN_ORA_INSTALL_DIR = &1;
define ORACLE_SID = &2;
define ORACLE_SYS_BASE = &3;
define ORACLE_HOME = &4;
define SYSPASS = &5;
connect SYS/&SYSPASS as SYSDBA
set echo on;
spool &NN_ORA_INSTALL_DIR\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, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\SYSTEM01.DBF', 0, 'SYSTEM');
dbms_backup_restore.restoreDataFileTo(2, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\SYSAUX01.DBF', 0, 'SYSAUX');
dbms_backup_restore.restoreDataFileTo(3, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\UNDOTBS01.DBF', 0, 'UNDOTBS1');
dbms_backup_restore.restoreDataFileTo(4, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\USERS01.DBF', 0, 'USERS');
dbms_output.put_line(' Restoring ... ');
dbms_backup_restore.restoreBackupPiece('&ORACLE_HOME\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;
但是我收到以下错误:
Allocating device....
Specifying datafiles...
Specifing datafiles...
Restoring ...
declare
*
ERROR at line 1:
ORA-19583: conversation terminated due to error
ORA-19870: error while restoring backup piece
C:\ORACLE\ORA12\ASSISTANTS\DBCA\TEMPLATES\SEED_DATABASE.DFB
ORA-19615: some files not found in backup set
ORA-19613: datafile 2 not found in backup set
ORA-06512: at "SYS.X$DBMS_BACKUP_RESTORE", line 6138
ORA-06512: at line 16
我在多个Oracle 11版本升级中成功运作。
我怎么可能解决这个问题? 提前谢谢。
答案 0 :(得分:0)
发现问题,Oracle12中每个数据文件的编号都已更改。
dbms_backup_restore.restoreDataFileTo(1, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\SYSTEM01.DBF', 0, 'SYSTEM');
dbms_backup_restore.restoreDataFileTo(2, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\SYSAUX01.DBF', 0, 'SYSAUX');
dbms_backup_restore.restoreDataFileTo(3, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\UNDOTBS01.DBF', 0, 'UNDOTBS1');
dbms_backup_restore.restoreDataFileTo(4, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\USERS01.DBF', 0, 'USERS');
应该是:
dbms_backup_restore.restoreDataFileTo(1, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\SYSTEM01.DBF', 0, 'SYSTEM');
dbms_backup_restore.restoreDataFileTo(3, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\SYSAUX01.DBF', 0, 'SYSAUX');
dbms_backup_restore.restoreDataFileTo(5, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\UNDOTBS01.DBF', 0, 'UNDOTBS1');
dbms_backup_restore.restoreDataFileTo(6, '&ORACLE_SYS_BASE\oradata\&ORACLE_SID\USERS01.DBF', 0, 'USERS');