Bo's Oracle Station

查看: 3224|回复: 0

(52-24)第38/39/40/41次 2016-01-02/03 星期六/日

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2016-1-3 19:52:15 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2016-1-3 19:52 编辑

(52-21)上完1Z0-052第18章
(52-22)上完1Z0-052第9章
(52-23)上完1Z0-052第6章
(52-24)上完1Z0-052第7章


BEGIN
DBMS_REPAIR.ADMIN_TABLES (
   table_name => 'REPAIR_TABLE',
   table_type => DBMS_REPAIR.REPAIR_TABLE,
   action => DBMS_REPAIR.CREATE_ACTION,
   tablespace => 'USERS');
END;

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 => 'DEPARTMENTS',
   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 => 'SCOTT',
  object_name => 'PK_DEPT',
  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;



--drop tablespace blocktbs including contents and datafiles cascade constraints;
--drop user hr cascade;
--drop tablespace blocktbs including contents and datafiles cascade constraints;
create tablespace blocktbs   nologging;
create table tocp7_a(n1 char(1)) tablespace blocktbs;
select  count(*) from tocp7_a;

select  * from v$backup_corruption;


select  * from v$database_block_corruption;
select  * from v$copy_corruption;

select  * from dba_tables t where t.table_name='HR_TUNDO';

select  * from sys_dba_segs s where s.owner='SYS' and s.segment_name='TOCP7_A';
select  * from dba_segments s where s.owner='SYS' and s.segment_name='TOCP7_A';

create table t1 ( a number)  tablespace example;



BEGIN
DBMS_REPAIR.ADMIN_TABLES (
   table_name => 'REPAIR_TABLE',
   table_type => DBMS_REPAIR.REPAIR_TABLE,
   action => DBMS_REPAIR.CREATE_ACTION,
   tablespace => 'USERS');
END;

BEGIN
DBMS_REPAIR.ADMIN_TABLES (
   table_name => 'ORPHAN_KEY_TABLE',
   table_type => DBMS_REPAIR.ORPHAN_TABLE,
   action => DBMS_REPAIR.CREATE_ACTION,
   tablespace => 'USERS');
END;

select  * from REPAIR_TABLE;
select  *  from ORPHAN_KEY_TABLE;

DECLARE num_corrupt INT;
BEGIN
num_corrupt := 0;
DBMS_REPAIR.CHECK_OBJECT (
   schema_name => 'SYS',
    object_name => 'TOCP7_A',
   repair_table_name => 'REPAIR_TABLE',
   corrupt_count => num_corrupt);
  dbms_output.put_line( 'Find  '|| num_corrupt||' Bolcks.'  );
END;

DECLARE num_fix INT;
BEGIN
num_fix := 0;
DBMS_REPAIR.FIX_CORRUPT_BLOCKS (
           schema_name => 'SYS',
           object_name => 'TOCP7_A',
           object_type => DBMS_REPAIR.TABLE_OBJECT,
           repair_table_name => 'REPAIR_TABLE',
   fix_count => num_fix);
     dbms_output.put_line( 'Fix  '|| num_fix||' Bolcks.'  );
END;


select  count(*) from tocp7_a;
begin
DBMS_REPAIR.skip_corrupt_blocks ( schema_name => 'SYS',
                      object_name =>'TOCP7_A',
                      object_type => DBMS_REPAIR.TABLE_OBJECT);
                      end;
            
select  * from dba_tables ;
select   s.skip_corrupt ,s.table_name from dba_tables s
where s.table_name='TOCP7_A' and s.owner='SYS';


