不完全恢复

rac修改归档模式
SQL> select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

[oracle@rac1 ~]$ srvctl stop database -d zhaoja
[oracle@rac1 ~]$ export ORACLE_SID=zhaoja1
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Dec 20 17:46:06 2014

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size 2280840 bytes
Variable Size 416100984 bytes
Database Buffers 1157627904 bytes
Redo Buffers 34603008 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2
Next log sequence to archive 3
Current log sequence 3
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@rac1 ~]$ srvctl start database -d zhaoja
在两个节点查看是否归档。
SQL> archive log list;

 


1、进行全备份
控制文件自动备份打开
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored


SQL> select name from v$archived_log;

 


[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Dec 20 18:26:52 2014

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

connected to target database: ZHAOJA (DBID=3729713493)

RMAN> backup database;

 

2、查看删除的文件列表,包括数据文件、联机日志、控制文件

SQL>
select name from v$controlfile
union
select name from v$datafile
union
select member name from v$logfile;

NAME
--------------------------------------------------------------------------------
+DATA/zhaoja/controlfile/current.283.866833499
+DATA/zhaoja/datafile/sysaux.296.866833451
+DATA/zhaoja/datafile/system.256.866833451
+DATA/zhaoja/datafile/undotbs1.301.866833451
+DATA/zhaoja/datafile/undotbs2.289.866833523
+DATA/zhaoja/datafile/users.303.866833451
+DATA/zhaoja/onlinelog/group_1.299.866833501
+DATA/zhaoja/onlinelog/group_2.300.866833501
+DATA/zhaoja/onlinelog/group_3.304.866833561
+DATA/zhaoja/onlinelog/group_4.305.866833561

10 rows selected.

3、关闭两个实例
SQL> shutdown abort;
ORACLE instance shut down.


4、删除数据文件、联机日志、控制文件
[oracle@rac2 ~]$ export ORACLE_SID=+ASM2
[oracle@rac2 ~]$ asmcmd -p
ASMCMD [+] > cd +DATA/
ASMCMD [+DATA] > ls
RAC/
TEST/
ZHAOJA/
ASMCMD [+DATA] > cd zhaoja
ASMCMD [+DATA/zhaoja] > ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilezhaoja.ora
ASMCMD [+DATA/zhaoja] > cd controlfile
ASMCMD [+DATA/zhaoja/controlfile] > ls
Current.283.866833499
ASMCMD [+DATA/zhaoja/controlfile] > rm Current.283.866833499
ASMCMD [+DATA/zhaoja/controlfile] > cd +DATA/zhaoja/datafile
ASMCMD [+DATA/zhaoja/datafile] > ls
SYSAUX.296.866833451
SYSTEM.256.866833451
UNDOTBS1.301.866833451
UNDOTBS2.289.866833523
USERS.303.866833451
ASMCMD [+DATA/zhaoja/datafile] > rm *
You may delete multiple files and/or directories.
Are you sure? (y/n) y
ASMCMD [+data/zhaoja] > cd onlinelog
ASMCMD [+data/zhaoja/onlinelog] > ls
group_1.303.866830489
group_2.301.866830489
group_3.296.866830551
group_4.256.866830551
ASMCMD [+data/zhaoja/onlinelog] > rm *
You may delete multiple files and/or directories.
Are you sure? (y/n) y


5、首先从自动备份中恢复控制文件,在某个实例上执行:
[oracle@rac1 admin]$ sqlplus / as sysdba

 

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size 2280840 bytes
Variable Size 416100984 bytes
Database Buffers 1157627904 bytes
Redo Buffers 34603008 bytes

6、从rman备份中恢复控制文件
RMAN> set dbid=3729716506

executing command: SET DBID

RMAN> restore controlfile from autobackup;

Starting restore at 20-DEC-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 instance=zhaoja1 devtype=DISK

channel ORA_DISK_1: looking for autobackup on day: 20141220
channel ORA_DISK_1: autobackup found: c-3729716506-20141220-00
channel ORA_DISK_1: control file restore from autobackup complete
output filename=+DATA/zhaoja/controlfile/current.305.866835965
Finished restore at 20-DEC-14


7、挂载数据库
RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

8、恢复数据文件
RMAN> restore database;

 

9、查看控制文件中的归档日志记录
SQL> select name from v$archived_log;

SQL> recover database using backup controlfile until cancel;

RMAN>
run {
set until scn 617834;
restore database;
recover database;
}


以resetlogs方式打开数据库
RMAN>
sql 'alter database open resetlogs';

打开其他实例

srvctl start database -d zhaoja

srvctl status database -d zhaoja

 

posted on 2014-12-20 20:08  充实自己  阅读(234)  评论(0编辑  收藏  举报