Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

8

积分

1

好友

4

主题
1#
发表于 2014-5-21 13:00:31 | 查看: 4844| 回复: 1
数据库迁移后目标库无法恢复,报错ORA-16433: The database must be opened in read/write mode.
有的说是bug,但我还没查到不知确切原因是什么,也暂时没有解决方案,望有大侠能指点12。

下面是我的环境和迁移步骤:

源数据库信息:
操作系统:Linux oel6.4-1 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
数据库信息:
sys@PROD>select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

目标数据库信息:
操作系统:WINDOWS SERVER 2008 R2 ENTERPRISE 64位
数据库信息:
SYS@prod1>select * from v$version;

BANNER
--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

步骤包括:
1、确认平台--确认迁移两端的平台之间可迁移
sys@PROD>select * from V$DB_TRANSPORTABLE_PLATFORM;

PLATFORM_ID PLATFORM_NAME                                                                                         ENDIAN_FORMAT
----------- ----------------------------------------------------------------------------------------------------- --------------
          7 Microsoft Windows IA (32-bit)                                                                         Little
         10 Linux IA (32-bit)                                                                                     Little
          5 HP Tru64 UNIX                                                                                         Little
         11 Linux IA (64-bit)                                                                                     Little
         15 HP Open VMS                                                                                           Little
          8 Microsoft Windows IA (64-bit)                                                                         Little
         13 Linux x86 64-bit                                                                                      Little
         12 Microsoft Windows x86 64-bit                                                                          Little
         17 Solaris Operating System (x86)                                                                        Little
         19 HP IA Open VMS                                                                                        Little
         20 Solaris Operating System (x86-64)                                                                     Little
         21 Apple Mac OS (x86-64)                                                                                 Little

12 rows selected.

2、确认迁移是否支持
sys@PROD>alter database open read only;

Database altered.

sys@PROD>declare
  2  db_ready boolean;
  3  begin
  4  db_ready:=dbms_tdb.check_db('Microsoft Windows x86 64-bit');
  5  end;
  6  /

PL/SQL procedure successfully completed.

3、检查外部对象
sys@PROD>set serveroutput on
sys@PROD>declare
  2  external boolean;
  3  begin
  4  external:=dbms_tdb.check_external;
  5  end;
  6  /
The following directories exist in the database:
SYS.ORACLE_OCM_CONFIG_DIR, SYS.DATA_PUMP_DIR

PL/SQL procedure successfully completed.

4、RMAN进行跨平台文件迁移
RMAN> convert database new database 'PROD1'
2> transport script '/s01/app/oracle/oradata/transport/transport.sql'
3> to platform 'Microsoft Windows x86 64-bit'
4> db_file_name_convert '/s01/app/oracle/oradata/PROD/disk1','/s01/app/oracle/oradata/transport','/s01/app/oracle/oradata/PROD/disk2','/s01/app/oracle/oradata/transport','/s01/app/oracle/oradata/PROD/disk3','/s01/app/oracle/oradata/transport','/s01/app/oracle/oradata/PROD/disk4','/s01/app/oracle/oradata/transport','/s01/app/oracle/oradata/PROD/disk5','/s01/app/oracle/oradata/transport';

Starting conversion at source at 21-MAY-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=6 device type=DISK

Directory SYS.ORACLE_OCM_CONFIG_DIR found in the database
Directory SYS.DATA_PUMP_DIR found in the database

User SYS with SYSDBA and SYSOPER privilege found in password file
User ZN with SYSDBA privilege found in password file
channel ORA_DISK_1: starting datafile conversion
input datafile file number=00004 name=/s01/app/oracle/oradata/PROD/disk1/example01.dbf
converted datafile=/s01/app/oracle/oradata/transport/example01.dbf
...

Edit init.ora file /s01/app/oracle/product/11.2.0/db_1/dbs/init_00p8q98s_1_0.ora. This PFILE will be used to create the database on the target platform
Run SQL script /s01/app/oracle/oradata/transport/transport.sql on the target platform to create database
To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the target platform
To change the internal database identifier, use DBNEWID Utility
Finished conversion at source at 21-MAY-14

5、将transport目录下的数据文件和transport.sql打包与生成的参数文件/s01/app/oracle/product/11.2.0/db_1/dbs/init_00p8q98s_1_0.ora一起上传到目标库平台上并解压,并创建目标库所需的目录,以及修改参数文件中的路径改为WINDOWS环境下的路径
在目标库将参数文件改名为initprod1.ora放在目录c:\oracle\database\下

