/export/home1/oracle/oradata/ora9i
1. rman target /
2. set DBID 3200606094
3. startup nomount
4. restore spfile to pfile '/export/home1/oracle/dbs/initora9i.ora' from '/export/home2/ctl_c-3200606094-20110127-00';
5.exit
编辑initora9i.ora更改为如下配置:
6. rman target /
7.startup force nomount pfile='/oracle/oracle/product/9.0/dbs/initora9i.ora';
8.restore controlfile to '/export/home1/oracle/oradata/ora9i/control01.ctl' from '/export/home2/ctl_c-3200606094-20110127-00';
restore controlfile to '/export/home1/oracle/oradata/ora9i/control02.ctl' from '/export/home2/ctl_c-3200606094-20110127-00';
restore controlfile to '/export/home1/oracle/oradata/ora9i/control03.ctl' from '/export/home2/ctl_c-3200606094-20110127-00';
然后根据参数文件的control_files设置,复制相应的副本。
9.[oracle@localhost dbs]$ orapwd file=orapwora9i password=oracle entries=5
10.alter database mount;
11.RMAN> crosscheck backup;
12.RMAN> report schema;
13.run
{
set newname for datafile 1 to'/export/home1/oracle/oradata/ora9i/system01.dbf';
set newname for datafile 2 to '/export/home1/oracle/oradata/ora9i/undotbs01.dbf';
set newname for datafile 3 to '/export/home1/oracle/oradata/ora9i/cwmlite01.dbf';
set newname for datafile 4 to '/export/home1/oracle/oradata/ora9i/drsys01.dbf';
set newname for datafile 5 to '/export/home1/oracle/oradata/ora9i/example01.dbf';
set newname for datafile 6 to '/export/home1/oracle/oradata/ora9i/indx01.dbf';
set newname for datafile 7 to '/export/home1/oracle/oradata/ora9i/odm01.dbf';
set newname for datafile 8 to '/export/home1/oracle/oradata/ora9i/tools01.dbf';
set newname for datafile 9 to '/export/home1/oracle/oradata/ora9i/users01.dbf';
set newname for datafile 10 to '/export/home1/oracle/oradata/ora9i/xdb01.dbf';
set newname for datafile 11 to '/export/home1/oracle/oradata/ora9i/SCTBL.dbf';
set newname for datafile 12 to '/export/home1/oracle/oradata/ora9i/CSTBL.dbf';
set newname for datafile 13 to '/export/home1/oracle/oradata/ora9i/SCSK.dbf';
set newname for datafile 14 to '/export/home1/oracle/oradata/ora9i/SHICAI.dbf';
set newname for datafile 15 to '/export/home1/oracle/oradata/ora9i/SK_SC.dbf';
set newname for datafile 17 to '/export/home1/oracle/oradata/ora9i/SKZY.dbf';
restore database;
switch datafile all;
}
14.十一、数据文件恢复出来以后,可以对数据库应用归档日志进行恢复
RMAN> recover database;
建立与原文件目录相同的/oracle/oradata/oracle9i/redo1.log //在线的日志目录
如果不能recover database则以:
RMAN> alter database open resetlogs;
注意:如果需要的话可能会修改控制文件中redo文件的位置(原来的路径与现在路径不相同的时候),然后重建。
14.
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash-3.00$ cp /oracle/oracle/oradata/ora9i/redo03.log /export/home1/oracle/oradata/oracle9i/redo03.log
-bash-3.00$ cp /oracle/oracle/oradata/oracle9i/redo01.log /export/home1/oracle/oradata/ora9i/redo01.log
-bash-3.00$ cp /oracle/oracle/oradata/oracle9i/redo01.log /export/home1/oracle/oradata/ora9i/redo02.log
-bash-3.00$ sqlplus /nolog
SQL*Plus: Release 9.2.0.1.0 - Production on 星期四 12月 9 13:19:09 2010
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 323978328 bytes
Fixed Size 730200 bytes
Variable Size 285212672 bytes
Database Buffers 33554432 bytes
Redo Buffers 4481024 bytes
Database mounted.
SQL> alter database
2 rename file '/oracle/oracle/oradata/oracle9i/redo03.log',
3 '/oracle/oracle/oradata/oracle9i/redo02.log',
4 '/oracle/oracle/oradata/oracle9i/redo01.log'
5 to
6 '/export/home1/oracle/oradata/ora9i/redo03.log',
7 '/export/home1/oracle/oradata/ora9i/redo02.log',
8 '/export/home1/oracle/oradata/ora9i/redo01.log';
Database altered.
SQL> alter database open;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> select * from v$logfile;
GROUP# STATUS TYPE
---------- ------- -------
MEMBER
--------------------------------------------------------------------------------
3 ONLINE
/oracle/oracle/oradata/oracle9i/redo03.log
2 STALE ONLINE
/oracle/oracle/oradata/oracle9i/redo02.log
1 ONLINE
/oracle/oracle/oradata/oracle9i/redo01.log
SQL> alter tablespace temp add tempfile '/export/home1/oracle/oradata/ora9i/temp01.dbf' size 1024m reuse;
SQL> alter tablespace cstmp add tempfile '/export/home1/oracle/oradata/ora9i/cstmp.dbf' size 1024m reuse;
SQL> alter tablespace sctmp add tempfile '/export/home1/oracle/oradata/ora9i/sctmp.dbf' size 1024m reuse;
SQL> alter tablespace scsk_tmp add tempfile '/export/home1/oracle/oradata/ora9i/scsk_tmp.dbf' size 1024m reuse;
SQL> alter tablespace temp add tempfile '/export/home1/oracle/oradata/ora9i/temp01.dbf' size 1024m reuse;