Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Export Oracle multiple tables to multiple csv files using UNIX shell scripting Post 303043735 by Hope on Wednesday 5th of February 2020 08:18:59 AM
Old 02-05-2020
Thanks for the comments

Thank you for your feedback,

Sorry for choosing a confusing variable "Export". I have changed it to Download_job.
The first table is exported to the first file as needed and unfortunately, there is no error message to show you.


here is my updated code:

Code:
export FILE="/abc/autom/file/geo_JOB.csv"

Download_job = `sqlplus -s dev01/password@dEV3 <<EOF
SET HEADING ON
SET WRAP OFF
SET TRIMSPOOL ON
SET TRIMOUT ON
SET PAGESIZE 50000
SET COLSEP ","
SET LINESIZE 500
SET NEWPAGE NONE
SET FEEDBACK OFF
SET VERIFY OFF
SET UNDERLINE OFF

SPOOL $FILE

SELECT * FROM geo_JOB ;

export FILE="/abc/autom/file/geo_JOB2.csv"

SELECT * FROM geo_JOB2;


SPOOL OFF
EXIT
EOF`

Moderator's Comments:
Mod Comment
Please use code tags when posting data and code samples!

Last edited by vgersh99; 02-05-2020 at 11:12 AM.. Reason: code tags, please!
This User Gave Thanks to Hope For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix script to export data from csv file to oracle database

Hello people, Need favour. The problem I have is that, I need to develop a unix shell script that performs recurring exports of data from a csv file to an oracle database. Basically, the csv file contains just the first name and last name will be dumped to an Unix server. The data from these... (3 Replies)
Discussion started by: vinayagan
3 Replies

2. Shell Programming and Scripting

Add multiple .csv files as sheets to an excel file in unix.

Hi, I am using Solaris 8. My script outputs 4 .csv files. Currently I am SFTPing the files and creating a new excel file with the 4 files as sheets. Can anyone suggest ways to do this in UNIX ? Thanks, David. (2 Replies)
Discussion started by: libin4u2000
2 Replies

3. Shell Programming and Scripting

Reading data from multiple tables from Oracle DB

Hi , I want to read the data from 9 tables in oracle DB into 9 different files in the same connection instance (session). I am able to get data from one table to one file with below code : X=`sqlplus -s user/pwd@DB <<eof select col1 from table1; EXIT; eof` echo $X>myfile Can anyone... (2 Replies)
Discussion started by: net
2 Replies

4. Shell Programming and Scripting

How to process multiple input files using Shell scripting

Hi, I would like to write a for loop that does the following: I have a file called X.txt and other files called 1.txt,2.txt, .....,1000.txt. I want to substitute the 6th column of the file X.txt with 1.txt and store the output as X.1. Then I want to do the same with X.txt and 2.txt and store... (0 Replies)
Discussion started by: evelibertine
0 Replies

5. Shell Programming and Scripting

How to run multiple functions in Background in UNIX Shell Scripting?

Hi, I am using ksh , i have requirement to run 4 functions in background , 4 functions call are available in a case that case is also in function, i need to execute 1st function it should run in background and return to case and next i will call 2nd function it should run in background and... (8 Replies)
Discussion started by: karthikram
8 Replies

6. Shell Programming and Scripting

Assigning multiple column's value from Oracle query to multiple variables in UNIX

Hi All, I need to read values of 10 columns from oracle query and assign the same to 10 unix variables. The query will return only one record(row). I tried to append all these columns using a delimiter(;) in the select query and assign the same to a single variable(V) in unix. I thought I... (3 Replies)
Discussion started by: hkrishnan91
3 Replies

7. Shell Programming and Scripting

Finding total distinct count from multiple csv files through UNIX script

Hi All , I have multiple pipe delimited csv files are present in a directory.I need to find out distinct count on a column on those files and need the total distinct count on all files. We can't merge all the files here as file size are huge in millions.I have tried in below way for each... (9 Replies)
Discussion started by: STCET22
9 Replies

8. Shell Programming and Scripting

Tabbed multiple csv files into one single excel file with using shell script not perl

Hi Experts, I am querying backup status results for multiple databases and getting each and every database result in one csv file. so i need to combine all csv files in one excel file with separate tabs. I am not familiar with perl script so i am using shell script. Could anyone please... (4 Replies)
Discussion started by: ramakrk2
4 Replies

9. Shell Programming and Scripting

Shell Scripting - Select multiple files from numbered list

I am trying to have the user select two files from a numbered list which will eventually be turned into a variable then combined. This is probably something simple and stupid that I am doing. clear echo "Please Select the Show interface status file" select FILE1 in *; echo "Please Select the... (3 Replies)
Discussion started by: dis0wned
3 Replies

10. UNIX for Beginners Questions & Answers

How to read multiple files at same time through UNIX scripting?

