Oracle 目录服务
	
    
    
	Create directory让我们可以在Oracle数据库中灵活的对文件进行读写操作,极大的提高了Oracle的易用性和可扩展性。
其语法为:
CREATE [OR REPLACE] DIRECTORY directory
 AS 'pathname
';
本案例具体创建如下:
            create or replace directory exp_dir as '/tmp';
目录创建以后,就可以把读写权限授予特定用户,具体语法如下:
GRANT READ[,WRITE] ON DIRECTORY directory
 TO username
;
例如:
            grant read, write on directory exp_dir to eygle;
此时用户eygle就拥有了对该目录的读写权限。
让我们看一个简单的测试:
            SQL> create or replace directory UTL_FILE_DIR as '/opt/oracle/utl_file';
            Directory created.
            SQL> declare
            2    fhandle utl_file.file_type;
            3  begin
            4    fhandle := utl_file.fopen('UTL_FILE_DIR', 'example.txt', 'w');
            5    utl_file.put_line(fhandle , 'eygle test write one');
            6    utl_file.put_line(fhandle , 'eygle test write two');
            7    utl_file.fclose(fhandle);
            8  end;
            9  /
            PL/SQL procedure successfully completed.
            SQL> !
            [oracle@jumper 9.2.0]$ more /opt/oracle/utl_file/example.txt
            eygle test write one
            eygle test write two
            [oracle@jumper 9.2.0]$
类似的我们可以通过utl_file来读取文件:
            SQL> declare
            2    fhandle   utl_file.file_type;
            3    fp_buffer varchar2(4000);
            4  begin
            5    fhandle := utl_file.fopen ('UTL_FILE_DIR','example.txt', 'R');
            6
            7    utl_file.get_line (fhandle , fp_buffer );
            8    dbms_output.put_line(fp_buffer );
            9    utl_file.get_line (fhandle , fp_buffer );
            10    dbms_output.put_line(fp_buffer );
            11    utl_file.fclose(fhandle);
            12  end;
            13  /
            eygle test write one
            eygle test write two
            PL/SQL procedure successfully comple
    
     
	
	
    
    
	相关文档:
        
    
    
一、查询某个字段重复
      select *
          from User u
         where u.user_name in (select u.user_name 
           &nbs ......
	
    
        
    
    
Oracle 数据库 11g面向 DBA 和开发人员的重要新特性:SecureFiles:
1、SecureFiles:新 LOB 
了解如何使用新一代 LOB:SeureFiles。SecureFiles 集外部文件和数据库 LOB 方法的优点于一身,可以存储非结构化数据,允许加密、压缩、重复消除等等。 
数据库驻留 BLOBS 或 OS 文件 
您在 Oracle 数据库中 ......
	
    
        
    
    
一.逻辑Standby的准备工作
1  确认操作的对象和语句是否能被逻辑Standby支持
由于逻辑Standby是通过SQL应用来保持与Primary数据库的同步。SQL应用与REDO应用是有很大的区别,REDO应用实际上是在物理Standby端进行RECOVER;SQL应用则是分析重做日志文件中的REDO信息,并将其转换为SQL语句,在逻辑Standby端执 ......
	
    
        
    
    select * from (select pro_id, sum(decode(month, '01', summ)) one,
                    sum(decode(month, '02', summ)) two,
             &nb ......