Feb 14, 2011

Export Data From an Oracle's Table to a Flat File on the Unix Box

How to Export Data From an Oracle's Table to a Flat File on the Unix Box
By Kristen Waters, eHow Contributor

Clck here to find more
Oracle is a relational database that can be installed on the Unix operating system. You can output the contents of Oracle SQL statements to a flat file that is stored outside of the Oracle database. This file is a text file that contains the information from the table at the moment that it was created. It will not be updated or changed by the changes made to the Oracle database.
Difficulty: Moderately Easy
Instructions
Things You'll Need:

    * Unix operating system
    * Oracle database

   1.Log into the Unix machine with your Oracle username.
   2.open a terminal window.
   3. Type the command "sqlplus" to log into the Oracle database. You will be presented with the "SQL>" command prompt where you will type the following commands.
   4.
      Type the command "SET SPACE 0" to set the space between columns in the text file.
   5.
       Type the command "SET LINESIZE 75" to set the line size for the text file.
   6.
         Type the command "SET PAGESIZE 0" to suppress all headings, page breaks, titles, the initial blank line and other formatting information in the text file.
   7.
         Type the command "SET HEADING OFF" to suppress the printing of page headings in the text file.
   8.
      Type the command "SET MARKUP HTML OFF SPOOL OFF" stop the printing of HTML markup information.
   9.
       Type the command "SET COLSEP " "" to use a space (" ") to separate the columns in the text file.
  10.
        Type the command "SPOOL output.txt" to send the output of the following statements to a text file named "output.txt."
  11.
       Type the statement "SELECT * from table;" to select all of the data from the table. Replace the the word "table" with the actual name of the table.
  12.
        Type the command "SPOOL off" to stop the writing of output to the text file.
  13.
        Type the command "QUIT" to exit the Oracle database. You will be presented with the normal Unix command prompt where you will type the next command.
  14.
        Type the command "cat output.txt" to view the contents of the text file.


Read more: How to Export Data From an Oracle's Table to a Flat File on the Unix Box | eHow.com http://www.ehow.com/how_5682976_export-flat-file-unix-box.html#ixzz1Dy7bL466

No comments:

Post a Comment