How to read multiple files at simultaneously? (1 Reply)
Discussion started by: Priyanka_M
1 Replies
exportfs(8)						      System Manager's Manual						       exportfs(8)

NAME
exportfs - maintain list of NFS exported file systems SYNOPSIS
/usr/sbin/exportfs [-avi] [-o options,..] [client:/path ..] /usr/sbin/exportfs -r [-v] /usr/sbin/exportfs [-av] -u [client:/path ..] /usr/sbin/exportfs [-v] /usr/sbin/exportfs -f DESCRIPTION
The exportfs command is used to maintain the current table of exported file systems for NFS. This list is kept in a separate file named /var/lib/nfs/etab which is read by mountd when a remote host requests access to mount a file tree, and parts of the list which are active are kept in the kernel's export table. Normally this etab file is initialized with the list of all file systems named in /etc/exports by invoking exportfs -a. However, administrators can choose to add and delete individual file systems without modifying /etc/exports using exportfs. exportfs and it's partner program mountd work in one of two modes, a legacy mode which applies to 2.4 and earlier versions of the Linux kernel, and a new mode which applies to 2.6 and later versions providing the nfsd virtual filesystem has been mounted at /proc/fs/nfsd or /proc/fs/nfs. If this filesystem is not mounted in 2.6, the legacy mode is used. In the new mode, exportfs does not give any information to the kernel but only provides it to mountd through the /var/lib/nfs/etab file. mountd will listen to requests from the kernel and will provide information as needed. In the legacy mode, any export requests which identify a specific host (rather than a subnet or netgroup etc) are entered directly into the kernel's export table as well as being written to /var/lib/nfs/etab. Further, any mount points listed in /var/lib/nfs/rmtab which match a non host-specific export request will cause an appropriate export entry for the host given in rmtab to be entered into the kernel's export table. OPTIONS
-a Export or unexport all directories. -o options,... Specify a list of export options in the same manner as in exports(5). -i Ignore the /etc/exports file, so that only default options and options given on the command line are used. -r Reexport all directories. It synchronizes /var/lib/nfs/etab with /etc/exports. It removes entries in /var/lib/nfs/etab which are deleted from /etc/exports, and remove any entries from the kernel export table which are no longer valid. -u Unexport one or more directories. -f In 'new' mode, flush everything out of the kernels export table. Any clients that are active will get new entries added by mountd when they make their next request. -v Be verbose. When exporting or unexporting, show what's going on. When displaying the current export list, also display the list of export options. DISCUSSION
Exporting Directories The first synopsis shows how to invoke the command when adding new entries to the export table. When using exportfs -a, all directories in exports(5) are added to etab and the resulting list is pushed into the kernel. The host:/path argument specifies the directory to export along with the host or hosts to export it to. All formats described in exports(5) are supported; to export a directory to the world, simply specify :/path. The export options for a particular host/directory pair derive from several sources. There is a set of default options which can be over- ridden by entries in /etc/exports (unless the -i option is given). In addition, the administrator may override any options from these sources using the -o argument which takes a comma-separated list of options in the same fashion as one would specify them in exports(5). Thus, exportfs can also be used to modify the export options of an already exported directory. Modifications of the kernel export table used by nfsd(8) take place immediately after parsing the command line and updating the etab file. The default export options are sync,ro,root_squash,wdelay. Unexporting Directories The third synopsis shows how to unexported a currently exported directory. When using exportfs -ua, all entries listed in etab are removed from the kernel export tables, and the file is cleared. This effectively shuts down all NFS activity. To remove an export to a host, specify a host:/path pair. This deletes the specified entry from etab and removes the corresponding kernel entry (if any). To remove one or more exports to several hosts, use exportfs -ua. Dumping the Export Table Invoking exportfs without further options shows the current list of exported file systems. When giving the -v option, the list of flags pertaining to each export are shown in addition. EXAMPLES
The following adds all directories listed in /etc/exports to /var/lib/nfs/etab and pushes the resulting export entries into the kernel: # exportfs -a To export the /usr/tmp directory to host django, allowing asynchronous writes, one would do this: # exportfs -o async django:/usr/tmp To unexport the /usr/tmp directory: # exportfs -u django:/usr/tmp To unexport all the directories listed in /etc/exports: # exportfs -au DEPENDENCIES
Exporting to IP networks, DNS and NIS domains does not enable clients from these groups to access NFS immediately; rather, these sorts of exports are hints to mountd(8) to grant any mount requests from these clients. This is usually not a big problem, because any existing mounts are preserved in rmtab across reboots. When unexporting a network or domain entry, any current exports to members of this group will be checked against the remaining valid exports and if they themselves are no longer valid they will be removed. SEE ALSO
exports(5), mountd(8) AUTHORS
Olaf Kirch, <okir@monad.swb.de> Neil Brown, <neilb@cse.unsw.edu.au> 18 July 2003 exportfs(8)
All times are GMT -4. The time now is 06:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy