SQL> select file_id, block_id from dba_extents where segment_name = ‚DEPARTMENTS‘; FILE_ID BLOCK_ID———- ———- 5 49SQL> select file_name from dba_data_files where file_id = 5;FILE_NAME——————————————————————————–/u01/app/oracle/oradata/orcl/example01.dbf[oracle@localhost labs]$ ./lab_07_02.sh /u01/app/oracle/oradata/orcl/example01.dbf 49 81920+1 records in0+1 records out8 bytes (8 B) copied, 0.000236343 seconds, 33.8 kB/s0+1 records in0+1 records out8 bytes (8 B) copied, 0.000183543 seconds, 43.6 kB/s0+1 records in0+1 records out8 bytes (8 B) copied, 0.000471848 seconds, 17.0 kB/s0+1 records in0+1 records out8 bytes (8 B) copied, 0.000285791 seconds, 28.0 kB/s[oracle@localhost labs]$ cat ./lab_07_02.sh#!/bin/bash# Oracle Database 10g: Administration Workshop II# Oracle Server Technologies – Curriculum Development## ***Training purposes only***# ***Not appropriate for production use***#FILE=${1:?’Parameter 1 should be set to file name‘}BLOCK=${2:?’Parameter 2 should be set to the block to be corrupted‘}BLOCKSIZE=${3:?’Parameter 3 should be set to the database block size‘}dd of=$FILE bs=$BLOCKSIZE conv=notrunc seek=$BLOCK < ALTER SYSTEM FLUSH BUFFER_CACHE;System altered.SQL> SELECT * FROM hr.departments;SELECT * FROM hr.departments *ERROR at line 1:ORA-01578: ORACLE data block corrupted (file # 5, block # 51)ORA-01110: data file 5: ‚/u01/app/oracle/oradata/orcl/example01.dbf'[oracle@localhost ~]$ dbv file=/u01/app/oracle/oradata/orcl/example01.dbf blocksize=8192DBVERIFY: Release 10.2.0.3.0 – Production on Tue Jun 28 13:48:45 2011Copyright (c) 1982, 2005, Oracle. All rights reserved.DBVERIFY – Verification starting : FILE = /u01/app/oracle/oradata/orcl/example01.dbfPage 49 is marked corruptCorrupt block relative dba: 0x01400031 (file 5, block 49)Bad header found during dbv:Data in bad block: type: 67 format: 7 rdba: 0x0a545055 last change scn: 0x0000.0006fbc5 seq: 0x2 flg: 0x04 spare1: 0x52 spare2: 0x52 spare3: 0x0 consistency value in tail: 0xfbc52002 check value in block header: 0xef5 computed block checksum: 0xe441Page 50 is marked corruptCorrupt block relative dba: 0x01400032 (file 5, block 50)Bad header found during dbv:Data in bad block: type: 67 format: 7 rdba: 0x0a545055 last change scn: 0x0000.0006fad8 seq: 0x1 flg: 0x04 spare1: 0x52 spare2: 0x52 spare3: 0x0 consistency value in tail: 0xfad82101 check value in block header: 0x4ecb computed block checksum: 0xe443Page 51 is marked corruptCorrupt block relative dba: 0x01400033 (file 5, block 51)Bad header found during dbv:Data in bad block: type: 67 format: 7 rdba: 0x0a545055 last change scn: 0x0000.0006fbc5 seq: 0x2 flg: 0x04 spare1: 0x52 spare2: 0x52 spare3: 0x0 consistency value in tail: 0xfbc52302 check value in block header: 0x6310 computed block checksum: 0xe440Page 52 is marked corruptCorrupt block relative dba: 0x01400034 (file 5, block 52)Bad header found during dbv:Data in bad block: type: 67 format: 7 rdba: 0x0a545055 last change scn: 0x0000.0006fbc5 seq: 0x1 flg: 0x04 spare1: 0x52 spare2: 0x52 spare3: 0x0 consistency value in tail: 0xfbc50601 check value in block header: 0x7301 computed block checksum: 0xe462DBVERIFY – Verification completeTotal Pages Examined : 12800Total Pages Processed (Data) : 4406Total Pages Failing (Data) : 0Total Pages Processed (Index): 1264Total Pages Failing (Index): 0Total Pages Processed (Other): 5495Total Pages Processed (Seg) : 0Total Pages Failing (Seg) : 0Total Pages Empty : 1631Total Pages Marked Corrupt : 4Total Pages Influx : 0Highest block SCN : 615738 (0.615738)[oracle@localhost ~]$ rman target /Recovery Manager: Release 10.2.0.3.0 – Production on Tue Jun 28 13:49:51 2011Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: ORCL (DBID=1255663612)RMAN> BLOCKRECOVER DATAFILE 5 BLOCK 49, 50, 51, 52;Starting blockrecover at 2011-06-28 13:49:55using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=134 devtype=DISKchannel ORA_DISK_1: restoring block(s)channel ORA_DISK_1: specifying block(s) to restore from backup setrestoring blocks of datafile 00005channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_06_28/o1_mf_nnndf_TAG20110628T102035_70m3pmwn_.bkpchannel ORA_DISK_1: restored block(s) from backup piece 1piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2011_06_28/o1_mf_nnndf_TAG20110628T102035_70m3pmwn_.bkp tag=TAG20110628T102035channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01starting media recoveryarchive log thread 1 sequence 6 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_28/o1_mf_1_6_70m46bys_.arcarchive log thread 1 sequence 1 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_28/o1_mf_1_1_70mcd5gs_.arcmedia recovery complete, elapsed time: 00:00:02Finished blockrecover at 2011-06-28 13:50:02SQL> SELECT * FROM hr.departments;DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID————- —————————— ———- ———– 10 Administration 200 1700 20 Marketing 201 1800 30 Purchasing 114 1700 40 Human Resources 203 2400 50 Shipping 121 1500 60 IT 103 1400 70 Public Relations 204 2700 80 Sales 145 2500 90 Executive 100 1700 100 Finance 108 1700 110 Accounting 205 1700DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID————- —————————— ———- ———– 120 Treasury 1700 130 Corporate Tax 1700 140 Control And Credit 1700 150 Shareholder Services 1700 160 Benefits 1700 170 Manufacturing 1700 180 Construction 1700 190 Contracting 1700 200 Operations 1700 210 IT Support 1700 220 NOC 1700DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID————- —————————— ———- ———– 230 IT Helpdesk 1700 240 Government Sales 1700 250 Retail Sales 1700 260 Recruiting 1700 270 Payroll 170027 rows selected.
Získejte konzultaci v hodnotě 1 500 Kč k vaší databázi Oracle zcela zdarma. Ozvěte se mi ještě dnes.