ORACLE directory Ŀ¼
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 completed.
¿ÉÒÔ²éѯdba_directories²é¿´ËùÓÐdirectory.
SQL> select * from dba_directories;
OWNER DIRECTORY_NAME DIRECTORY_PATH
------------------------------ ------------------------------ ------------------------------
SYS UTL_FILE_DIR /opt/oracle/utl_file
SYS BDUMP_DIR
Ïà¹ØÎĵµ£º
ѧϰOracle DBAÒ²°ë¸ö¶àѧÆÚÁË£¬½ñÌìÃÍÈ»²Å·¢ÏÖ£¬ÔÀ´ÎÒµÄÊ黹ÊǺÜеģ¬ÉϿβÙ×÷ʱºòÒ²Ö»ÊÇÖªµÀ´ó¸ÅÔõô×ö£¬µ«ÊÇÒªÕæµÄÈ«²¿×Ô¼º×ö£¬¶ø²»È¥·Ê黹ÊÇÓÐÒ»¶¨µÄÄѶȵģ¬ËùÒÔÄØ£¬½ñÌ쿪ʼ½«DBA´ÓÍ·¸´Ï°Ò»±é£¬Í¬Ê±ÔÙ²Ù×÷Ò»±é¡£
µÚÒ»Õ£¬Ñ§µÄÊÇOracleµÄÌåϵ½á¹¹£ ......
sqlÓï¾äÈçÏÂ:
select * from userdb40.numservice where ServiceNumber =88880068
and applytime <= to_date('2009-12-26 10:41:44','yyyy-MM-dd HH24:mi:ss')
select to_date('2007-06-28 19:51:20.0','yyyy-MM-dd HH24:mi:ss') from dual; ......
ÔÚÎÒÃÇÏêϸ½éÉÜ֮ǰ£¬ÎÒÃDZØÐë˵Çå³þÒ»µã£ºOracle²»ÌṩÈçɾ³ý±í¡¢ÊÓͼһÑùɾ³ýÊý¾ÝÎļþµÄ·½·¨£¬Êý¾ÝÎļþÊDZí¿Õ¼äµÄÒ»²¿·Ö£¬ËùÒÔ²»ÄÜ“ÒÆ×ß”±í¿Õ¼ä¡£
Ò»¡¢Ê¹ÓÃofflineÊý¾ÝÎļþµÄ·½·¨
·Ç¹éµµÄ£Ê½Ê¹Óãºalter database datafile '...' offline drop;
¹éµµÄ£Ê½Ê¹Ó㺠alter database datafile '.. ......
±È½Ï¹Ù·½µÄ˵·¨
Full
A backup of a datafile that includes every allocated block in the file being backed up. A full backup of a datafile can be an image copy, in which case every data block is backed up. It can also be stored in a backup set, in which case datafile blocks not in use may be skipped, ......