分类: Oracle
2008-10-12 10:10:49
=========================================BEGING===============================================
在异机还原数据库备份.
注意:
1,需要最后一个数据库的完整备份以及这个备份之后的所有归档日志文件,以及需要知道原库的dbid是多少.---3376524736
2,在还原之前先建一个同名的数据库.shutdown immediate把所有的数据文件,控制文件,redo文件都删除掉.
恢复步骤:
1,进入nomount模式.
2,进入rman set dbid=旧库的dbid---------rman控制文件代替恢复目录
3,恢复控制文件
4,切入mount模式.
alter database set standby database to maximize performance;---(这步是DataGuard数据保护模式的最高性能模式
有在DataGuard下要记得这步)
+++++++++++++++++++++一定要记得这步
在restore database之前先把过期的文件清除掉
crosscheck backup --- delete expired backup;
crosscheck copy --- archivelog信息 delete copy;
+++++++++++++
5,指定备份文件.catalog backuppiece 'c:\xxx\xxx.bap'.---catalog start with '备份集的路径';这步也一定要
6,还原数据文件, restore database;
7,恢复到同一时间点,recover database;
+++++++++++++++++++++++++++++---如果有错误.
run {
2> set until sequence 24455;
3> recover database;
4> }
8,打开数据库,alter database open resetlogs;
操作过程如下:
C:\Documents and Settings\Administrator>rman target /
RMAN> set dbid=2945100590
RMAN> restore controlfile from 'C:\oracle\product\10.2.0\oradata\zgr\bak\20080716_ZGR_CTL_0KJLK88H_1_1.BKP';
RMAN> sql'alter system set wallet open identified by "**"';
RMAN> alter database mount;
先做下crosscheck ---delect 工作
RMAN> catalog start with '备份集的路径';---list backup of database 建相关目录
select 'set newname for datafile '|| v1.file# || ' to ''/mnt'||v1.name|| ''';' as cmd
from
(
select
file#,name
from
v$datafile
) v1;
RMAN> run{
set newname for datafile 1 to '/mnt/systm01.dbf';
set newname for datafile 3 to '/mnt/sysux01.dbf';
set newname for datafile 4 to '/mnt/user01.dbf';
set newname for datafile 5 to '/mnt/dbpy01.dbf';
set newname for datafile 6 to '/mnt/dbys02.dbf';
set newname for datafile 7 to '/mnt/logp20081001.dbf';
set newname for datafile 8 to '/mnt/dbpys03.dbf';
set newname for datafile 10 to '/mnt/log0081002.dbf';
set newname for datafile 11 to '/mnt/unotbs01.dbf';
set newname for datafile 12 to '/mnt/tbsdx02.dbf';
set newname for datafile 13 to '/mnt/lgp20081003.dbf';
set newname for datafile 14 to '/mnt/tbsidx01.dbf';
restore database validate ---- 可选
alter database rename file ' ' to ' ' ; --- 改变日志文件的路径,名称 ---- 可选
restore database;
switch datafile all;
}
代替---RMAN> restore database;
RMAN> recover database ;
RMAN> alter database open resetlogs ;
==========================================END===============================================
v$datafile select max(checkpoint_change#) 控制文件号
v$datafile_header select max(checkpoint_change#) 真正的数据文件号
在restore database之前先把过期的文件清除掉
crosscheck backup --- delete ---expired--- backup;
crosscheck copy --- archivelog信息 delete copy;
注册备份片和备份集:catalog start with '/home/oracle/backup/db';
把信息传到原数据库的controlfile中
如果有恢复目录, 则传到恢复目录中..
select file#,checkpoint_change# from v$datafile_header;
RMAN> list backup of archivelog all;
RMAN> list backup of archivelog sequence 24455;
RMAN> list backup of database;
RMAN> run {
2> set until sequence 24455;
3> recover database;
4> }
------------------------------------------------------------------
undo.dbf丢失 又没备份
首先 进入到 初始化参数文件 编辑 将undo_management='AUTO'改为 undo_management='MANUAL';
然后进入mount状态下 alter database datafile 11 offline drop;------因为是机器运行时丢失,所以用这步
最后alter database open;
也可以重新建立 undo表空间,重新改为自动-------不建议这样做
装载NFS: mount -o bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,nfsvers=3 192.168.27.7:/nfs /rac
rman 目标数据库控制文件替代恢复目录