日期:2014-05-16  浏览次数:20432 次

还原种子数据库练习
种子数据库的控制文件位置:
$ORACLE_HOME/assistants/dbca/templates/Seed_Database.ctl
种子数据库的备份片位置:
$ORACLE_HOME/assistants/dbca/templates/Seed_Database.dfb
大体步骤如下:
编辑一个pfile启动到nomount,然后通过控制文件启动到mount状态,恢复数据库文件,然后启动数据库

1.随便编辑一个pfile,只添加上Db_name和控制文件路径即可
[oracle@elvis-desktop dbs]$ vi initORCL.ora
db_name='ORCL'
control_files='/oracle/oradata/ORCL/control1.ctl'
2.定义一个ORACLE_SID,创建存放数据库文件的目录
[oracle@elvis-desktop dbs]$ export ORACLE_SID=ORCL
[oracle@elvis-desktop dbs]$ mkdir /oracle/oradata/ORCL/
3.把种子数据库的控制文件拷贝到pfile中的路径,并且修改成相应的名字,使用pfile启动到nomount状态
[oracle@elvis-desktop dbs]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Sep 5 13:45:33 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount pfile='/oracle/product/11.2.0/dbhome_1/dbs/initORCL.ora';
Oracle instance started
Total System Global Area 238034944 bytes
Fixed Size 2227136 bytes
Variable Size 180356160 bytes
Database Buffers 50331648 bytes
Redo Buffers 5120000 bytes
4.启动数据库到mount状态
RMAN> alter database mount;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 09/05/2013 13:52:32
ORA-01103: database name 'SEEDDATA' in control file is not 'ORCL'
------->>>此处报数据库的名字为SEEDDATA,将pfile中的db_name修改成SEEDDATA,重启数据库,启动到mount状态
[oracle@elvis-desktop dbs]$ vi initORCL.ora
db_name='SEEDDATA'
control_files='/oracle/oradata/ORCL/control01.ctl'
RMAN> alter database mount;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 09/05/2013 13:53:12
ORA-01103: database name 'SEEDDATA' in control file is not 'ORCL'
RMAN> shutdown abort;
Oracle instance shut down
RMAN> startup nomount pfile='/oracle/product/11.2.0/dbhome_1/dbs/initORCL.ora';
connected to target database (not started)
Oracle instance started
Total System Global Area 238034944 bytes
Fixed Size 2227136 bytes
Variable Size 180356160 bytes
Database Buffers 50331648 bytes
Redo Buffers 5120000 bytes
RMAN> alter database mount;
database mounted
5.注册数据库备份片的位置,开始恢复数据库
RMAN> catalog start with '/oracle/product/11.2.0/dbhome_1/assistants/dbca/templates/Seed_Database.dfb';
searching for all files that match the pattern /oracle/product/11.2.0/dbhome_1/assistants/dbca/templates/Seed_Database.dfb
List of Files Unknown to the Database
==============================