Oracle11G Rman垮平台恢复 Windows for Linux

前言:

近期做了一个Rman的垮平台恢复,数据库从Windows server 2008平台 恢复到 Linux Red hat 5.4平台,数据量大约在1.4T左右,恢复时间大约为20小时。

下面的文章是我的恢复步骤,这个实验做完后其实并不是太成功,虽然最后成功OPEN数据库,但是日志内还是会有一些ORA-600的报错,现在我也正在排除这些报错,我写这篇文章的目的是希望给那些第一次做垮平台恢复的朋友开拓一些思路,有一个方向,至于那些比较细微的问题还需要各位根据自己所掌握的知识慢慢处理,祝大家好运。

 

摘要:

数据库版本:11.0.2.0.1

操作系统:Windoors(源OS) for Linux(目标OS)

恢复工具:Rman

数据量:1.4T

 

前期准备:

1:做恢复之前,首先我们要查看数据库自带的试图,来判断一下两平台如果传输备份数据是否需要转换字符,我是从Windoors(64bit)恢复到Linux(64bit),很显然它们都属于little字节,所以不需要转换。

SQL> select * from v$transportable_platform order by platform_id;

PLATFORM_ID PLATFORM_NAME                       ENDIAN_FORMAT
----------- -----------------------------------                           --------------
          1 Solaris[tm] OE (32-bit)                                       Big
          2 Solaris[tm] OE (64-bit)                                       Big
          3 HP-UX (64-bit)                                                    Big
          4 HP-UX IA (64-bit)                                                Big
          5 HP Tru64 UNIX                                                    Little
          6 AIX-Based Systems (64-bit)                                 Big
          7 Microsoft Windows IA (32-bit)                              Little
          8 Microsoft Windows IA (64-bit)                              Little
          9 IBM zSeries Based Linux                                    Big
         10 Linux IA (32-bit)                                                  Little
         11 Linux IA (64-bit)                                                  Little   

         12 Microsoft Windows x86 64-bit                             Little
         13 Linux x86 64-bit                                                 Little
         15 HP Open VMS                                                     Little
         16 Apple Mac OS                                                      Big
         17 Solaris Operating System (x86)                           Little
         18 IBM Power Based Linux                                       Big
         19 HP IA Open VMS                                                Little
         20 Solaris Operating System (x86-64)                     Little
         21 Apple Mac OS (x86-64)                                        Little

 

2:我在做恢复的前一晚做了一个rman0级备份(OPEN状态下),备份包括(所有的数据文件,控制文件,参数文件,归档日志),以下是备份脚本。

run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
backup incremental level=0 database format 'e:\rmanbackup\data_%T_%s_%p';
backup archivelog all format 'e:\rmanbackup\log_%T_%s_%p' delete all input;
backup current controlfile format 'e:\rmanbackup\ctl_%T_%s_%p';
backup spfile format 'e:\rmanbackup\spfile_%T_%s_%p';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}

3:将备份级拷贝到目标服务器(Linux)

4:在目标服务器(Linux)只安装数据库软件(11.0.2.0.1)

 

恢复开始

1:首先连接rman

[oracle@R21-CORE-DL380-03 ~]$ rman target /  

2:启动到nomount,虽然我们的dbs目录下没有任何的参数文件,但是数据库依然可以启动到nomoun阶段

RMAN> startup nomount     

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/app/dbs/initccxe.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     313159680 bytes

Fixed Size                                 2212936 bytes
Variable Size                            109054904 bytes
Database Buffers                    197132288 bytes
Redo Buffers                            4759552 bytes

3:设置源数据库DBID,目的是可以使备份文件被识别。

RMAN> set DBID=3002354117 

4:将spfile在备份级内恢复到dbs目录下

RMAN> restore spfile to '/opt/app/oracle/dbs/spfileccxe.ora' from '/var/tools/test/SPFILE_20110705_189_1'; 

5:连接到sqlplus

[oracle@R21-CORE-DL380-03 ~]$ sqlplus / as sysdba

6:生成纯文本参数文件

SQL> create pfile from spfile; 

7:到dbs目录下修改纯文本参数文件,将红色字体标注的文件夹创建,并修改路径。

[oracle@R21-CORE-DL380-03 ~]$ vim initccxe.ora 

