码迷,mamicode.com
首页 > 其他好文 > 详细

【执行灾难性恢复-1】

时间:2014-12-28 00:35:00      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:oracle

执行灾难恢复:
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 20:23:30 2014
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options

SQL> shutdown abort
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
[oracle@oracle ~]$ rm /u01/oracle/oradata/jadl10g/ -rf
[oracle@oracle ~]$ rm /u01/oracle/admin/jadl10g/ -rf
[oracle@oracle ~]$ rm /u01/oracle/flash_recovery_area/jadl10g/ -rf
[oracle@oracle ~]$ ls /u01/oracle/10g/dbs/
ab_+ASM.dat        hc_jadl10g.dat  init.ora   orapw+ASM     snapcf_jadl10g.f
alert_jadl10g.log  initd10g.ora    lk+ASM     orapwd10g     spfile+ASM.ora
hc_+ASM.dat        initdw.ora      lkJADL10G  orapwjadl10g  spfilejadl10g.ora
[oracle@oracle ~]$ rm /u01/oracle/10g/dbs/*jadl10g* -rf
***注意该文件不能删除,如果删除了就不能恢复了***
[oracle@oracle ~]$ ls /u01/oracle/flash_recovery_area/JADL10G/ 

archivelog  backupset  datafile  onlinelog

故障模拟完毕:开始执行恢复操作;

[oracle@oracle ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Nov 6 20:30:19 2014
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database (not started)

RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/oracle/10g/dbs/initjadl10g.ora‘
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area     159383552 bytes
Fixed Size                     2094736 bytes
Variable Size                 67111280 bytes
Database Buffers              83886080 bytes
Redo Buffers                   6291456 bytes

RMAN> restore spfile from ‘/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_ncsnf_TAG20141106T202102_b5psyngf_.bkp‘;
Starting restore at 06-NOV-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK
channel ORA_DISK_1: autobackup found: /u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_ncsnf_TAG20141106T202102_b5psyngf_.bkp
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 06-NOV-14

RMAN> shutdown abort;
Oracle instance shut down

RMAN> exit
Recovery Manager complete.
[oracle@oracle ~]$ strings $ORACLE_HOME/dbs/spfilejadl10g.ora
jadl10g.__db_cache_size=427819008
jadl10g.__java_pool_size=4194304
jadl10g.__large_pool_size=4194304
jadl10g.__shared_pool_size=155189248
jadl10g.__streams_pool_size=0
*.audit_file_dest=‘/u01/oracle/admin/jadl10g/adump‘
*.background_dump_dest=‘/u01/oracle/admin/jadl10g/bdump‘
*.compatible=‘10.2.0.5.0‘
*.control_files=‘/u01/oracle/oradata/jadl10g/control01.ctl‘,‘/u01/oracle/flash_recovery_area/jadl10g/control02.ctl‘#Restore Controlfile
*.core_dump_dest=‘/u01/oracle/admin/jadl10g/cdump‘
*.db_block_size=8192
*.db_domain=‘‘
*.db_file_multiblock_read_count=16
*.db_name=‘jadl10g‘
*.db_recovery_file_dest=‘/u01/oracle/flash_recovery_area‘
*.db_recovery_file_dest_size=2147483648
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=jadl10gXDB)‘
*.job_queue_processes=10
*.log_archive_format=‘%t_%s_%r.dbf‘
*.open_cursors=300
*.pga_aggregate_target=199229440
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.sga_target=597688320
*.undo_management=‘AUTO‘
*.undo_tablespace=‘UNDOTBS1‘
*.user_dump_dest=‘/u01/oracle/admin/jadl10g/udump‘
[oracle@oracle ~]$ mkdir /u01/oracle/admin/jadl10g/{a,b,c,u}dump -p
[oracle@oracle ~]$ mkdir /u01/oracle/oradata/jadl10g
[oracle@oracle ~]$ mkdir /u01/oracle/flash_recovery_area/jadl10g
[oracle@oracle ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Nov 6 20:35:03 2014
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database (not started)
RMAN>  startup nomount
connected to target database (not started)
Oracle instance started
Total System Global Area     599785472 bytes
Fixed Size                     2098112 bytes
Variable Size                163580992 bytes
Database Buffers             427819008 bytes
Redo Buffers                   6287360 bytes

RMAN> restore controlfile from ‘/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_ncsnf_TAG20141106T202102_b5psyngf_.bkp‘;
Starting restore at 06-NOV-14
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/u01/oracle/oradata/jadl10g/control01.ctl
output filename=/u01/oracle/flash_recovery_area/jadl10g/control02.ctl
Finished restore at 06-NOV-14

RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1

RMAN> restore database;
Starting restore at 06-NOV-14
Starting implicit crosscheck backup at 06-NOV-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 06-NOV-14
Starting implicit crosscheck copy at 06-NOV-14
using channel ORA_DISK_1
Crosschecked 1 objects
Finished implicit crosscheck copy at 06-NOV-14
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_ncsnf_TAG20141106T202102_b5psyngf_.bkp
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/oracle/oradata/jadl10g/system01.dbf
restoring datafile 00002 to /u01/oracle/oradata/jadl10g/undotbs01.dbf
restoring datafile 00003 to /u01/oracle/oradata/jadl10g/sysaux01.dbf
restoring datafile 00004 to /u01/oracle/oradata/jadl10g/users01.dbf
restoring datafile 00005 to /u01/oracle/oradata/jadl10g/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T202102_b5psxhko_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T202102_b5psxhko_.bkp tag=TAG20141106T202102
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 06-NOV-14

RMAN> recover database;
Starting recover at 06-NOV-14
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/06/2014 20:39:55
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 485958

RMAN> recover database until scn 485958;
Starting recover at 06-NOV-14
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/06/2014 20:40:17
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 485958

RMAN> recover database noredo;
Starting recover at 06-NOV-14
using channel ORA_DISK_1
Finished recover at 06-NOV-14

RMAN> alter database open resetlogs;
database opened

RMAN> exit
Recovery Manager complete.
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 20:47:03 2014
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options

SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/jadl10g/system01.dbf
/u01/oracle/oradata/jadl10g/undotbs01.dbf
/u01/oracle/oradata/jadl10g/sysaux01.dbf
/u01/oracle/oradata/jadl10g/users01.dbf
/u01/oracle/oradata/jadl10g/example01.dbf

备份文件 不用删除 在备份设备上保留冗余备份
归档日志 不要删除 在备份设备上保留归档日志
日志文件一定要分开放,不要造成日志文件组成员全部丢失
数据文件丢失有故障,是可以恢复的
使用重建控制文件,备份控制文件恢复,resetlogs打开数据库都需要重新备份backup database;

【执行灾难性恢复-1】

标签:oracle

原文地址:http://blog.csdn.net/u012625036/article/details/42201273

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!