当前位置:Gxlcms > mysql > 无RMAN备份集情况下的坏块恢复

无RMAN备份集情况下的坏块恢复

时间:2021-07-01 10:21:17 帮助过:34人阅读

虽然在没有RMAN备份集的情况下,通过热备文件可以把丢失的数据恢复出来,但这毕竟还是很不靠谱的。在生产环境中,我们几乎不可能

测试的环境是没有可用的RMAN备份集,但是有数据文件的热备,下面来看测试:


--创建测试用户和测试表
[Oracle@ora10g ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on 16 16:01:02 2014


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

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> create user zlm identified by zlm;

User created.

SQL> alter user zlm default tablespace zlm;

User altered.


SQL> grant dba to zlm;


Grant succeeded.


SQL> conn zlm/zlm

Connected.
SQL> create table corrupt_test (id number(10),name varchar2(15));


Table created.


SQL> insert into corrupt_test values(1,'aaron8219');


1 row created.


SQL> commit;


Commit complete.


SQL> set lin 130

SQL> col segment_name for a20

SQL> col tablespace_name for a20
SQL> select segment_name,tablespace_name from dba_segments where segment_name='CORRUPT_TEST';

SEGMENT_NAME TABLESPACE_NAME
-------------------- --------------------
CORRUPT_TEST ZLM


SQL> col name for a45
SQL> select a.segment_name,a.tablespace_name,b.file#,b.name from dba_segments a,v$datafile b where a.header_file=b.file# and a.segment_name='CORRUPT_TEST';


SEGMENT_NAME TABLESPACE_NAME FILE# NAME
-------------------- -------------------- ---------- ---------------------------------------------
CORRUPT_TEST ZLM 6 /u01/app/oracle/oradata/ora10g/zlm01.dbf


由于之前做过RMAN备份,所以先把备份集删除


[oracle@ora10g ~]$ rman target /


Recovery Manager: Release 10.2.0.1.0 - Production on 16 16:06:47 2014


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


connected to target database: ORA10G (DBID=4175411955)


RMAN> list backupset;

using target database control file instead of recovery catalog


List of Backup Sets
===================


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
286 Full 880.50M DISK 00:01:35 2014-11-12
BP Key: 286 Status: AVAILABLE Compressed: NO Tag: TAG20141112T141548
Piece Name: /u01/app/oracle/flash_recovery_area/ORA10G/backupset/2014_11_12/o1_mf_nnndf_TAG20141112T141548_b65yrnkg_.bkp
List of Datafiles in backup set 286
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ---------- ----
1 Full 1202813 2014-11-12 /u01/app/oracle/oradata/ora10g/system01.dbf
2 Full 1202813 2014-11-12 /u01/app/oracle/oradata/ora10g/undotbs01.dbf
3 Full 1202813 2014-11-12 /u01/app/oracle/oradata/ora10g/sysaux01.dbf
4 Full 1202813 2014-11-12 /u01/app/oracle/oradata/ora10g/users01.dbf
5 Full 1202813 2014-11-12 /u01/app/oracle/oradata/ora10g/example01.dbf
6 Full 1202813 2014-11-12


BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
302 42.17M DISK 00:00:27 2014-11-21
BP Key: 302 Status: AVAILABLE Compressed: YES Tag: ARC_BAK
Piece Name: /u01/orabackup/backupsets/ora10g-4175411955_20141121_864227317_351.arc


List of Archived Logs in backup set 302
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ---------- ---------- ---------
1 39 1234835 2014-11-18 1247748 2014-11-21
1 40 1247748 2014-11-21 1249682 2014-11-21
1 41 1249682 2014-11-21 1250181 2014-11-21
1 42 1250181 2014-11-21 1258063 2014-11-21
1 43 1258063 2014-11-21 1260208 2014-11-21

人气教程排行