ccxe.__db_cache_size=4043309056
ccxe.__java_pool_size=16777216
ccxe.__large_pool_size=16777216
ccxe.__oracle_base='/opt/app'#ORACLE_BASE set from environment
ccxe.__pga_aggregate_target=4227858432
ccxe.__sga_target=6442450944
ccxe.__shared_io_pool_size=0
ccxe.__shared_pool_size=2197815296
ccxe.__streams_pool_size=117440512
*.audit_file_dest='/opt/app/admin/CCXE/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/opt/app/oradata/CCXE/control01.ctl','/opt/app/flash_recovery_area/CCXE/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='CCXE'
*.db_recovery_file_dest='/opt/app/flash_recovery_area'
*.db_recovery_file_dest_size=4102029312
*.diagnostic_dest='/opt/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=CCXEXDB)'
*.log_archive_dest_1='location=/opt/app/archive_log'
*.log_archive_max_processes=10
*.memory_max_target=10663676416
*.memory_target=10663676416
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=3221225472
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=6442450944
*.sga_target=6442450944
*.streams_pool_size=117440512
*.undo_tablespace='UNDOTBS1'
[oracle@R21-CORE-DL380-03 app]$ mkdir -p admin/CCXE/adump
[oracle@R21-CORE-DL380-03 app]$ mkdir -p oradata/CCXE/
[oracle@R21-CORE-DL380-03 app]$ mkdir -p flash_recovery_area/CCXE/

8:使用新的参数文件重启数据库到nomount状态。

SQL> startup force nomount pfile=/opt/app/oracle/dbs/initCCXE.ora

ORACLE instance started.

Total System Global Area 6413680640 bytes
Fixed Size                  2213776 bytes
Variable Size            1342179440 bytes
Database Buffers         5033164800 bytes
Redo Buffers               36122624 bytes

9:根据参数文件内的路径将控制文件恢复到指定的目录,并把数据库启动到mount状态。

RMAN> restore controlfile to '/opt/oracle/oradata/CCXE/control01.ctl' from '/var/tools/test/CTL_20110706_191_1'
RMAN> restore controlfile to '/opt/app/flash_recovery_area/CCXE/control02.ctl' from '/var/tools/test/CTL_20110706_191_1'
SQL> alter database mount;
Database altered.

10:将备份级的路径记录到控制文件内 

RMAN>  catalog start with '/var/tools/test';

Starting implicit crosscheck backup at 05-JUL-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=114 device type=DISK
Crosschecked 21 objects
Finished implicit crosscheck backup at 05-JUL-11

Starting implicit crosscheck copy at 05-JUL-11
using channel ORA_DISK_1
Finished implicit crosscheck copy at 05-JUL-11

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /var/tools/test

List of Files Unknown to the Database
=====================================
File Name: /var/tools/test/CTL_20110705_187_1
File Name: /var/tools/test/DATA_20110704_176_1
File Name: /var/tools/test/DATA_20110704_177_1
File Name: /var/tools/test/DATA_20110704_178_1
File Name: /var/tools/test/DATA_20110704_179_1
File Name: /var/tools/test/DATA_20110704_180_1
File Name: /var/tools/test/DATA_20110704_181_1
File Name: /var/tools/test/DATA_20110704_182_1
File Name: /var/tools/test/DATA_20110704_183_1
File Name: /var/tools/test/SPFILE_20110705_189
_1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /var/tools/test/CTL_20110705_187_1
File Name: /var/tools/test/DATA_20110704_176_1
File Name: /var/tools/test/DATA_20110704_177_1
File Name: /var/tools/test/DATA_20110704_178_1
File Name: /var/tools/test/DATA_20110704_179_1
File Name: /var/tools/test/DATA_20110704_180_1
File Name: /var/tools/test/DATA_20110704_181_1
File Name: /var/tools/test/DATA_20110704_182_1
File Name: /var/tools/test/DATA_20110704_183_1
File Name: /var/tools/test/SPFILE_20110705_189_1

11:我们可以查看一下备份级是否已经记录到当前的控制文件内(/var/tools/test/DATA_20110704_176_1)

RMAN> list backup;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
178     Full    12.20M     DISK        00:00:00     05-JUL-11     
        BP Key: 186   Status: AVAILABLE  Compressed: NO  Tag: TAG20110705T092644
        Piece Name: /var/tools/test/CTL_20110705_187_1
  Control File Included: Ckp SCN: 2620054106   Ckp time: 05-JUL-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
