ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN 的全备份,放到一台新机器恢复

RMAN 的全备份,放到一台新机器恢复

原创 Linux操作系统 作者:c4313848 时间:2009-08-10 15:46:30 0 删除 编辑
测试环境: RHEL 4
数据库 :ORACLE 10.2.0.1

RMAN 全备份,包含控制文件自动备份(controlfile和spfile),归档日志的备份

       新机器上安装同版本的操作系统和 数据库。

1.设置DBID 。
    dbid 可以从控制文件自动备份,生成的控制备份中获得,
    例: c_3739672371-20090830-02  为生成的控制文件备份
             dbid 为 3739672371
===============================================================
[oracle@dbtest ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Aug 30 16:01:02 2009

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

connected to target database (not started)

RMAN> set dbid=3739672371

executing command: SET DBID

RMAN>
===============================================================

2.启动数据库到nomount状态,

===============================================================
RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u/app/oracle/product/10.2/db_1/dbs/initslshdb.ora'

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

Total System Global Area     159383552 bytes

Fixed Size                     2019224 bytes
Variable Size                 67108968 bytes
Database Buffers              83886080 bytes
Redo Buffers                   6369280 bytes

RMAN>
===============================================================

这个时候会报一些错误,可以看出是缺少参数文件引起的。
3. 恢复spfile文件

===============================================================
RMAN> restore spfile from '/backup/rman_bak/data/20090830/c-3739672371-20090830-02';

Starting restore at 30-AUG-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK

channel ORA_DISK_1: autobackup found: /backup/rman_bak/data/20090830/c-3739672371-20090830-02
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 30-AUG-09

RMAN>
===============================================================

4.关闭数据库,启动数据库到nomount状态,恢复控制文件
===============================================================
RMAN> shutdown immediate

Oracle instance shut down

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area    1224736768 bytes

Fixed Size                     2020384 bytes
Variable Size                301992928 bytes
Database Buffers             905969664 bytes
Redo Buffers                  14753792 bytes

RMAN>
===============================================================

这个时候spfile文件已经恢复,可以正常启动到nomount。下面为恢复控制文件
===============================================================
RMAN> restore controlfile from '/backup/rman_bak/data/20090830/c-3739672371-20090830-02';

Starting restore at 30-AUG-09
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/u/app/oracle/slshdb/control01.ctl
output filename=/u/app/oracle/slshdb/control02.ctl
output filename=/u/app/oracle/slshdb/control03.ctl
Finished restore at 30-AUG-09
===============================================================
mount数据库。
===============================================================
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1
===============================================================
5. RESTORE 数据文件:
===============================================================
RMAN> restore database;

Starting restore at 30-AUG-09
using channel ORA_DISK_1
....................
....................
channel ORA_DISK_1: restore complete, elapsed time: 00:03:55
Finished restore at 30-AUG-09
===============================================================
6.恢复 归档日志


===============================================================
RMAN> list backup of archivelog all;


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

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
172     4.39M      DISK        00:00:00     30-AUG-09     
        BP Key: 172   Status: AVAILABLE  Compressed: NO  Tag: TAG20090830T154659
        Piece Name: /backup/rman_bak/data/20090830/arch.20090830.5iko0d7k

  List of Archived Logs in backup set 172
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    1972    80199606   30-AUG-09 80206979   30-AUG-09

RMAN> restore archivelog from logseq 1972;

Starting restore at 30-AUG-09
using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=1972
channel ORA_DISK_1: reading from backup piece /backup/rman_bak/data/20090830/arch.20090830.5iko0d7k
channel ORA_DISK_1: restored backup piece 1
piece handle=/backup/rman_bak/data/20090830/arch.20090830.5iko0d7k tag=TAG20090830T154659
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 30-AUG-09

RMAN>

7. recover 数据库

===============================================================
RMAN> recover database;

Starting recover at 30-AUG-09
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 1972 is already on disk as file /u/app/oracle/archivelog/1_1972_685470134.dbf
archive log filename=/u/app/oracle/archivelog/1_1972_685470134.dbf thread=1 sequence=1972
unable to find archive log
archive log thread=1 sequence=1973
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/30/2009 16:27:24
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1973 lowscn 80206979

===============================================================
8.打开数据库

===============================================================
RMAN> alter database open resetlogs;

database opened
===============================================================

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

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

注册时间:2008-11-14

  • 博文量
    26
  • 访问量
    39031