Bo's Oracle Station

查看: 2861|回复: 0

课程第60次(2017-07-25星期二)上完所有11g OCP的内容

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2017-7-25 19:44:41 | 显示全部楼层 |阅读模式
上完1Z0-053第18章
1Z0-052
19章(上完19章),1Z0-05321章(上完21章)1Z0-063多租户部分共9章(上完0章)
总共上完全部49章中的40

压缩建议者(唯一没有出现在Advisor Home的建议者),建议Exadata HCC 压缩率:
  1. declare
  2.   v_blkcnt_cmp number;
  3.   v_blkcnt_uncmp  number;
  4.   v_row_cmp number;
  5.   v_row_uncmp number;
  6.   v_cmp_ratio number;
  7.   v_comptype_str  varchar2(200);
  8. BEGIN
  9. DBMS_COMPRESSION.GET_COMPRESSION_RATIO(scratchtbsname => 'USERS',
  10.                                                                                              ownname =>'HR',
  11.                                                                                              OBJNAME =>'T_BASIC_BIG',
  12.                                                                                              SUBOBJNAME =>null,
  13.                                                                                              comptype => 16,
  14.                                                                                              blkcnt_cmp => v_blkcnt_cmp,
  15.                                                                                              blkcnt_uncmp =>  v_blkcnt_uncmp,
  16.                                                                                              row_cmp =>v_row_cmp,
  17.                                                                                              row_uncmp => v_row_uncmp,
  18.                                                                                              cmp_ratio =>  v_cmp_ratio,
  19.                                                                                              comptype_str =>v_comptype_str);                                                  
  20. DBMS_OUTPUT.PUT_LINE('Blk count compressed = ' || v_blkcnt_cmp);
  21. DBMS_OUTPUT.PUT_LINE('Blk count uncompressed = ' || v_blkcnt_uncmp);
  22. DBMS_OUTPUT.PUT_LINE('Row count per block compressed = ' || v_row_cmp);
  23. DBMS_OUTPUT.PUT_LINE('Row count per block uncompressed = ' || v_row_uncmp);
  24. DBMS_OUTPUT.PUT_LINE('ratio: '||v_cmp_ratio);
  25. DBMS_OUTPUT.PUT_LINE('Compression type = ' || v_comptype_str);
  26. end;
复制代码
BASIC压缩,不能删除列:
  1. create table t_basic_col( a  number , b varchar2(20))  compress ;
  2. insert into t_basic_col values ( 1,'A') ;
  3. commit;
  4. create table t_oltp_col( a  number , b varchar2(20))  compress  for oltp;
  5. insert into t_oltp_col values ( 1,'A') ;
  6. commit;
  7. select  * from  t_basic_col;
  8. select  * from t_oltp_col;
  9. alter table  t_basic_col drop column b;
  10. alter table  t_basic_col drop ( b);
  11. alter table t_oltp_col drop column b;
  12. select  * from t_oltp_col;
复制代码
BASIC压缩,不能shrink space:
  1. SQL> select  count(*) from t_big_basic;
  2. select        count(*) from t_big_basic
  3.                       *
  4. ERROR at line 1:
  5. ORA-00942: table or view does not exist


  6. SQL> select  count(*)  from t_basic_big;

  7.   COUNT(*)
  8. ----------
  9.     326450

  10. SQL> delete from t_basic_big;

  11. 326450 rows deleted.

  12. SQL> commit;

  13. Commit complete.

  14. SQL> alter table t_basic_big shrink space compact;
  15. alter table t_basic_big shrink space compact
  16. *
  17. ERROR at line 1:
  18. ORA-10635: Invalid segment or tablespace type


  19. SQL> delete from tbig;

  20. 326449 rows deleted.

  21. SQL> commit;

  22. Commit complete.

  23. SQL> alter table tbig shrink space compact;
  24. alter table tbig shrink space compact
  25. *
  26. ERROR at line 1:
  27. ORA-10636: ROW MOVEMENT is not enabled


  28. SQL> alter table tbig enable ROW MOVEMENT;

  29. Table altered.

  30. SQL> alter table tbig shrink space compact;


  31. Table altered.

  32. SQL> SQL>
  33. SQL> alter table tbig shrink space;

  34. Table altered.

  35. SQL> alter table tbig shrink space compact;

  36. Table altered.

  37. SQL> alter table t_basic_big shrink space compact;
  38. alter table t_basic_big shrink space compact
  39. *
  40. ERROR at line 1:
  41. ORA-10635: Invalid segment or tablespace type


  42. SQL>
  43. SQL> alter table t_basic_big shrink space;
  44. alter table t_basic_big shrink space
  45. *
  46. ERROR at line 1:
  47. ORA-10635: Invalid segment or tablespace type


  48. SQL> alter table t_basic_big  move tablespace users;

  49. Table altered.

复制代码
关于IOT:
  1. select  s.BYTES/1024/1024
  2. from dba_segments s
  3.   where s.SEGMENT_NAME='T04209_UNAME';
  4.   
  5.   select  *
  6.    from dba_indexes i where i.TABLE_NAME='IOT1';
  7.    
  8.    select  * from dba_objects o
  9.     where o.OBJECT_NAME='IOT1';
  10.         
  11.         select  * from dba_tables t
  12.          where t.TABLE_NAME  like '%97831%';
  13.          
  14.          select  * from hr.SYS_IOT_OVER_97831;
  15.          
  16.          select  * from hr.SYS_IOT_MAP_97831;
  17.          
  18.          grant resumable to hr;
  19.          
  20.          create tablespace tbs3 datafile size 5M autoextend off;
  21.          
  22.          select  * from dba_resumable;
  23.    
复制代码
关于SUSPEND:
  1. create table t3 ( a number )  tablespace tbs3 storage ( initial 6M ) ;
复制代码
  1. CREATE OR REPLACE TRIGGER SYS.TRG_SUSPEND
  2. AFTER SUSPEND
  3. ON DATABASE
  4. declare
  5. v_size number;
  6.   pragma AUTONOMOUS_TRANSACTION;
  7. begin
  8.   select  bytes into v_size from dba_data_files where  file_name='/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbssmall_7137jokm_.dbf';
  9.   v_size := v_size + 524288;
  10.   execute immediate 'alter database datafile  ''/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbssmall_7137jokm_.dbf''  resize '||v_size;
  11. commit;
  12. end;
复制代码


回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-17 01:53 , Processed in 0.039473 second(s), 24 queries .

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