博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

为了更好的生活

   alec.cublog.cn
关于作者  
姓名:黄荣君
职业:IT
年龄:100
位置:深圳
个性介绍:为了更好的生活

我的分类  




Oracle灾难恢复演示
$ rman target / nocatalog
Recovery Manager: Release 10.2.0.3.0 - Production on Tue Dec 11 14:54:25 2007
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database (not started)
RMAN> set DBID 382628453
executing command: SET DBID
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/data6/oracle10/product/10.2.0/Db_1/dbs/initYOCMAX1.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area     159383552 bytes
Fixed Size                     2028560 bytes
Variable Size                 67111920 bytes
Database Buffers              83886080 bytes
Redo Buffers                   6356992 bytes
RMAN> restore spfile to pfile '/data6/oracle10/product/10.2.0/Db_1/dbs/initYOCMAX1.ora'
2> from '/data02/yocmax/cf_c-382628453-20071211-02';
Starting restore at 11-DEC-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK
channel ORA_DISK_1: autobackup found: /data02/yocmax/cf_c-382628453-20071211-02
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 11-DEC-07
RMAN> shutdown immediate;
Oracle instance shut down

RMAN> startup nomount pfile= '/data6/oracle10/product/10.2.0/Db_1/dbs/initYOCMAX1.ora'
Oracle instance started
Total System Global Area    1610612736 bytes
Fixed Size                     2030456 bytes
Variable Size                436208776 bytes
Database Buffers            1157627904 bytes
Redo Buffers                  14745600 bytes

RMAN> restore controlfile  from '/data02/yocmax/cf_c-382628453-20071211-02';
Starting restore at 11-DEC-07
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/data6/oracle10/oradata/yocmax/current.295.640710389
output filename=/data6/oracle10/oradata/yocmax/current.310.640710389
Finished restore at 11-DEC-07
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> exit

Recovery Manager complete.
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Dec 11 15:39:37 2007
Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA1/yocmax/datafile/system.276.640710419
+DATA1/yocmax/datafile/undotbs1.283.640710419
+DATA1/yocmax/datafile/sysaux.299.640710419
+DATA1/yocmax/datafile/users.303.640710421
+DATA1/yocmax/datafile/undotbs2.314.640710419
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA1/yocmax/onlinelog/group_2.279.640710461
+DATA1/yocmax/onlinelog/group_2.291.640710463
+DATA1/yocmax/onlinelog/group_1.257.640710459
+DATA1/yocmax/onlinelog/group_1.272.640710461
+DATA1/yocmax/onlinelog/group_3.302.640710463
+DATA1/yocmax/onlinelog/group_3.292.640710465
+DATA1/yocmax/onlinelog/group_4.308.640710465
+DATA1/yocmax/onlinelog/group_4.298.640710467
8 rows selected.
SQL>exit
$cd /data6/oracle10/oradata/yocmax/
$touch system.dbf'
$touch undotbs1.dbf'
$touch sysaux.dbf'
$touch users.dbf'
$touch undotbs2.dbf'
$touch redo01.log
$touch redo02.log
$touch redo03.log
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Dec 11 15:39:37 2007
Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> alter database rename file '+DATA1/yocmax/datafile/system.276.640710419'
  2  to '/data6/oracle10/oradata/yocmax/system.dbf';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/datafile/undotbs1.283.640710419'
  2  to '/data6/oracle10/oradata/yocmax/undotbs1.dbf';
 
Database altered.
SQL> alter database rename file '+DATA1/yocmax/datafile/sysaux.299.640710419'
  2  to '/data6/oracle10/oradata/yocmax/sysaux.dbf';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/datafile/users.303.640710421'
  2  to '/data6/oracle10/oradata/yocmax/users.dbf';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/datafile/undotbs2.314.640710419'
  2  to '/data6/oracle10/oradata/yocmax/undotbs2.dbf';