DECLARE num_orphans INT;
BEGIN
num_orphans := 0;
DBMS_REPAIR.DUMP_ORPHAN_KEYS (
  schema_name => 'SYS',
  object_name => 'IOCP7_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;

select  * from REPAIR_TABLE;
select  * from ORPHAN_KEY_TABLE;
select  dump(key) from ORPHAN_KEY_TABLE;
select chr(65) from dual;
select  dump(100) from dual;


  1. select  * from v$database_block_corruption;

  2. select * from v$hm_run;

  3. select  * from v$hm_check;

  4. begin
  5. dbms_hm.run_check('CF Block Integrity Check' , Run_Name=>'CF1',
  6.                  INPUT_PARAMS=>     'CF_BL_NUM=100'                      );
  7.                                             
  8.                                      end;      
复制代码
  1. select  * from dba_tablespaces;

  2. select  * from dba_extents e where e.owner='HR' and e.segment_name='T04209_UNAME';


  3. select  *  from dba_segments e where e.owner='HR' and e.segment_name='T04209_UNAME';

  4. create tablespace tbs05207_a datafile '/u01/app/oracle/oradata/orcl/tbs05207_a.dbf'
  5.    size 10M autoextend on maxsize 1G uniform size  512K;
  6.    
  7.    
  8.   -- dba_data_files ,  dba_free_space

  9.   select  sum(d.bytes)/1024/1024
  10.      from dba_temp_files d where d.tablespace_name='TEMP';
  11.      
  12.      select sum(ue.bytes)/1024/1024
  13.        from dba_undo_extents  ue where ue.tablespace_name='UNDOTBS1'
  14.           and    ue.status <> 'EXPIRED';
  15.          
  16.       select  ep.BYTES_USED/1024/1024 , ep.BYTES_CACHED/1024/1024
  17.         from v_$temp_extent_pool  ep;  


  18. ----
  19. create  bigfile  tablespace tbs05207_b datafile size 5M autoextend on
  20.   maxsize 4T  ;
  21.          
  22.   
  23.   alter tablespace tbs05207_a  add datafile size 10M;
  24.   
  25.   select  * from dba_tablespaces;
  26.   
  27.   CREATE SMALLFILE TABLESPACE "TBS05205_C"
  28.     DATAFILE '+DATA' SIZE 10M LOGGING   
  29.      DEFAULT STORAGE
  30.       ( INITIAL 512K NEXT 512K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 50)
  31.        MINIMUM EXTENT 512K;
  32.   
  33.   
  34.   select  * from dba_segments s where s.owner='HR' and s.segment_name='T05205_C';
  35.   
  36.   select  * from dba_extents e where e.owner='HR' and e.segment_name='T05205_D2';
  37.   
  38.   
  39.   select  * from dba_data_files ;
  40.   
  41.   create tablespace tbs05205_m datafile size 10M extent management local  
  42.           segment space management manual ;
  43.          
  44.           select  * from dbA_tablespaces ;
  45.          
  46.           alter table  hr.t05205_d2 move tablespace tbs05205_m;
  47.   
  48.   
  49.   select * from dba_tables t where t.owner='HR' and t.table_name='T05205_F';
  50.   
  51.   
  52. select  * from dba_data_files;

  53. select  bytes/1024/1024 from dba_segments where  segment_name='TBIG';

  54. drop tablespace tbs05205_m including contents  and datafiles;

  55. alter  database datafile '+DATA/orcl/datafile/tbs05207_b.272.900172891'
  56.   resize 10M ;
  57.   
  58.   drop tablespace inventory  including contents and datafiles;
  59.   
  60.   
  61.   create tablespace tbs05207_c  datafile size 10M;
  62.   alter tablespace tbs05207_c   drop  datafile 12 ;
  63.   
  64.   alter database datafile 10 autoextend on;
  65.   
  66.   alter database datafile '+DATA/orcl/datafile/tbs05207_c.274.900177135' resize 90M;
  67.   
  68.   alter database datafile '+DATA/orcl/datafile/tbs05207_c.275.900177123' resize 90M;
  69.   
  70.   
  71.   select   distinct  segment_name   
  72.   from dba_extents  e  where  e.tablespace_name='TBS05207_C' and e.file_id=12;
  73.   
  74.   alter table hr.tbig move tablespace users;
  75.   
  76.   drop tablespace tbs05207_c including contents and datafiles;
  77.    
  78.          

  79.   
  80.          
复制代码


oracle-internal1.doc.zip

2.91 KB, 下载次数: 1137

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-5 03:19 , Processed in 0.041509 second(s), 27 queries .

快速回复 返回顶部 返回列表