Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

regarding the utl_file concept in oracle db

hi all,
i have one select query which fetching recods from 4-5 tables and i am getting 60000 records in that query, so i would like to use utl file and getting those records in the text file. for that what accesss do i need on the server,

i think can i use existing path /apps/orarpt file with read and write prilileges or do we need to bounce the db for utl file parameter.
0
nagavenuiluri
Asked:
nagavenuiluri
  • 5
  • 4
  • 2
1 Solution
 
nagavenuiluriAuthor Commented:
hi all,
after building procedure do i need to login to db and execute that, how should i proceedd.

pls help me on this
0
 
subratabiswasCommented:
Relevant information about how to create, read, write files using utl_file, can be found at http://www.adp-gmbh.ch/ora/plsql/utl_file.html . It has two small but useful examples at the end.

There is no need to log out and log back in after creating a procedure / package; after creation or update, new versions of package / procedure are available immediately for execution in the same session. But if your account is assigned a new privilege (e.g. to create directory, or access to an existing directory), then it would be required to log out and reconnect in order for those new privileges to be effective.
0
 
subratabiswasCommented:
It should be clear from the link above that you will need access to an existing directory, or create directory privilege. Files to be read / written are located on the server.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
nagavenuiluriAuthor Commented:
hi all,
do we need to bounce the database to setup utl file or it is aleady exists in the db, we are using 10g oracle.
0
 
subratabiswasCommented:
Package UTL_FILE is part of the base installation of Oracle. If the database is running, it should be available for execution, no need to bounce any services.
0
 
subratabiswasCommented:
UTL_FILE has been available since Oracle 7.3; there has been some enhancement to include support for DIRECTORY from Oracle 9i. prior to 9i, files could exist only in physical directories pointed to by parameter utl_file_dir; 9i onwards, it is possible to define a DIRECTORY object pointing to a physical directory and create / access files there using URL_FILE.
0
 
swadhinrayCommented:
As subratabiswas: said follow it and you dont need to bounce your DB is under SYS user you will find the UTL packages.

You need write a procedure which will execute the sql statement and export it into a txt or other file format that you want.

You can also use do spool to your query and save it for an example check this link:
http://www.experts-exchange.com/Database/Software/CRM/Oracle/Q_24107028.html

Else if you want you can also implement the UTL file concept.

0
 
nagavenuiluriAuthor Commented:
if i need to execute the procedure in sql so i need the schema privilges with create option right?
0
 
nagavenuiluriAuthor Commented:
Thanks for ur responces.
i mean schema credentials and for that schema it should have create priviliges am i right
0
 
swadhinrayCommented:
if you need to execute then  you need to have execute privileges to on user  and if you wan to create then you need create privileges to you user.

As a sysdba you can grant all the required privileges to your user.
0
 
subratabiswasCommented:
One thing to be highlighted, if not clear already by now, it is not enough to have the path /apps/orarpt existing at the OS level; it is also required to have that path included in parameter UTL_FILE_DIR or to create a DIRECTORY database object pointing to that directory.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now