Cheers guys - lots to look at there. Corruptnig a datafile is easy, its the screwing of a single block that im after - theres a few things thre I shal try. If I get a decent result I will update!
ta lots,
Bob
Printable View
Cheers guys - lots to look at there. Corruptnig a datafile is easy, its the screwing of a single block that im after - theres a few things thre I shal try. If I get a decent result I will update!
ta lots,
Bob
I suggest you dont use that, asking for a world of trouble with it
here is a way which will work on unix (nicked from the oracle-l list)Quote:
Originally posted by bmycroft
Cheers guys - lots to look at there. Corruptnig a datafile is easy, its the screwing of a single block that im after - theres a few things thre I shal try. If I get a decent result I will update!
ta lots,
Bob
Code:create tablespace corrupt datafile '/u01/oradata/dv03/corrupt.dbf' size 5m
reuse
extent management local uniform size 8k
/
-- create a table with 2 blocks
create table corrupt_objects
tablespace corrupt
as
select *
from all_objects
where rownum < 70
/
-- get the block id
select segment_type, relative_fno, file_id, extent_id, block_id, blocks
from dba_extents
where segment_name = 'CORRUPT_OBJECTS'
/
SEGMENT_TYPE RELATIVE_FNO FILE_ID EXTENT_ID BLOCK_ID BLOCKS
------------------ ------------ ---------- ---------- ---------- -----------
TABLE 10 10 0 9 2
1 row selected.
#corrupt one block
dd conv=notrunc if=/dev/zero of=/u01/oradata/dv03/corrupt.dbf bs=8192
seek=10 count=1
-- check for corrupt block
declare
v_corrupt_count integer;
begin
sys.dbms_repair.check_object (
schema_name => 'JS001292',
object_name => 'CORRUPT_OBJECTS',
repair_table_name => 'REPAIR_TABLE',
object_type => sys.dbms_repair.table_object,
corrupt_count => v_corrupt_count
);
dbms_output.put_line('Corrupt Count: ' || v_corrupt_count);
end;
/
Corrupt Count: 1
PL/SQL procedure successfully completed.
-- examine corruptions
SQL> select schema_name,object_name, corrupt_type
from sys.repair_table
SCHEMA_NAME OBJECT NAME CORRUPT_TYPE
------------------------------ ------------------------------ ------------
JS001292 CORRUPT_OBJECTS 6148
JS001292 CORRUPT_OBJECTS 6148
2 rows selected.
Cool. That looks a lot more user-friendly than using bbed. I guessed the password for bbed by the way, I may have to have a play with it later on. Just for those of yuo who are worried - I would NEVER EVER use it on a live system, trust me.... Oh ye Gods no. Just gives me the shivers thinking about it :-)
I shall try the method using dd I think and then go back and look at the bed stuff later somewhere safe...
Cheers lots or the help guys, I do appreciate it
-B
Excellent :-) using dd to overright specific blocks works a treat.
Using bbed ; I get close but wen I try the corrupt command, I get a core dump. Bit of a shame but no great problem as i can use dd.
ta lots,
Bob