Database altered.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/data6/oracle10/oradata/yocmax/system.dbf
/data6/oracle10/oradata/yocmax/undotbs1.dbf
/data6/oracle10/oradata/yocmax/sysaux.dbf
/data6/oracle10/oradata/yocmax/users.dbf
/data6/oracle10/oradata/yocmax/undotbs2.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA1/yocmax/onlinelog/group_2.279.640710461
+DATA1/yocmax/onlinelog/group_2.291.640710463
+DATA1/yocmax/onlinelog/group_1.257.640710459
+DATA1/yocmax/onlinelog/group_1.272.640710461
+DATA1/yocmax/onlinelog/group_3.302.640710463
+DATA1/yocmax/onlinelog/group_3.292.640710465
+DATA1/yocmax/onlinelog/group_4.308.640710465
+DATA1/yocmax/onlinelog/group_4.298.640710467
8 rows selected.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_1.257.640710459'
  2  to '/data6/oracle10/oradata/yocmax/redo01.log';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_1.272.640710461'
  2  to '/data6/oracle10/oradata/yocmax/redo02.log';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_2.279.640710461'
  2  to '/data6/oracle10/oradata/yocmax/redo03.log';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_2.291.640710463'
  2  to '/data6/oracle10/oradata/yocmax/redo04.log';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_3.302.640710463'
  2  to '/data6/oracle10/oradata/yocmax/redo05.log';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_3.292.640710465'
  2  to '/data6/oracle10/oradata/yocmax/redo06.log';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_4.308.640710465'
  2  to '/data6/oracle10/oradata/yocmax/redo07.log';
Database altered.
SQL> alter database rename file '+DATA1/yocmax/onlinelog/group_4.298.640710467'
  2  to '/data6/oracle10/oradata/yocmax/redo08.log';
Database altered.
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/data6/oracle10/oradata/yocmax/redo03.log
/data6/oracle10/oradata/yocmax/redo04.log
/data6/oracle10/oradata/yocmax/redo01.log
/data6/oracle10/oradata/yocmax/redo02.log
/data6/oracle10/oradata/yocmax/redo05.log
/data6/oracle10/oradata/yocmax/redo06.log
/data6/oracle10/oradata/yocmax/redo07.log
/data6/oracle10/oradata/yocmax/redo08.log
8 rows selected.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
$ rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Tue Dec 11 16:08:29 2007
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: YOCMAX (DBID=382628453, not open)
RMAN> restore database;
Starting restore at 11-DEC-07
Starting implicit crosscheck backup at 11-DEC-07
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK
Crosschecked 33 objects
Finished implicit crosscheck backup at 11-DEC-07
Starting implicit crosscheck copy at 11-DEC-07
using channel ORA_DISK_1
Finished implicit crosscheck copy at 11-DEC-07
searching for all files in the recovery area
cataloging files...
no files cataloged
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 /data6/oracle10/oradata/yocmax/system.dbf
restoring datafile 00002 to /data6/oracle10/oradata/yocmax/undotbs1.dbf
restoring datafile 00003 to /data6/oracle10/oradata/yocmax/sysaux.dbf
restoring datafile 00004 to /data6/oracle10/oradata/yocmax/users.dbf
restoring datafile 00005 to /data6/oracle10/oradata/yocmax/undotbs2.dbf
channel ORA_DISK_1: reading from backup piece /data02/yocmax/db_YOCMAX_20071211_42
channel ORA_DISK_1: restored backup piece 1
piece handle=/data02/yocmax/db_YOCMAX_20071211_42 tag=TAG20071211T140130
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
Finished restore at 11-DEC-07
RMAN> recover database;
Starting recover at 11-DEC-07
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=9
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 12/11/2007 16:09:49
RMAN-06054: media recovery requesting unknown log: thread 1 seq 9 lowscn 1317353
RMAN> alter database open resetlogs;
database opened
RMAN> exit

Recovery Manager complete.
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Dec 11 16:12:48 2007
Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> create spfile='/data6/oracle10/product/10.2.0/Db_1/dbs/spfileYOCMAX1.ora'
  2  from pfile;
File created.
SQL>

 发表于: 2008-01-09,修改于: 2008-01-09 14:11 已浏览301次,有评论0条 推荐 投诉

  网友评论

  发表评论



Copyright © 2001-2010 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们
页面生成时间:0.02296

京ICP证041476号