top of page
Search

Set the UTL_FILE_DIR parameter in oracle-lost years of youth-JavaEye technology...txt

  • mackenziebullock06
  • Jun 15, 2020
  • 2 min read

Step 1: Log in as an administrator user for instance: connsys/password@sidassysdba

Step 2: Setting the operable directory requires specifying the directory where the utl_file package can operate. Ahead of oracle10g, you are able to make use of the following procedures: 1. altersystemsetutl_file_dir='e:\\utl'scope=spfile; two. Within the init.ora file, the configuration is as follows: UTL_FILE=E:\\utl or UTL_FILE_DIR=E:\\utl in oracle10g the advisable configuration utilizing the following approaches: CREATEDIRECTORYutlAS 'E: \\ utl'; see oracleonline: Inthepast, accessibledirectoriesfortheUTL_FILEfunctionswerespecifiedintheinitializationfileusingtheUTL_FILE_DIRparameter.However, UTL_FILE_DIRaccessisnotrecommended.ItisrecommendedthatyouusetheCREATEDIRECTORYfeature, whichreplacesUTL_FILE_DIR.DirectoryobjectsoffermoreflexibilityandgranularcontroltotheUTL_FILEapplicationadministrator, canbemaintaineddynamically (thatis, withoutshuttingdownthedatabase), andareconsistentwithotherOracletools.CREATEDIRECTORYprivilegeisgrantedonlytoSYSandSYSTEMbydefault third step: to authorize specified. User, in an effort to execute utl_fileGRANTEXECUTEONutl_fileTOscott; the fourth step: connscott/tiger can use utl_file generally. ntfs file recovery software : This short article mainly discusses how to use Oracle's UTL_FILE package to implement I/O operations on disk files.   File I/O is very crucial for the development from the database. about ntfs is, if a part of the data inside the database comes in the disk file, then you definitely need to make use of the I/O interface to import the data in to the database. There's no direct I/O interface in PL/SQL. Commonly, you'll be able to use the put_line function in the DBMS_OUTPUT package that comes with Oracle (that may be, I/O operations towards the screen) when debugging programs, but for disk file I/O There's nothing at all you can do with it. The truth is, Oracle also gives a utility package which can execute file I/O ----- UTL_FILE package, employing the functions offered by this utility package to implement disk I/O operations. 1. Preparations Mainly because the Oracle database includes a security management problem using the directory created by the package, not all file directories could be accessed by the UTL_FILE package. To update recover ntfs files , get the UTL_FILE_DIR field in init.ora to * , To ensure that the UTL_FILE package can access all the catalog files. two. Implementation of file I/O The UTL_FILE package delivers quite a few sensible functions for I/O operations, mostly such as the following functions:   fopen  Opens the file from the specified directory path.  Get_line  Get the text of one particular line on the specified file.  Put_line  Write a line of text towards the specified file.  Fclose  Close the specified file.  These functions are utilised to fetch data from a file, after which create the information to the corresponding database. createorreplaceprocedureloadfiledata(p_pathvarchar2,p_filenamevarchar2)asv_filehandleutl_file.file_type;--define a file deal with v_textvarchar2(100);--store text v_nametest_loadfile.name%type; v_addr_jdtest_loadfile.addr_jd%type;v_regiontest;v_regiontest;v_regiontest;v_regiontest;v_regiontest; (p_pathisnullorp_filenameisnull)thengototo_end;endv_totalinserted:=0;/*openspecifiedfile*/v_filehandle:=utl_file.fopen(p_path,p_filename,'r');loopbeginutl_file.get_line(v_filehandle,v_text):exceptionwhen_vv_text);exceptionwhen ,',1,1);v_secondlocation:=instr(v_text,',',1,2);v_name:=substr(v_text,1,v_firstlocation-1);v_addr_jd:=substr(v_text,v_firstlocation+1,v_secondlocation -v_firstlocation-1);v_region:=substr(v_text,v_secondlocation+1);/*Insert database operation*/insertintotest_loadfilevalues(v_name,v_addr_jd,v_region); commit; endloop; to_endnull; endloadfiledata; can not be changed in init.ora As long as you log in with the authority from the administrator, execute: createdirectoryUTL_FILE_TESTas '\\*' really should be fine, no need to start oracle, but other customers desire to use this directory to authorize /gr antcreateanydirectorytoscott; grantcreateanylibrarytoscott; createorreplacedirectoryutllobdiras 'C:\\ep'; In the initsid.ora file, add or modify the key points of setting utl_file_dir: 1. utl_file_dir=*This indicates you'll be able to operate any directory, try not to use 2. utl_file_dir=d:\\This indicates that you can operate the files in the d:\\ directory, but you can't operate the subdirectory 3 within the d:\\ directory. Note that when setting utl_file_dir=path, in the event the path is a lengthy path name, such as c:\\mytemp directory, you must add '', by way of example: utl_file_dir='c:\\mytemp'4. utl_file_dir is often various paths utl_file_dir=c:\\,d:\\,d:\\temp,'c:\\mytemp'5. Following setting, you need to restart the database

 
 
 

Recent Posts

See All

Comments


Join my mailing list

Thanks for submitting!

© 2023 by The Book Lover. Proudly created with Wix.com

bottom of page