ITPub博客

首页 > 数据库 > Oracle > 【数据迁移1】Oracle 10gR2 rman异机恢复实验(FS->RAW)(2)

【数据迁移1】Oracle 10gR2 rman异机恢复实验(FS->RAW)(2)

原创 Oracle 作者:xunzhaoxz 时间:2011-07-23 15:06:47 0 删除 编辑

【数据迁移1】Oracle 10gR2 rman异机恢复实验(FS->RAW)(2)

转载请注明原文:http://xunzhaoxz.itpub.net/post/40016/521239

PDF版详细恢复步骤(截图)

【数据迁移2】Oracle 10gR2 rman异机恢复实验(FS-FS)(截图)

上接:【数据迁移1】Oracle 10gR2 rman异机恢复实验(FS->RAW)(1http://xunzhaoxz.itpub.net/post/40016/521239

3.11. restore and recover database

3.11.1. 编写rman脚本

根据实际需要,可以在这里指明要恢复到某个SCN号或者时间点, 也可以进行全库恢复。SCN号可以从旧库rmanlist backup 获得,或者如果有catalog的话,也可以从catalog中获得;也可以指定恢复到某个时间点。

[oracle@Ora_tar oracle]$ cat restore.rman

run

{set until scn 556840;

restore database;

recover database;

}

exit

[oracle@Ora_tar oracle]$

3.11.2. 执行rman恢复脚本

[@more@]

RMAN> @/oracle/restore_raw.rman

RMAN> run

2> {

3> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_users_6ccmb0x6_.dbf' TO '/oracle/oradata/oradb/user_128m';

4> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_sysaux_6ccmb0pf_.dbf' TO '/oracle/oradata/oradb/sysaux_512m';

5> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_undotbs1_6ccmb0w4_.dbf' TO '/oracle/oradata/oradb/undo01_512m';

6> SET NEWNAME FOR DATAFILE '/oracle/oradata/ORADB/datafile/o1_mf_system_6ccmb0oy_.dbf' TO '/oracle/oradata/oradb/system_1g';

7> restore database;

8> switch datafile all;

9> recover database;

10> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2010-11-15 15:00:20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /oracle/oradata/oradb/system_1g

restoring datafile 00002 to /oracle/oradata/oradb/undo01_512m

restoring datafile 00003 to /oracle/oradata/oradb/sysaux_512m

restoring datafile 00004 to /oracle/oradata/oradb/user_128m

channel ORA_DISK_1: reading from backup piece /oracle/oradb-20101114-1jlt0ptg_1_1.rman

channel ORA_DISK_1: restored backup piece 1

piece handle=/oracle/oradb-20101114-1jlt0ptg_1_1.rman tag=TAG20101114T202520

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

Finished restore at 2010-11-15 15:01:27

datafile 4 switched to datafile copy

input datafile copy recid=7 stamp=735145287 filename=/oracle/oradata/oradb/user_128m

datafile 3 switched to datafile copy

input datafile copy recid=8 stamp=735145287 filename=/oracle/oradata/oradb/sysaux_512m

datafile 2 switched to datafile copy

input datafile copy recid=9 stamp=735145287 filename=/oracle/oradata/oradb/undo01_512m

datafile 1 switched to datafile copy

input datafile copy recid=10 stamp=735145287 filename=/oracle/oradata/oradb/system_1g

Starting recover at 2010-11-15 15:01:28

using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=36

channel ORA_DISK_1: reading from backup piece /oracle/oradb-archlogall-20101114-1llt0q2m_1_1.rman

channel ORA_DISK_1: restored backup piece 1

piece handle=/oracle/oradb-archlogall-20101114-1llt0q2m_1_1.rman tag=TAG20101114T202804

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

archive log filename=/oracle/oradata/oradb/archivelog/1_36_732323841.dbf thread=1 sequence=36

unable to find archive log

archive log thread=1 sequence=37

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

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

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

RMAN-03002: failure of recover command at 11/15/2010 15:01:34

RMAN-06054: media recovery requesting unknown log: thread 1 seq 37 lowscn 597055

RMAN> exit

Recovery Manager complete.

[oracle@Ora_tar mapper]$

3.12. open database

RMAN> alter database open resetlogs;

using target database control file instead of recovery catalog

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

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

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

RMAN-03002: failure of alter db command at 11/15/2010 15:02:04

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-39700: database must be opened with UPGRADE option

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

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

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

ORA-03114: not connected to ORACLE

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

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

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

RMAN-03002: failure of alter db command at 11/15/2010 15:02:04

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-39700: database must be opened with UPGRADE option

[oracle@Ora_tar mapper]$

3.13. 升级数据库

3.13.1. shutdown 数据库

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

3.13.2. 修改pfile中控制文件路径为新控制文件

控制文件为3.8中恢复出来的/oracle/oradata/ORADB/controlfile/o1_mf_6fjh5m9c_.ctl

[oracle@Ora_tar oracle]$ vi /oracle/oradata/initoradb.ora

3.13.3. 以修改后的pfile启动数据库

[oracle@Ora_tar oracle]$sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 9 02:26:34 2010

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

Connected to an idle instance.

SQL> startup pfile='/oracle/oradata/initoradb.ora';

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1218292 bytes

Variable Size 83888396 bytes

Database Buffers 75497472 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL>

3.13.4. 创建新的spfile

spfile将自动存放到oracle默认路径($ORACLE_HOME/dbs)下,并自动命名为spfileSID.ora,数据库启动将优先使用该参数文件。

SQL> create spfile from pfile='/oracle/oradata/initoradb.ora';

shutdown数据库,下次直接startup就可以启动了

[oracle@Ora_tar oracle]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 9 02:32:39 2010

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

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1218292 bytes

Variable Size 83888396 bytes

Database Buffers 75497472 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL>

3.14. 检查、测试数据是否已恢复成功

[oracle@Oradb1 response]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Nov 16 10:15:28 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup upgrade

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1266368 bytes

Variable Size 79695168 bytes

Database Buffers 79691776 bytes

Redo Buffers 7118848 bytes

Database mounted.

Database opened.

SQL> spool /oracle/upgrade_info_20101116.log

#运行预升级检查脚本utlu102i.sqlRun the Pre-Upgrade Information Tool

SQL> @?/rdbms/admin/utlu102i.sql

Oracle Database 10.2 Upgrade Information Utility 11-16-2010 10:19:20

.**********************************************************************

Database:

**********************************************************************

--> name: ORADB

--> version: 10.2.0.1.0

--> compatible: 10.2.0.1.0

--> blocksize: 8192

.**********************************************************************

Tablespaces: [make adjustments in the current environment]

**********************************************************************

--> SYSTEM tablespace is adequate for the upgrade.

.... minimum required size: 489 MB

.... AUTOEXTEND additional space required: 9 MB

--> UNDOTBS1 tablespace is adequate for the upgrade.

.... minimum required size: 403 MB

.... AUTOEXTEND additional space required: 378 MB

--> SYSAUX tablespace is adequate for the upgrade.

.... minimum required size: 258 MB

.... AUTOEXTEND additional space required: 8 MB

--> TEMP tablespace is adequate for the upgrade.

.... minimum required size: 58 MB

.... AUTOEXTEND additional space required: 38 MB

.**********************************************************************

Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]

**********************************************************************

WARNING: --> "pga_aggregate_target" needs to be increased to at least 25165824

.**********************************************************************

Renamed Parameters: [Update Oracle Database 10.2 init.ora or spfile]

**********************************************************************

-- No renamed parameters found. No changes are required.

.**********************************************************************

Obsolete/Deprecated Parameters: [Update Oracle Database 10.2 init.ora or spfile]

**********************************************************************

-- No obsolete parameters found. No changes are required

.**********************************************************************

Components: [The following database components will be upgraded or installed]

**********************************************************************

--> Oracle Catalog Views [upgrade] VALID

--> Oracle Packages and Types [upgrade] VALID

--> JServer JAVA Virtual Machine [upgrade] VALID

--> Oracle XDK for Java [upgrade] VALID

--> Oracle Java Packages [upgrade] VALID

--> Oracle Text [upgrade] VALID

--> Oracle XML Database [upgrade] VALID

--> Oracle Workspace Manager [upgrade] VALID

--> Oracle Data Mining [upgrade] VALID

--> OLAP Analytic Workspace [upgrade] VALID

--> OLAP Catalog [upgrade] VALID

--> Oracle OLAP API [upgrade] VALID

--> Oracle interMedia [upgrade] VALID

--> Spatial [upgrade] VALID

--> Expression Filter [upgrade] VALID

--> EM Repository [upgrade] VALID

--> Rule Manager [upgrade] VALID

.PL/SQL procedure successfully completed.

SQL> create pfile='/oracle/pfile-before-upgrade.ora' from spfile;

File created.

SQL>

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

在另一个窗口编辑pfile中的pga_aggregate_target参数以满足at least 25165824 的要求,编辑完成后使用该pfile创建相应的spfile,这个spfile就可以满足升级到10.2.0.4的要求了。

#以修改后的pfile启动数据库到nomount状态(在nomount状态就可以创建spfile了,而且现在也不能直接启动到open状态,会报ORA-01092: ORACLE instance terminated.ORA-39700: database must be opened with UPGRADE option.错误的)

SQL> startup nomount pfile='/oracle/pfile-before-upgrade.ora';

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1266368 bytes

Variable Size 79695168 bytes

Database Buffers 79691776 bytes

Redo Buffers 7118848 bytes

SQL> create spfile from pfile='/oracle/pfile-before-upgrade.ora';

#创建spfile

File created.

SQL>

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

#关闭数据库实例,并以新的spfile启动实例到带upgradeopen状态。

SQL> startup upgrade

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1266368 bytes

Variable Size 79695168 bytes

Database Buffers 79691776 bytes

Redo Buffers 7118848 bytes

Database mounted.

Database opened.

SQL>

SQL>

#记录升级日志到/oracle/patch1204_info_20101116.log文件

SQL> spool /oracle/patch1204_info_20101116.log

SQL>

SQL>

#执行catupgrd.sql进行升级(注意必须以sys用户运行此脚本)

SQL> @?/rdbms/admin/catupgrd.sql

DOC>######################################################################

DOC>######################################################################

DOC> The following statement will cause an "ORA-01722: invalid number"

DOC> error if the user running this script is not SYS. Disconnect

DOC> and reconnect with AS SYSDBA.

DOC>######################################################################

DOC>######################################################################

DOC>#

四、 附录

4.1. 问题1

RMAN> startup force nomount pfile='/oracle/oradata/initoradb.ora';

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

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

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

RMAN-03002: failure of startup command at 11/09/2010 01:18:14

RMAN-04014: startup failed: ORA-09925: Unable to create audit trail file

Linux Error: 2: No such file or directory

Additional information: 9925

RMAN>

对照pfile检查oracle相关的目录是否都已创建完成,本案例为$ORACLE_BASE/admin整个目录及其子目录都没有创建,因此出现以上报错信息,按照如下步骤创建后,再次执行以上命令就没有报错了。

$mkdir -p /oracle/admin/oradb/adump

$mkdir -p /oracle/admin/oradb/bdump

$mkdir -p /oracle/admin/oradb/cdump

$mkdir -p /oracle/admin/oradb/dpdump

$mkdir -p /oracle/admin/oradb/udump

$mkdir -p /oracle/admin/oradb/pfile

4.2. 问题2

无法找到存档日志

存档日志线程 =1 序列=11

RMAN-00571:

===========================================================

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

===============

RMAN-00571:

===========================================================

RMAN-03002: failure of recover command at 07/20/2007 17:50:36

RMAN-06054: media recovery requesting unknown log: thread 1 scn 143893

没有指定恢复到某个SCN号或者指定时间点,若是全库恢复,只要alter database open resetlogs即可。

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

延伸阅读

(近期整理文档):

主机AIX

【信息采集】IBM AIX系统硬件信息查看命令(shell脚本)(附PDF完整版下载)

操作规范(一)—— AIX rootvg mirror(附PDF下载)

AIX系统安全加固(一)限制密码重试次数,超过限制次数后锁定用户(附截图PDF完整版下载)

AIX平台下创建文件系统需要注意的问题

IBM服务器虚拟化PowerVM——也谈“云计算”

数据库Oracle

新装Oracle11gR2 11.2.0.2重要说明——Patchsetp10098816(附补丁下载地址)

Attention:new installation of Oracle 11.2.0.2

AIX 5.3/6.1环境下安装Oracle10gR2 RAC常见报错(注意事项)

【数据迁移1】Oracle10gR2 rman异机恢复实验(FS->RAW)(附截图PDF完整版下载)

【数据迁移2】Oracle10gR2 rman异机恢复实验(FS-FS)(附截图PDF完整版下载)

操作规范(二)——RHEL5.4安装Oracle 10.2.0.4(附截图PDF完整版下载)

操作规范(三)——Linux5.4安装Oracle 11gR1(附截图PDF完整版下载)

操作规范(四)——Linux5.4安装Oracle 11gR2(附截图PDF完整版下载)

Oracle RAC环境下重建ASM磁盘组(Re-createASM diskgroup)(附截图PDF完整版下载)

Oracle RAC srv服务“首选”与“可用”状态的调整——srvctl modify service 的使用(附截图PDF完整版下载)

Linux+ASM+OCFS环境下增加ORACLE RAC联机重做日志文件(附截图PDF完整版下载)

备份还原Symantec Netbackup:

搭建NBU实验环境——解决虚拟带库vistor License过期问题(附截图PDF完整版下载)

NBU常用命令1——介质管理

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22085031/viewspace-1054357/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-11-09

  • 博文量
    27
  • 访问量
    698539