179     Full    161.05G    DISK        00:00:00     04-JUL-11     
        BP Key: 187   Status: AVAILABLE  Compressed: NO  Tag: TAG20110704T194021
        Piece Name:
/var/tools/test/DATA_20110704_176_1
  List of Datafiles in backup set 179
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 2615918511 04-JUL-11 D:\ORACLEDATA\JYDB02.DBF
  8       Full 2615918511 04-JUL-11 D:\ORACLEDATA\JYDB04.DBF
  16      Full 2615918511 04-JUL-11 D:\ORACLEDATA\JYDB012.DBF
  17      Full 2615918511 04-JUL-11 D:\ORACLEDATA\TRANUSER01.DBF
  26      Full 2615918511 04-JUL-11 D:\ORACLEDATA\TRANUSER08.DBF
  29      Full 2615918511 04-JUL-11 D:\ORACLEDATA\TRANUSER10.DBF
  44      Full 2615918511 04-JUL-11 D:\ORACLEDATA\JYDB19.DBF
  53      Full 2615918511 04-JUL-11 D:\ORACLEDATA\JYDB21.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
180     Full    128.38G    DISK        00:00:00     04-JUL-11     
        BP Key: 188   Status: AVAILABLE  Compressed: NO  Tag: TAG20110704T194021
        Piece Name: /var/tools/test/DATA_20110704_177_1
  List of Datafiles in backup set 180
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3       Full 2615918911 04-JUL-11 D:\APP\ADMINISTRATOR\ORADATA\CCXE\UNDOTBS01.DBF
  11      Full 2615918911 04-JUL-11 D:\ORACLEDATA\JYDB07.DBF
  28      Full 2615918911 04-JUL-11 D:\ORACLEDATA\JYDB015.DBF
  30      Full 2615918911 04-JUL-11 D:\ORACLEDATA\TRANUSER11.DBF
  36      Full 2615918911 04-JUL-11 D:\ORACLEDATA\TRANUSER17.DBF
  47      Full 2615918911 04-JUL-11 D:\ORACLEDATA\JYDB21
  55      Full 2615918911 04-JUL-11 D:\ORACLEDATA\TRANUSER23.DBF
  57      Full 2615918911 04-JUL-11 D:\ORACLEDATA\SCHEDULE01.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
181     Full    123.15G    DISK        00:00:00     04-JUL-11     
        BP Key: 189   Status: AVAILABLE  Compressed: NO  Tag: TAG20110704T194021
        Piece Name: /var/tools/test/DATA_20110704_178_1
  List of Datafiles in backup set 181
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  14      Full 2615919574 04-JUL-11 D:\ORACLEDATA\JYDB010.DBF
  32      Full 2615919574 04-JUL-11 D:\ORACLEDATA\TRANUSER13.DBF
  35      Full 2615919574 04-JUL-11 D:\ORACLEDATA\TRANUSER16.DBF
  42      Full 2615919574 04-JUL-11 D:\ORACLEDATA\JYDB18.DBF
  45      Full 2615919574 04-JUL-11 D:\ORACLEDATA\JYETL01.DBF
  50      Full 2615919574 04-JUL-11 D:\ORACLEDATA\TRANUSER22
  56      Full 2615919574 04-JUL-11 D:\ORACLEDATA\CCX01.DBF
  60      Full 2615919574 04-JUL-11 E:\ORACLEDATA\TRANIDX01.DBF

12:虽然备份级已经被记录到了当前的控制文件内,但是数据文件的路径依旧显示的是Windows下的路径。

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
D:\APP\ADMINISTRATOR\ORADATA\CCXE\SYSTEM01.DBF
D:\APP\ADMINISTRATOR\ORADATA\CCXE\SYSAUX01.DBF
D:\APP\ADMINISTRATOR\ORADATA\CCXE\UNDOTBS01.DBF
D:\APP\ADMINISTRATOR\ORADATA\CCXE\USERS01.DBF
D:\ORACLEDATA\JYDB01.DBF
D:\ORACLEDATA\JYDB02.DBF
D:\ORACLEDATA\JYDB03.DBF
D:\ORACLEDATA\JYDB04.DBF
D:\ORACLEDATA\JYDB05.DBF
D:\ORACLEDATA\JYDB06.DBF
D:\ORACLEDATA\JYDB07.DBF

