当前位置:  数据库>oracle

RMAN异构迁移及异构DataGuard

    来源: 互联网  发布时间:2017-06-25

    本文导语: 1、Rman工具将Windows数据库迁移到Linux上。 rman可以实现跨操作系统平台备份恢复,但是必须符合如下标准,且数据库版本要一致。 For Oracle Database 10g Release 2 and above releases: Solaris x86-64 Linux x86-64 HP-PA HP-IA Windows IA (64-bit) / Windows (64-...

1、Rman工具将Windows数据库迁移到Linux上。

rman可以实现跨操作系统平台备份恢复,但是必须符合如下标准,且数据库版本要一致。

For Oracle Database 10g Release 2 and above releases:

Solaris x86-64 Linux x86-64

HP-PA HP-IA

Windows IA (64-bit) / Windows (64-bit Itanium) Windows 64-bit for AMD /       

For Oracle Database 11g Release 1 and above releases (requires minimum 11.1 compatible setting):

Linux Windows

另外虽然基本备份和恢复过程和同平台rman备份恢复无差异,但是因为跨平台不能读取redo、archivelog信息,所以需要原端数据库启动到mount状态,然后执行rman全备。

11g支持set newname for database to 可以方便的将全库数据文件进行自动重命名。

run {

  set newname for database to '/home/oracle/app/oracle/oradata/ora/%U';

  restore database;

  switch datafile all;

  }

启动数据库

alter database open resetlogs;

修改temp表空间文件路径

SQL>alter database tempfile '/oradata/datafiles/ora/temp01.dbf' drop;
 Database altered.
 SQL>alter tablespace temp add tempfile '/oradata/datafiles/ora/temp01.dbf' reuse;  --需要数据库是open 或open read only状态 

修改redo存放路径

此时redo默认会放到$ORACLE_HOME/dbs目录中,参考《Oracle 修改redo日志》重新生成新的redo到指定位置。

失败测试记录:
记录1;
      尝试使用关库冷备份的方法将windows文件直接复制到linux中并尝试修改文件名,从而直接拉起数据库, 但是alter database rename file 命令无法执行成功。

SQL> select name from v$datafile;

NAME

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

C:APPADMINISTRATORORADATAORASYSTEM02.DBF

C:APPADMINISTRATORORADATAORASYSAUX01.DBF

C:APPADMINISTRATORORADATAORAUNDOTBS01.DBF

C:APPADMINISTRATORORADATAORAUSERS01.DBF

C:APPADMINISTRATORORADATAORAEXAMPLE01.DBF

SQL> alter database rename file 'C:APPADMINISTRATORORADATAORASYSTEM02.DBF'  to '/home/oracle/app/oracle/oradata/ora/SYSTEM02.DBF';

alter database rename file 'C:APPADMINISTRATORORADATAORASYSTEM02.DBF'  to '/home/oracle/app/oracle/oradata/ora/SYSTEM02.DBF'

*

ERROR at line 1:

ORA-01511: error in renaming log/data files

ORA-01516: nonexistent log file, data file, or temporary file

"C:APPADMINISTRATORORADATAORASYSTEM02.DBF"

原因:怀疑是和跨平台文件名无法正常识别有关。
记录2; 
如果不将原库处于mount状态,而是直接open状态下备份,然后备份归档,当目标端恢复时可以成功restore database,但是recover database时就无法成功,报如下错误。根据mos介绍这种跨平台场景下,redo 、archivelog 不支持传统的方式进行介质恢复。

RMAN> recover database;

Starting recover at 23-NOV-16

using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=95

channel ORA_DISK_1: reading from backup piece /tmp/backup/a/ARCHIVE0DRLLO42_1_1.BAK

channel ORA_DISK_1: piece handle=/tmp/backup/a/ARCHIVE0DRLLO42_1_1.BAK tag=TAG20161123T205634

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

archived log file name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_95_925028740.dbf thread=1 sequence=95

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

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

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

RMAN-03002: failure of recover command at 11/23/2016 21:11:20

RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_95_925028740.dbf'

ORA-10562: Error occurred while applying redo to data block (file# 2, block# 61511)

ORA-10564: tablespace SYSAUX

ORA-01110: data file 2: '/home/oracle/app/oracle/oradata/ora/data_D-ORA_TS-SYSAUX_FNO-2'

ORA-10561: block type 'TRANSACTION MANAGED DATA BLOCK', data object# 67714

ORA-00600: internal error code, arguments: [ktbrcl:CDLC not in CR], [228], [], [], [], [], [], [], [], [], [], []

2、跨平台Dataguard

每种操作系统平台都有platform_id ,如

SQL>  select platform_id, platform_name from v$database;

PLATFORM_ID PLATFORM_NAME

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

        13 Linux x86 64-bit

如下表中的各种platform_id组合可进行Dataguard配置,有些组合需要满足特定的条件,虽然跨平台不能将原端的归档直接在新库recover,但是可以部署特定异构平台的Dataguard,并实现实时同步。

PLATFORM_ID

PLATFORM_NAME
Release name

PLATFORM_IDs supported within the same Data Guard configuration when using Data Guard Redo Apply (Physical Standby)

2

Solaris[tm] OE (64-bit)
Solaris Operating System (SPARC) (64-bit)

2
6 - See Support Note: 1982638.1 and Note: 414043.1

3

HP-UX (64-bit)
HP-UX PA-RISC

3
4 - Oracle 10g onward, see Support Note: 395982.1 and Note:414043.1

4

HP-UX IA (64-bit)
HP-UX Itanium

4
3 - Oracle 10g onward, see Support Notes Note: 395982.1 and Note:414043.1

5

HP Tru64 UNIX
HP Tru64 UNIX

5

6

IBM AIX on POWER Systems (64-bit)

2 - See Support Note: 1982638.1 and Note: 414043.1
6

7

Microsoft Windows (32-bit)
Microsoft Windows (x86)

7
8, 12  - Oracle 10g onward, see Support Note: 414043.1 
10 - Oracle 11g onward, requires Patch 13104881 iis7站长之家 --> Fix for 13104881 Included in 12.1 
11, 13 - Oracle 11g onward, see Support Note: 414043.1, also requires Patch 13104881 iis7站长之家

8

Microsoft Windows IA (64-bit)
Microsoft Windows (64-bit Itanium)

7 - Oracle 10g onward, see Support Note: 414043.1
8
12 - Oracle 10g onward
11, 13 - Oracle 11g onward, requires Patch 13104881 iis7站长之家

9

IBM zSeries Based Linux
z/Linux

9
18 (64-bit zSeries only)

10

Linux (32-bit)
Linux x86

7 - Oracle 11g onward, requires Patch 13104881 iis7站长之家 
10
11, 13 - Oracle 10g onward, see Support Note: 414043.1

11

Linux IA (64-bit)
Linux Itanium

10 - Oracle 10g onward, see Support Note: 414043.1
11
13 - Oracle 10g onward
7 - Oracle 11g onward, see Support Note: 414043.1, also requires Patch 13104881 iis7站长之家
8, 12 - Oracle 11g onward, requires Patch 13104881 iis7站长之家

12

Microsoft Windows 64-bit for AMD
Microsoft Windows (x86-64)

7 - Oracle 10g onward, see Support Note Note: 414043.1
8 - Oracle 10g onward
12
11, 13 - Oracle 11g onward, requires Patch 13104881 iis7站长之家

13

Linux 64-bit for AMD
Linux x86-64

7 - Oracle 11g onward, see Support Note: 414043.1, also requires Patch 13104881 iis7站长之家
10 - Oracle 10g onward, see Support Note Note: 414043.1
11 - Oracle 10g onward
8, 12 - Oracle 11g onward, requires Patch 13104881 iis7站长之家
13
20 - Oracle 11g onward

15

HP Open VMS
HP OpenVMS Alpha
HP IA OpenVMS
OpenVMS Itanium

15

16

Apple Mac OS
Mac OS X Server

16

17

Solaris Operating System (x86)
Solaris Operating System (x86)

17
20 - Oracle 10g onward, see Support Note: 414043.1

18

IBM Power Based Linux
Linux on Power

9 (64-bit zSeries only)
18

20

Solaris Operating System (AMD64)
Solaris Operating System (x86-64)

13 - Oracle 11g onward 
17 - Oracle 10g onward, see Support Note: 414043.1
20

配置过程和普通Dataguard无差别,需要注意的是经过测试,需要将备机的*_FILE_NAME_CONVERT两个参数设置上 ,且rman恢复的时候直接recover而不要通过 set newname 的形式去指定新文件的路径,在使用rman进行初始化同步的时候会自动按照转换参数修改redo和temp文件的路径,否则会导致恢复后temp和redo仍然使用原windows路径格式,且无法手动修改。

注意事项:

SQL> alter system set DB_FILE_NAME_CONVERT='C:APPADMINISTRATORORADATAORA','/home/oracle/app/oracle/oradata/ora/' scope=spfile;

System altered.

SQL> alter system set LOG_FILE_NAME_CONVERT='C:APPADMINISTRATORORADATAORA','/home/oracle/app/oracle/oradata/ora/' scope=spfile;

System altered.

特别要特别以上转换参数中,windows路径的最后一个字符应该是,linux的最后一样应该是/,否则转换后的数据文件就会是

/home/oracle/app/oracle/oradata/oraEXAMPLE01.DBF

关于rman恢复的总结:

rman restore database还原时,无论新环境的控制文件是for standby的还是普通的控制文件,生成的数据文件的路径并不受OMF影响.

但如果restore 出来的控制文件是 for standby 的那restore database的时候如果不指定set netname 会按照*_file_name_convert 参数的转换值来生成数据文件、temp文件、redo文件等。

但如果restore 出来的控制文件是普通的控制文件,那restore database的时候如果不指定set netname ,也不会按照*_file_name_convert 参数的转换值来生成数据文件、temp文件、redo文件。如果是windows环境,会生成到$ORALCE_HOME/dbs目录下,文件名如:C:APPADMINISTRATORORADATAORAEXAMPLE01.DBF。

如果是linux则会生成到原路径下,如果路径不存在这直接报错,中断还原。

当创建好了Dataguard后,如果主端添加数据文件,则备端处理情况如下:

当备机设置了db_file_name_convert参数,并同时启动了OMF功能是,OMF的优先级要高于db_file_name_convert参数,备机OMF启动的情况下会 忽略db_file_name_convert参数。

参考文档:

Data Guard Support for Heterogeneous Primary and Physical Standbys in Same Data Guard Configuration (文档 ID 413484.1)

RMAN DUPLICATE/RESTORE/RECOVER Mixed Platform Support (文档 ID 1079563.1)

Restore From Windows To Linux using RMAN Fails (文档 ID 2003327.1)

Dataguard DB/LOG FILE NAME CONVERT has been set but files are created in a different directory (文档 ID 1348512.1)


    
 
 

您可能感兴趣的文章:

 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • rman备份脚本和rman增量备份脚本分享
  • Oracle数据库备份和恢复工具 RMan
  • catalog方式的rman备份与恢复示例
  • rman配置及rman常用命令操作
  • win平台oracle rman备份和删除dg备库归档日志脚本
  • linux自动运行rman增量备份脚本
  • 9i下RMAN的备份及恢复步骤
  • Oracle相关:Rman Crosscheck删除失效归档
  • ORACLE 数据库RMAN备份恢复
  • rman恢复方案和oracle异机恢复
  • Oracle RMAN快速入门指南


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3