2#
发表于 2014-5-21 13:00:49
接上
6、迁移开始
1) 重建控制文件
STARTUP NOMOUNT PFILE='c:\oracle\database\initprod1.ora'
CREATE CONTROLFILE REUSE SET DATABASE "PROD1" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 5
    MAXLOGMEMBERS 5
    MAXDATAFILES 200
    MAXINSTANCES 1
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    'c:\oracle\oradata\prod1\onlineredo\redo01_a.log',
    'c:\oracle\oradata\prod1\onlineredo\redo01_b.log'
  ) SIZE 100M BLOCKSIZE 512,
  GROUP 2 (
    'c:\oracle\oradata\prod1\onlineredo\redo02_a.log',
    'c:\oracle\oradata\prod1\onlineredo\redo02_b.log'
  ) SIZE 100M BLOCKSIZE 512,
  GROUP 3 (
    'c:\oracle\oradata\prod1\onlineredo\redo03_a.log',
    'c:\oracle\oradata\prod1\onlineredo\redo03_b.logs'
  ) SIZE 100M BLOCKSIZE 512
DATAFILE
  'c:\oracle\oradata\prod1\datafile\system01.dbf',
  'c:\oracle\oradata\prod1\datafile\sysaux01.dbf',
  'c:\oracle\oradata\prod1\datafile\undotbs01.dbf',
  'c:\oracle\oradata\prod1\datafile\example01.dbf',
  'c:\oracle\oradata\prod1\datafile\tools01.dbf',
  'c:\oracle\oradata\prod1\datafile\test1.dbf',
  'c:\oracle\oradata\prod1\datafile\test2.dbf',
  'c:\oracle\oradata\prod1\datafile\test3.dbf',
  'c:\oracle\oradata\prod1\datafile\test4.dbf',
  'c:\oracle\oradata\prod1\datafile\test5.dbf',
  'c:\oracle\oradata\prod1\datafile\test6.dbf',
  'c:\oracle\oradata\prod1\datafile\test7.dbf',
  'c:\oracle\oradata\prod1\datafile\test8.dbf',
  'c:\oracle\oradata\prod1\datafile\ocp01.dbf'
CHARACTER SET AL32UTF8
;

2) 完成数据库恢复
计划步骤为
a) startup upgrade提示system01.dbf需要介质恢复
b) recover database;
c) startup upgrade;
d) @?/rdbms/admin/utlirp.sql
e) @?/rdbms/admin/utlrp.sql
f) @?/rdbms/admin/catupgrd.sql
g) shutdown immediate
h) startup
i) ALTER TABLESPACE TEMPTS1 ADD TEMPFILE 'c:\oracle\oradata\prod1\datafile\tempts101.dbf'
     SIZE 307M AUTOEXTEND ON NEXT 8192  MAXSIZE 32767M;
     
但是实际上做recover database;的时候提示:
C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期三 5月 21 12:38:50 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

已连接到空闲例程。

SYS@prod1>startup upgrade;
ORACLE 例程已经启动。

Total System Global Area  638853120 bytes
Fixed Size                  2257912 bytes
Variable Size             264244232 bytes
Database Buffers          364904448 bytes
Redo Buffers                7446528 bytes
数据库装载完毕。
ORA-01113: 文件 1 需要介质恢复
ORA-01110: 数据文件 1: 'C:\ORACLE\ORADATA\PROD1\DATAFILE\SYSTEM01.DBF'


SYS@prod1>recover database;
ORA-00283: recovery session canceled due to errors
ORA-16433: The database must be opened in read/write mode.

之后查询了一些帖子,并做了如下操作:
C:\Users\Administrator>rman target /

恢复管理器: Release 11.2.0.3.0 - Production on 星期三 5月 21 12:41:11 2014

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

已连接到目标数据库: PROD1 (DBID=254817997, 未打开)

RMAN> recover database noredo;

启动 recover 于 21-5月 -14
使用目标数据库控制文件替代恢复目录
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: SID=283 设备类型=DISK

完成 recover 于 21-5月 -14

RMAN> alter database open resetlogs upgrade;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: 分析输入命令时出错
RMAN-01009: 语法错误: 找到 "upgrade": 应为: ";" 中的一个
RMAN-01007: 在第 1 行第 31 列, 文件: standard input

RMAN> alter database open resetlogs ;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: alter db 命令 (在 05/21/2014 12:42:17 上) 失败
ORA-01139: RESETLOGS 选项仅在不完全数据库恢复后有效

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: alter db 命令 (在 05/21/2014 12:42:35 上) 失败
ORA-01113: 文件 1 需要介质恢复
ORA-01110: 数据文件 1: 'C:\ORACLE\ORADATA\PROD1\DATAFILE\SYSTEM01.DBF'

有的说是bug,但我还没查到不知确切原因是什么,也暂时没有解决方案,望有大侠能指点12。

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-5-17 19:19 , Processed in 0.045090 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569