1 追加归档形式恢复数据库
1.1 一 RMAN 配置信息:
RMAN> show all;
正在使用目标数据库控制文件替代恢复目录 RMAN 配置参数为:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\\arch\\%F'; CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:\\ORACLE\\PRODUCT\\10.1.0\\DB_1\\DATABASE\\S NCFORCL.ORA'; # default
1.2 二 删除归档空间现有全部归档日志
D:
Cd archlog Delete *
三 数据库进行全备份:
Backup full database format ‘d:\\arch\\%t_%s’; 三系统切换日志
Alter system archive log current; Alter system archive log current; Alter system archive log current; Alter system archive log current; Alter system archive log current; Alter system archive log current;
备份文件和归档日志如下:
1.3 将归档日志剪切到arctest 目录:
现况如下:
1.4 分批次恢复 1.5 恢复控制文件:
Microsoft Windows XP [版本 5.1.2600] (C) 版权所有 1985-2001 Microsoft Corp.
C:\\Documents and Settings\\liruilong>sqlplus \
SQL*Plus: Release 10.1.0.2.0 - Production on 星期五 3月 25 19:26:18 2011
Copyright (c) 1982, 2004, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate; ORA-01109: 数据库未打开
已经卸载数据库。
ORACLE 例程已经关闭。 SQL> startup nomount;
ORACLE 例程已经启动。
Total System Global Area 171966464 bytes Fixed Size 787988 bytes Variable Size 145488364 bytes Database Buffers 25165824 bytes Redo Buffers 524288 bytes SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production With the Partitioning, OLAP and Data Mining options 断开
C:\\Documents and Settings\\liruilong>rman target /
恢复管理器: 版本10.1.0.2.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.
连接到目标数据库: orcl (未装载)
RMAN> restore controlfile to 'C:\\oracle\\product\\10.1.0\\oradata\\orcl\\CONTROL01.CT L' form 'D:\\arch\\C-1254907373-20110325-00';
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found \nnel, check, controlfile, clone, database, datafile, device, from, force, high, (, preview, ;, spfile, standby, tablespace, until, validate\RMAN-01008: the bad identifier was: form
RMAN-01007: at line 1 column 78 file: standard input
RMAN> restore controlfile to 'C:\\oracle\\product\\10.1.0\\oradata\\orcl\\CONTROL01.CT L' from 'D:\\arch\\C-1254907373-20110325-00';
启动 restore 于 25-3月 -11
正在使用目标数据库控制文件替代恢复目录 分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=160 devtype=DISK
通道 ORA_DISK_1: 正在恢复控制文件 通道 ORA_DISK_1: 恢复完成 完成 restore 于 25-3月 -11
RMAN> restore controlfile to 'C:\\oracle\\product\\10.1.0\\oradata\\orcl\\CONTROL02.CT L' from 'D:\\arch\\C-1254907373-20110325-00';
启动 restore 于 25-3月 -11 使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在恢复控制文件 通道 ORA_DISK_1: 恢复完成 完成 restore 于 25-3月 -11
RMAN> restore controlfile to 'C:\\oracle\\product\\10.1.0\\oradata\\orcl\\CONTROL03.CT L' from 'D:\\arch\\C-1254907373-20110325-00';
启动 restore 于 25-3月 -11 使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在恢复控制文件 通道 ORA_DISK_1: 恢复完成 完成 restore 于 25-3月 -11
RMAN> alter database mount;
数据库已装载
释放的通道: ORA_DISK_1
RMAN>
1.6 还原数据库
C:\\Documents and Settings\\liruilong>rman target /
恢复管理器: 版本10.1.0.2.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.
连接到目标数据库: ORCL (DBID=1254907373)
RMAN> restore database;
启动 restore 于 25-3月 -11
启动 implicit crosscheck backup 于 25-3月 -11 正在使用目标数据库控制文件替代恢复目录 分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=160 devtype=DISK 已交叉检验的 4 对象
完成 implicit crosscheck backup 于 25-3月 -11
启动 implicit crosscheck copy 于 25-3月 -11 使用通道 ORA_DISK_1
完成 implicit crosscheck copy 于 25-3月 -11
搜索恢复区域中的所有文件 正在编制文件目录... 目录编制完毕
没有为文件编制目录
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在开始恢复数据文件备份集 通道 ORA_DISK_1: 正在指定从备份集恢复的数据文件
正将数据文件00001恢复到C:\\ORACLE\\PRODUCT\\10.1.0\\ORADATA\\ORCL\\SYSTEM01.DBF 正将数据文件00002恢复到C:\\ORACLE\\PRODUCT\\10.1.0\\ORADATA\\ORCL\\UNDOTBS01.DBF 正将数据文件00003恢复到C:\\ORACLE\\PRODUCT\\10.1.0\\ORADATA\\ORCL\\SYSAUX01.DBF 正将数据文件00004恢复到C:\\ORACLE\\PRODUCT\\10.1.0\\ORADATA\\ORCL\\USERS01.DBF 正将数据文件00005恢复到C:\\ORACLE\\PRODUCT\\10.1.0\\ORADATA\\ORCL\\USERS02.DBF 正将数据文件00006恢复到C:\\ORACLE\\PRODUCT\\10.1.0\\ORADATA\\ORCL\\TBS01.DBF 正将数据文件00007恢复到C:\\ORACLE\\PRODUCT\\10.1.0\\ORADATA\\ORCL\\TBS02.DBF 正将数据文件00008恢复到C:\\1111.DBF 正将数据文件00009恢复到C:\\UNDO2.DBF 通道 ORA_DISK_1: 已恢复备份段 1
段句柄 = D:\\ARCH\\746737352_3 标记 = TAG20110325T190231 通道 ORA_DISK_1: 恢复完成 完成 restore 于 25-3月 -11
RMAN>