Bo's Oracle Station

查看: 2240|回复: 0

课程第42/43/44/45次(2017-08-18星期五和2017-08-20星期天上下午和2017-08-25星期五)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2017-8-18 20:28:49 | 显示全部楼层 |阅读模式
第三阶段New Feature/OCM Exam Preparation31-45
  1. CREATE TABLE sh.func_spec(
  2. id number, doc CLOB ENCRYPT USING 'AES128' )
  3. LOB(doc) STORE AS SECUREFILE
  4. (DEDUPLICATE LOB CACHE NOLOGGING);

  5. select  * from dba_lobs l where l.owner='SH' and l.table_name like 'FUNC_SPEC%';

  6. CREATE TABLE sh.func_spec1(
  7. id number, doc CLOB ) ;

  8. CREATE TABLE sh.test_spec (
  9. id number, doc  CLOB)
  10. LOB(doc) STORE AS SECUREFILE
  11. (COMPRESS HIGH KEEP_DUPLICATES CACHE NOLOGGING);  

  12. select  * from dba_lobs l where l.owner='SH' and
  13.   l.table_name='TEST_SPEC';
  14.   
  15. CREATE TABLE sh.func_spec2(
  16. id number, pic BLOB ENCRYPT USING 'AES128' )
  17. LOB(pic) STORE AS SECUREFILE
  18. (DEDUPLICATE LOB CACHE NOLOGGING);

  19. ---SQL> alter system set encryption wallet c
  20. create directory dir1 as '/home/oracle/dir1';

  21. grant read,write on directory dir1 to sh;


  22. CREATE OR REPLACE PROCEDURE  sh.proc_blob (  p_1 number,
  23.                                                         p_dir  VARCHAR2,
  24.                                                         p_file  VARCHAR2)
  25. IS
  26.    v_f  BFILE;
  27.    v_b blob;
  28. BEGIN
  29.     INSERT INTO sh.func_spec2 values(p_1,   EMPTY_BLOB ()) RETURN   pic    into v_b;
  30.     v_f := BFILENAME (p_dir, p_file);
  31.    DBMS_LOB.FILEOPEN  (v_f, DBMS_LOB.FILE_READONLY);
  32.    DBMS_LOB.LOADFROMFILE (v_b, v_f,   DBMS_LOB.GETLENGTH (v_f));
  33.    DBMS_LOB.FILECLOSE (v_f);
  34.    commit;
  35. end;
  36.    

  37.   
  38. select  * from dba_errors e where e.name='PROC_BLOB';


  39. begin
  40.     sh.proc_blob (1000,'DIR1','GreenMeadow.jpg');
  41.   end;
  42.   
  43.   
  44.   select  * from sh.func_spec2;
  45.   
  46.   
复制代码


  1. alter  TABLE sh.func_spec move tablespace users
  2.   LOB (doc)   store as  
  3. ( tablespace example  );

  4. alter table sh.func_spec1 enable row movement ;

  5. alter table  sh.func_spec1  modify   lob (doc)  ( shrink space );

  6. create table sh.tab1 (id number not null, c clob)
  7. partition by range(id)
  8. (partition p1 values less than (100) tablespace users lob(c) store as lobp1,
  9. partition p2 values less than (200) tablespace users lob(c) store as lobp2,
  10. partition p3 values less than (300) tablespace users lob(c) store as lobp3);


  11. select  * from dba_LOB_PARTITIONS  lp where  
  12.    lp.table_owner='SH' ;

  13. select  * from dba_PART_LOBS  pl
  14. where pl.table_owner='SH';
复制代码



回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-22 20:06 , Processed in 0.039303 second(s), 24 queries .

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