04-10-2009
Creating flat file using SQLPLUS from UNIX Shell Script
I tried in command line also. I am getting the same thing again.
I executed the same sql query from command line. It's giving the output. but the flat file contains does not have any data.
The output flat file contains data as below
Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ] where <option> ::= -H | -V | [ [-L] [-M <o>] [-R <n>] [-S] ]
<logon> ::= <username>[/<password>][@<connect_string>] | / | /NOLOG
<start> ::= @<URI>|<filename>[.<ext>] [<parameter> ...]
"-H" displays the SQL*Plus version banner and usage syntax
"-V" displays the SQL*Plus version banner
"-L" attempts log on just once
"-M <o>" uses HTML markup options <o>
"-R <n>" uses restricted mode <n>
"-S" uses silent mode
Pls help me to solve this problem.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
How to create Flat Files using Unix Shell Script. The Script is supposed to be sheduled to run at a particular time?
Thanks in advance
Appu (4 Replies)
Discussion started by: Aparna_k82
4 Replies
2. Shell Programming and Scripting
Can anybody help me out in sending parameters from sql*plus script to unix shell script without using flat files..
Initially in a shell script i will call sql*plus and after getting some value from some tables, i want that variable value in unix shell script. How can i do this?
Please tell me... (2 Replies)
Discussion started by: Hara
2 Replies
3. Shell Programming and Scripting
Hi,
I want to extract block of data from flat file.
the data will be like this
start of log
One
two
three
end of log
i want all data between start of log to end of log i.e One
two
three to be copied to another file.
This particular block may appear multiple times in same file. I... (4 Replies)
Discussion started by: shirish_cd
4 Replies
4. Shell Programming and Scripting
cron job not running the sqlplus command in shell script but the shell script works fine from command line..
Cronjob:
5 * * * * /home/dreg/script.sh
script.sh:
#!/bin/ksh
/oracle/u000/app/oracle/product/10204/GEN/bin/sqlplus -s <user>/<pass>@<sid/home/dreg/sqlscript.sh
... (18 Replies)
Discussion started by: Ikea
18 Replies
5. UNIX for Dummies Questions & Answers
I want to execute a shell script from sqlplus prompt and get its output back to sqlplus. Is this possible?
if yes just give me an example for doing that. (2 Replies)
Discussion started by: boopathyvasagam
2 Replies
6. UNIX and Linux Applications
using sqlplus I want to execute a .sql script that has dbms_output statments in rhe script. I want to write the dbms_output statements from .sql file to a log file. is this possible. thanks
any help would be appreciated
:wall: (1 Reply)
Discussion started by: TRS80
1 Replies
7. Shell Programming and Scripting
Hi,
I never did this before... what I want to do is execute a SQL query from a unix script and redirect sql query's output to a flat file (comma separated one) without the header info (no column names). I would also want not to print the query's output to the screen.
snapshot of my script:... (13 Replies)
Discussion started by: juzz4fun
13 Replies
8. Shell Programming and Scripting
Hi all,
$ echo $SHELL
/bin/bash
Requirement - How to pass oracle sql script as argument to unix shell script?
$ ./output.sh users.sql
Below are the shell scripts and the oracle sql file in the same folder.
Shell Script
$ cat output.sh
#!/bin/bash
.... (7 Replies)
Discussion started by: a1_win
7 Replies
9. Shell Programming and Scripting
Hi,
I am trying to write a script that calls an Oracle SQL file who in turns call another SQL file. This same SQL file has to be run against the same database but using different username and password at each loop.
The first SQL file is basically a connection test and it is supposed to sort... (2 Replies)
Discussion started by: newbie_01
2 Replies
10. Shell Programming and Scripting
I am new to shell scripting and i want to know how to execute the *.sql files from a folder through sqlplus in shell script and files should be execute in sequentially one by one while execution if any ORA error it has to exit from sqlplus session
1) scripts from external folder
2) logs has... (1 Reply)
Discussion started by: sreekanth Reddy
1 Replies
MYSQL(1) General Commands Manual MYSQL(1)
NAME
mysql - text-based client for mysqld, a SQL-based relational database daemon
SYNOPSIS
mysql [-B|--batch] [-#|--debug= logfile] [-T|--debug-info] [-e|--exec= command] [-f|--force] [-?|--help] [-h|--host= hostname]
[-n|--unbuffered] [-p[pwd]] [--password=[pwd]] [-P|--port= pnum] [-q|--quick] [-r|--raw] [-s|--silent] [-S|--socket= snum] [-u|--user=
uname] [-v|--verbose] [-V|--version] [-w|--wait]
DESCRIPTION
The mysql program provides a curses-based interface to the SQL-based database server daemon, mysqld(1). Full fuller documentation, refer
to the HTML documents installed with the package.
OPTIONS
-B|--batch
Print results with a tab as separator, each row on a new line.
-#|--debug=logfile
Employ the specified debug log.
-T|--debug-info
Print debug information upon exiting.
-e | --exec=command
Execute the specified command and quit (--batch is implicit).
-f|--force
Continue even if the face of a SQL error.
-?|--help
Display a help message and exit.
-h|--host=hostname
Connect to the specified host.
-n|--unbuffered
Flush the buffer after each query.
-p|--password[=pwd]
Employ the specified password when connecting to the database server. If a password is not supplied, it will be requested interac-
tively.
-P|--port=pnum
Employ the specified port number for connecting to the database server.
-q|--quick
Do not cache the result; print it row by row. This may slow down the server if the output is suspended.
-r|--raw
Write fields without conversion. (used with --batch).
-s|--silent
Silent mode: reduce the amount of output.
-S|--socket=snum
Employ the specified socket file for connecting to the database server.
-u|--user=uname
Employ the specified user name for logging in to the server.
-v|--verbose
Verbose mode: write more Specifying this option twice produces a tabular output format.
-V|--version
Print the mysql version number and exit.
-w|--wait
Wait and retry if the database server connection is down.
FILES
/depot/bin/mysql executable
/depot/bin/mysqld executable
/depot/bin/safe_mysqld
executable shell script for starting mysqld safely
/site/var/mysql/data location of database files
EXAMPLE
You can also read a backup dump file back into MySQL with:
mysql database < backup-file.sql
SEE ALSO
isamchk (1), isamlog (1), mysqlaccess (1), mysqladmin (1), mysqlbug (1), mysqld (1), mysqldump (1), mysqlshow (1), msql2mysql (1), perror
(1), replace (1), safe_mysqld (1), which1 (1), zap (1),
AUTHOR
Ver 6.3, distribution 3.20.20 Michael (Monty) Widenius (monty@tcx.se), TCX Datakonsult AB (http://www.tcx.se). This software comes with no
warranty. Manual page by R. P. C. Rodgers, Lister Hill National Center for Biomedical Communication, U.S. National Library of Medicine
(rodgers@nlm.nih.gov).
13 June 1997 MYSQL(1)