13:连接到Rman,将数据文件的新路径刻录到控制文件内,并恢复数据库。

run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
SET NEWNAME FOR DATAFILE 1 TO '/opt/oracle/oradata/CCXE/SYSTEM01.DBF';
SET NEWNAME FOR DATAFILE 2 TO '/opt/oracle/oradata/CCXE/SYSAUX01.DBF';
SET NEWNAME FOR DATAFILE 3 TO '/opt/oracle/oradata/CCXE/UNDOTBS01.DBF';
SET NEWNAME FOR DATAFILE 4 TO '/opt/oracle/oradata/CCXE/USERS01.DBF';
SET NEWNAME FOR DATAFILE 5 TO '/opt/oracle/oradata/CCXE/JYDB01.DBF';
SET NEWNAME FOR DATAFILE 6 TO '/opt/oracle/oradata/CCXE/JYDB02.DBF';
SET NEWNAME FOR DATAFILE 7 TO '/opt/oracle/oradata/CCXE/JYDB03.DBF';
SET NEWNAME FOR DATAFILE 8 TO '/opt/oracle/oradata/CCXE/JYDB04.DBF';
SET NEWNAME FOR DATAFILE 9 TO '/opt/oracle/oradata/CCXE/JYDB05.DBF';
SET NEWNAME FOR DATAFILE 10 TO '/opt/oracle/oradata/CCXE/JYDB06.DBF';
SET NEWNAME FOR DATAFILE 11 TO '/opt/oracle/oradata/CCXE/JYDB07.DBF';
SET NEWNAME FOR DATAFILE 12 TO '/opt/oracle/oradata/CCXE/JYDB08.DBF';
SET NEWNAME FOR DATAFILE 13 TO '/opt/oracle/oradata/CCXE/JYDB09.DBF';
SET NEWNAME FOR DATAFILE 14 TO '/opt/oracle/oradata/CCXE/JYDB010.DBF';
SET NEWNAME FOR DATAFILE 15 TO '/opt/oracle/oradata/CCXE/JYDB011.DBF';
SET NEWNAME FOR DATAFILE 16 TO '/opt/oracle/oradata/CCXE/JYDB012.DBF';
SET NEWNAME FOR DATAFILE 17 TO '/opt/oracle/oradata/CCXE/TRANUSER01.DBF';
SET NEWNAME FOR DATAFILE 18 TO '/opt/oracle/oradata/CCXE/JYDB013.DBF';
SET NEWNAME FOR DATAFILE 19 TO '/opt/oracle/oradata/CCXE/TRANUSER02.DBF';
SET NEWNAME FOR DATAFILE 20 TO '/opt/oracle/oradata/CCXE/TRANUSER03.DBF';
SET NEWNAME FOR DATAFILE 21 TO '/opt/oracle/oradata/CCXE/TRANUSER04.DBF';
SET NEWNAME FOR DATAFILE 22 TO '/opt/oracle/oradata/CCXE/JYDB014.DBF';
SET NEWNAME FOR DATAFILE 23 TO '/opt/oracle/oradata/CCXE/TRANUSER05.DBF';
SET NEWNAME FOR DATAFILE 24 TO '/opt/oracle/oradata/CCXE/TRANUSER06.DBF';
SET NEWNAME FOR DATAFILE 25 TO '/opt/oracle/oradata/CCXE/TRANUSER07.DBF';
SET NEWNAME FOR DATAFILE 26 TO '/opt/oracle/oradata/CCXE/TRANUSER08.DBF';
SET NEWNAME FOR DATAFILE 27 TO '/opt/oracle/oradata/CCXE/TRANUSER09.DBF';
SET NEWNAME FOR DATAFILE 28 TO '/opt/oracle/oradata/CCXE/JYDB015.DBF';
SET NEWNAME FOR DATAFILE 29 TO '/opt/oracle/oradata/CCXE/TRANUSER10.DBF';
SET NEWNAME FOR DATAFILE 30 TO '/opt/oracle/oradata/CCXE/TRANUSER11.DBF';
SET NEWNAME FOR DATAFILE 31 TO '/opt/oracle/oradata/CCXE/TRANUSER12.DBF';
SET NEWNAME FOR DATAFILE 32 TO '/opt/oracle/oradata/CCXE/TRANUSER13.DBF';
SET NEWNAME FOR DATAFILE 33 TO '/opt/oracle/oradata/CCXE/TRANUSER14.DBF';
SET NEWNAME FOR DATAFILE 34 TO '/opt/oracle/oradata/CCXE/TRANUSER15.DBF';
SET NEWNAME FOR DATAFILE 35 TO '/opt/oracle/oradata/CCXE/TRANUSER16.DBF';
SET NEWNAME FOR DATAFILE 36 TO '/opt/oracle/oradata/CCXE/TRANUSER17.DBF';
SET NEWNAME FOR DATAFILE 37 TO '/opt/oracle/oradata/CCXE/TRANUSER18.DBF';
SET NEWNAME FOR DATAFILE 38 TO '/opt/oracle/oradata/CCXE/TRANUSER19.DBF';
SET NEWNAME FOR DATAFILE 39 TO '/opt/oracle/oradata/CCXE/TRANUSER20.DBF';
SET NEWNAME FOR DATAFILE 40 TO '/opt/oracle/oradata/CCXE/JYDB16.DBF';
SET NEWNAME FOR DATAFILE 41 TO '/opt/oracle/oradata/CCXE/JYDB17.DBF';
SET NEWNAME FOR DATAFILE 42 TO '/opt/oracle/oradata/CCXE/JYDB18.DBF';
SET NEWNAME FOR DATAFILE 43 TO '/opt/oracle/oradata/CCXE/JYDB20.DBF';
SET NEWNAME FOR DATAFILE 44 TO '/opt/oracle/oradata/CCXE/JYDB19.DBF';
SET NEWNAME FOR DATAFILE 45 TO '/opt/oracle/oradata/CCXE/JYETL01.DBF';
SET NEWNAME FOR DATAFILE 46 TO '/opt/oracle/oradata/CCXE/UNDOTBS02.DBF';
SET NEWNAME FOR DATAFILE 47 TO '/opt/oracle/oradata/CCXE/JYDB21';
SET NEWNAME FOR DATAFILE 48 TO '/opt/oracle/oradata/CCXE/TRANUSER21';
SET NEWNAME FOR DATAFILE 49 TO '/opt/oracle/oradata/CCXE/JYDB22';
SET NEWNAME FOR DATAFILE 50 TO '/opt/oracle/oradata/CCXE/TRANUSER22';
SET NEWNAME FOR DATAFILE 51 TO '/opt/oracle/oradata/CCXE/JYDB23';
SET NEWNAME FOR DATAFILE 52 TO '/opt/oracle/oradata/CCXE/JYDB24.DBF';
SET NEWNAME FOR DATAFILE 53 TO '/opt/oracle/oradata/CCXE/JYDB21.DBF';
SET NEWNAME FOR DATAFILE 54 TO '/opt/oracle/oradata/CCXE/JYDB22.DBF';
SET NEWNAME FOR DATAFILE 55 TO '/opt/oracle/oradata/CCXE/TRANUSER23.DBF';
SET NEWNAME FOR DATAFILE 56 TO '/opt/oracle/oradata/CCXE/CCX01.DBF';
SET NEWNAME FOR DATAFILE 57 TO '/opt/oracle/oradata/CCXE/SCHEDULE01.DBF';
SET NEWNAME FOR DATAFILE 58 TO '/opt/oracle/oradata/CCXE/TRANUSER24.DBF';
SET NEWNAME FOR DATAFILE 59 TO '/opt/oracle/oradata/CCXE/TRANUSER25.DBF';
SET NEWNAME FOR DATAFILE 60 TO '/opt/oracle/oradata/CCXE/TRANIDX01.DBF';
SET NEWNAME FOR DATAFILE 61 TO '/opt/oracle/oradata/CCXE/TRANIDX02.DBF';
restore database;
switch datafile all;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}

未完待续

这个实验先写到这里,因为到这步后就是RECOVER DATABASE 和 ALTER DATABASE OPEN RESETLOGS  的步骤,也是出错最多的两个步骤,我现在正在整理排错的文档,我不希望马马虎虎的结束这篇文章,等整理好文档后,我会继续把这个“残缺”的文章补全,以上的恢复步骤如有其他问题,希望得到各位朋友的指点与批评。

你可能感兴趣的:(工作文档)