本帖最后由 botang 于 2016-7-4 23:31 编辑
【上完1Z0-052的第18章】ORACLE SUPPORT,打补丁,打热补丁
【上完1Z0-053的第9章】ADR以及物理坏块和逻辑坏块,DBMS_REPAIR用孤儿键值表修复逻辑坏块
【1Z0-051】:共10章(0 1 2 3 4 5 6 7 8 9 10 11)
【1Z0-052】:共13章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
【1Z0-053】:共15章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
表示已经上过的,表示还没上的。
-
- select * from REPAIR_TABLE;
- select * from ORPHAN_KEY_TABLE;
- BEGIN
- DBMS_REPAIR.ADMIN_TABLES (
- table_name => 'ORPHAN_KEY_TABLE',
- table_type => DBMS_REPAIR.ORPHAN_TABLE,
- action => DBMS_REPAIR.CREATE_ACTION,
- tablespace => 'USERS');
- END;
- ---
- DECLARE num_corrupt INT;
- BEGIN
- num_corrupt := 0;
- DBMS_REPAIR.CHECK_OBJECT (
- schema_name => 'HR',
- object_name => 'T05309',
- repair_table_name => 'REPAIR_TABLE',
- corrupt_count => num_corrupt);
- dbms_output.put_line( 'Find '|| num_corrupt||' Bolcks.' );
- END;
- ---
- DECLARE num_orphans INT;
- BEGIN
- num_orphans := 0;
- DBMS_REPAIR.DUMP_ORPHAN_KEYS (
- schema_name => 'HR',
- object_name => 'I05309_A',
- object_type => DBMS_REPAIR.INDEX_OBJECT,
- repair_table_name => 'REPAIR_TABLE',
- orphan_table_name => 'ORPHAN_KEY_TABLE',
- key_count => num_orphans);
- DBMS_OUTPUT.PUT_LINE('orphan key count: ' || TO_CHAR(num_orphans));
- END;
- DECLARE num_orphans INT;
- BEGIN
- num_orphans := 0;
- DBMS_REPAIR.DUMP_ORPHAN_KEYS (
- schema_name => 'HR',
- object_name => 'I05309_B',
- object_type => DBMS_REPAIR.INDEX_OBJECT,
- repair_table_name => 'REPAIR_TABLE',
- orphan_table_name => 'ORPHAN_KEY_TABLE',
- key_count => num_orphans);
- DBMS_OUTPUT.PUT_LINE('orphan key count: ' || TO_CHAR(num_orphans));
- END;
- ----
- select * from ORPHAN_KEY_TABLE
- where index_name='I05309_B' and keyrowid||' '='AAATq/AIgAAAIABAAA'||' ';
-
- ---
- begin
- dbms_repair.skip_corrupt_blocks('HR','T05309');
- end;
-
- --
- ---
-
- select dump(key) from ORPHAN_KEY_TABLE;
复制代码
| DUMP(KEY) | 1 | Typ=208 Len=17: 2,4,0,0,0,0,9,108,105,110,104,97,105,98,105,110,254 | 2 | Typ=208 Len=12: 2,4,0,0,0,0,4,195,3,53,61,254 |
100^(193-193-0)(2-1)=1 100^(193-193-0)(11-1)=10 100^(194-193-0)(2-1)=100 100^(194-193-0)(11-1)=1000 100^(194-193-0)(2-1)+ 100^(194-193-1)(11-1)=110 100^(194-193-0)(12-1)=1100
100^(62-62-0)(101-100)=1 100^(62-62-0)(101-91)=10 100^(62-61-0)(101-100)=100 123456.789 100^(195-193-0)(13-1)+ 100^(195-193-1)(35-1)+ 100^(195-193-2)(57-1)+ 100^(195-193-3)(79-1)+ 100^(195-193-4)(91-1)=120000+3400+56+0.78+0.009= 123456.789 -123456.789 100^(62-60-0)(101-89)+ 100^(62-60-1)(101-67)+ 100^(62-60-2)(101-45)+ 100^(62-60-3)(101-23)+ 100^(62-60-4)(101-11)=120000+3400+56+0.78+0.009= -123456.789
-123456.78901 100^(62-60-0)(101-89)+ 100^(62-60-1)(101-67)+ 100^(62-60-2)(101-45)+ 100^(62-60-3)(101-23)+ 100^(62-60-4)(101-11)+ 100^(62-60-5)(101-91) =120000+3400+56+0.78+0.009+0.00001= -123456.78901
- SQL> select * from t05309;
- ERROR:
- ORA-01578: ORACLE data block corrupted (file # 6, block # 136)
- ORA-01110: data file 6: '+DATA/orcl/datafile/tbs05309.268.916084781'
- ORA-26040: Data block was loaded using the NOLOGGING option
复制代码- begin
- dbms_repair.skip_corrupt_blocks('HR','T05309');
- end;
复制代码- SQL> select * from t05309;
- A B
- ---------- --------------------
- 25260 linhaibin
- SQL> select dump(1) from dual;
- DUMP(1)
- ------------------
- Typ=2 Len=2: 193,2
- SQL> select dump(10) from dual;
- DUMP(10)
- -------------------
- Typ=2 Len=2: 193,11
- SQL> select dump(100) from dual;
- DUMP(100)
- ------------------
- Typ=2 Len=2: 194,2
- SQL>
- SQL> select dump(1000) from dual;
- DUMP(1000)
- -------------------
- Typ=2 Len=2: 194,11
- SQL> select dump(110) from dual;
- DUMP(110)
- ---------------------
- Typ=2 Len=3: 194,2,11
- SQL> select dump(-1) from dual;
- DUMP(-1)
- -----------------------
- Typ=2 Len=3: 62,100,102
- SQL> select dump(-10) from dual;
- DUMP(-10)
- ----------------------
- Typ=2 Len=3: 62,91,102
- SQL> select dump(-100) from dual;
- DUMP(-100)
- -----------------------
- Typ=2 Len=3: 61,100,102
- SQL> select dump(-110) from dual;
- DUMP(-110)
- --------------------------
- Typ=2 Len=4: 61,100,91,102
- SQL> select dump(-1000) from dual;
- DUMP(-1000)
- ----------------------
- Typ=2 Len=3: 61,91,102
- SQL> select dump(123456.789) from dual;
- DUMP(123456.789)
- -------------------------------
- Typ=2 Len=6: 195,13,35,57,79,91
- SQL> select dump(-123456.789) from dual;
- DUMP(-123456.789)
- ----------------------------------
- Typ=2 Len=7: 60,89,67,45,23,11,102
- SQL> select dump(-123456.78901) from dual;
- DUMP(-123456.78901)
- -------------------------------------
- Typ=2 Len=8: 60,89,67,45,23,11,91,102
- SQL>
复制代码
|