ITPub博客

首页 > Linux操作系统 > Linux操作系统 > undo表空间故障恢复

undo表空间故障恢复

原创 Linux操作系统 作者:aaqwsh 时间:2011-04-24 15:39:45 0 删除 编辑

undo表空间故障恢复,有备份:
onfigure channel device type disk format='/data/ora10g/%U';
CONFIGURE CHANNEL 1 DEVICE TYPE DISK clear;

RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
configuration for DISK channel 2 is ignored
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
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 CHANNEL 1 DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/data/ora10g/product/10.2.0/db_1/dbs/snapcf_RACDBSTD.f'; # default
RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK clear;
old RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
old RMAN configuration parameters are successfully deleted
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
configuration for DISK channel 2 is ignored
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
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 CHANNEL 2 DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/data/ora10g/product/10.2.0/db_1/dbs/snapcf_RACDBSTD.f'; # default
RMAN> CONFIGURE CHANNEL 2 DEVICE TYPE DISK clear;
old RMAN configuration parameters:
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
old RMAN configuration parameters are successfully deleted
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
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 CHANNEL DEVICE TYPE DISK FORMAT   '/data/ora10g/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/data/ora10g/product/10.2.0/db_1/dbs/snapcf_RACDBSTD.f'; # default
RMAN> exit

RMAN> backup database;

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


SQL> create table  testundo tablespace users as select * from dba_objects where rownum<200;
Table created.
SQL> insert into testundo select * from testundo where rownum <11;
10 rows created.
SQL> insert into testundo select * from testundo where rownum <11;
10 rows created.
SQL> select count(*) from testundo;
  count(*)
----------
       219
SQL> insert into testundo select * from testundo where rownum <3001;
219 rows created.

--模拟故障
SQL> shutdown abort;
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@node1 ~]$

-- 删除undo文件
[oracle@node1 RACDBSTD]$ ls -al
total 788432
drwxr-xr-x 3 oracle oinstall      4096 Apr 24 15:23 .
drwxr-xr-x 8 oracle oinstall      4096 Apr 24 15:28 ..
drwxr-xr-x 2 oracle oinstall      4096 Apr 24 15:24 arch
-rw-r----- 1 oracle oinstall  15384576 Apr 24 15:33 control01.ctl
-rw-r----- 1 oracle oinstall  15384576 Apr 24 15:33 control02.ctl
-rw-r----- 1 oracle oinstall  15384576 Apr 24 15:33 control03.ctl
-rw-r----- 1 oracle oinstall  52429312 Apr 24 15:33 group_1.257.727735489
-rw-r----- 1 oracle oinstall  52429312 Apr 24 15:24 group_2.258.727735493
-rw-r----- 1 oracle oinstall 167780352 Apr 24 15:28 sysaux.261.727735559
-rw-r----- 1 oracle oinstall 429924352 Apr 24 15:28 system.259.727735501
-rw-r----- 1 oracle oinstall  20979712 Apr 24 15:10 temp.262.727735571
-rw-r----- 1 oracle oinstall  52436992 Apr 24 15:28 undo02.DBF
-rw-r----- 1 oracle oinstall   5251072 Apr 24 15:32 users.264.727735605
[oracle@node1 RACDBSTD]$ rm undo02.DBF

[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Apr 24 15:34:36 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              62916852 bytes
Database Buffers          100663296 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/data/ora10g/RACDBSTD/undo02.DBF'

SQL> recover datafile 4;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 4: '/data/ora10g/RACDBSTD/undo02.DBF'
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/data/ora10g/RACDBSTD/undo02.DBF'

--restore datafile 4;
[oracle@node1 ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Apr 24 15:35:36 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: RACDB (DBID=725352237, not open)
RMAN> restore datafile 4;
Starting restore at 24-APR-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /data/ora10g/RACDBSTD/undo02.DBF
channel ORA_DISK_1: reading from backup piece /data/ora10g/0smajacb_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/data/ora10g/0smajacb_1_1 tag=TAG20110424T152810
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
Finished restore at 24-APR-11

--recover
SQL> recover datafile 4;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> select count(*) from testundo;
  count(*)
----------
       199
SQL> select * from v$recover_file;
no rows selected

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/758322/viewspace-693307/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-11-24

  • 博文量
    132
  • 访问量
    265296