Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5205282
  • 博文数量: 1004
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13042
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1004)

文章存档

2020年(1)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: Oracle

2011-12-01 14:57:20

步骤1:备份数据库

run
{
shutdown immediate;
startup mount; #noarchive mode,must be mount
allocate channel c1 type disk;
allocate channel c2 type disk;
backup database format '/u01/rman_backup/2011/201112/20111201/df_%t_%s_%p.bak';
release channel c1;
release channel c2;
alter database open;
}

步骤2:停止数据库

SQL> connect / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

步骤3.删除数据文件

[oracle@rac1 oracl]$ rm hxl01.dbf

步骤3:试着启动数据库(这个时候因为数据文件hxl01.dbf删除了,所以无法启动)

[oracle@rac1 oracl]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 1 12:55:56 2011

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

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 524288000 bytes
Fixed Size 1220360 bytes
Variable Size 163578104 bytes
Database Buffers 356515840 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/u01/app/oracle/oradata/oracl/hxl01.dbf'


步骤4:恢复

run
{
shutdown immediate;
startup mount; #noarchive mode,must be mount
allocate channel c1 type disk;
allocate channel c2 type disk;
restore database;
recover database;
release channel c1;
release channel c2;
alter database open;
}

步骤5:检查是否恢复

[oracle@rac1 myscript]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 1 13:07:50 2011

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

SQL> connect / as sysdba
Connected.
SQL> select * from dual;

D
-
X

至此,数据库完成恢复.

总结:数据库在非归档模式下,备份和恢复操作都必须在mount状态下执行.

阅读(2464) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~