05-07-2009
Shell scripting+connect to oracle database+spooling
Hi! Everyone
I am new to the shell scripting basically.I have been asked to create a shell script that connect to a oracle database to read data from a particular schema then spool it into a csv file then email to customer.
Can anybody let me know how to go about that.
I have create this but I get no results,what am I doin wrong?
sqlplus username/password@database << EOF
SPOOL /app/oracle/product/dummy.txt
SET LINESIZE 100
SET PAGESIZE 50
SELECT *
FROM table_name;
SPOOL OFF
EXIT;
EOF
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have several users to create on my test Oracle database taking the scripts from the Production Oracle database. I have a separate text file where I have user-id and passwords maintained. I need help in writing a shell script to go thru the user creation scripts and replace VALUES... (1 Reply)
Discussion started by: rparavastu
1 Replies
2. Shell Programming and Scripting
I am trying to connect to Oracle Databse from UNIX box using sqlplus command. But i get sqplus not found message.
$ sqlplus
sqlplus: not found
I have searched in forums and all are suggesting to set environment varaibles...can somebody tell me what variables to set and how to set.and the... (12 Replies)
Discussion started by: angelarosh
12 Replies
3. Shell Programming and Scripting
Hi all
I am working in datawarehouse project and use DB2 database . shell scripting is written to connect with DB2 database in my application but i dont know how to connect with oracle databse or other databases.Is there any command in unix to connect any of these datbases? (6 Replies)
Discussion started by: vijays3
6 Replies
4. Shell Programming and Scripting
I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error:
ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies
5. Shell Programming and Scripting
Hi Unix Gurus,
I have a requirement to write a script, Oracle DB gets referesh every 6hrs, hence we need write a script to connect to the database , if it connects it should generate a file to proceed the next job application or when an error when connectiong to DB it should not generate any... (8 Replies)
Discussion started by: bshivali
8 Replies
6. Shell Programming and Scripting
Hi All,
I am newbie to unix shell scripting. I want to connect to oracle database using shell script. I know how to connect DB using user name and password but my question is if my password is having '@' sign then how to connect.
I have tried like below,
cnt=`sqlplus -s /nolog << EOFSQL
... (3 Replies)
Discussion started by: pmotewar
3 Replies
7. Shell Programming and Scripting
Hi All,
We are having LINUX server.
I would like to connect to oracle database from server to with the help of shell script and execute a procedure.
We dont have oracle installed to use sqlplus and connect to database.
Do we have any command to connect to database using JDBC drivers.
... (1 Reply)
Discussion started by: Girish19
1 Replies
8. UNIX and Linux Applications
Good evening
I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus.
I tried to find out the user/passwd and service name by env variable and all Ive got is this:
ORACLE_SID_REPCOL=SCL_REPCOL
ORACLE_SID=xmeta
ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies
9. Shell Programming and Scripting
could someone please help me in shell scripting. i want to connect to oracle database which is on remote sever.
requirement:
1 want to check files in source directory if file exist then a execute a corresponding batch jobs on unix sever and fetch data from oracle database which is on remote... (2 Replies)
Discussion started by: refi123
2 Replies
10. Shell Programming and Scripting
Dear All,
I am trying to write a script which will generate output to a file based on input files on basis of a pattern which I am able to do so. But, I am stuck as I am trying to connect this to database server. Below is my command and output details.
Input Code
filedate=$(date... (6 Replies)
Discussion started by: grvk101
6 Replies
LEARN ABOUT DEBIAN
tangram::relational
Tangram::Relational(3pm) User Contributed Perl Documentation Tangram::Relational(3pm)
NAME
Tangram::Relational - Orthogonal Object Persistence in Relational Databases
SYNOPSIS
use Tangram;
$schema = Tangram::Relational->schema( $hashref );
Tangram::Relational->deploy($schema, $dbh);
$storage = Tangram::Relational->connect( $schema,
$data_source, $username, $password );
$storage->disconnect();
Tangram::Relational->retreat($schema, $dbh);
DESCRIPTION
This is the entry point in the vanilla object-relational persistence backend. Vendor-specific backends should be used when they exist. Cur-
rently Mysql, Sybase and Oracle have such backends; see Tangram::mysql, Tangram::Sybase and Tangram::Oracle.
More backends could be added in the future; they might implement persistence in XML documents, pure object databases, using C database
libraries to bypass the need for an RDBMS, etc.
CLASS METHODS
schema
$schema = Tangram::Relational->schema( $hashref );
Returns a new Schema object. See Tangram::Schema.
deploy
Tangram::Relational->deploy($schema);
Tangram::Relational->deploy($schema, HANDLE);
Tangram::Relational->deploy($schema, @dbi_args);
Writes SQL statements for preparing a database for use with the given $schema.
Called with a single argument, writes SQL statements to STDOUT.
Called with two arguments, writes SQL statements to HANDLE. HANDLE may be a DBI connection handle or a file handle.
Called with more than two arguments, passes all but the first to DBI::connect() and writes statements to the resulting DBI handle, which is
automatically closed.
The SQL code is only guaranteed to work on newly created databases.
connect
$storage = Tangram::Relational->connect( $schema,
$data_source, $user, $password, \%options )
Connects to a storage and return a handle object. Dies in case of failure.
$schema is a Schema object describing the system of classes stored in the database.
$data_source, $user and $password are passed directly to DBI::connect().
\%options is a reference to a hash containing connection options. See Tangram::Storage for a description of available options.
retreat
Tangram::Relational->retreat($schema);
Tangram::Relational->retreat($schema, HANDLE);
Tangram::Relational->retreat($schema, @dbi_args);
Remove the tables created by deploy(). Only guaranteed to work against a database that was deployed using exactly the same schema.
For an explanation of the possible argument lists, see deploy.
WRITING A VENDOR DRIVER
Like Charles Moore (inventor of Forth) used to say, "standards are great, everybody should have one!".
Tangram can take advantage of extensions available in some SQL dialects.
To create a vendor-specific driver, call it "Tangram::Foo" (where "Foo" is the name of the DBI driver, as would be selected with the DBI
connection string "dbi:Foo:"), and derive "Tangram::Relational".
For now, the existing back-ends should be used as examples of how to extend Tangram to support different databases or utilise some of their
more exotic features.
perl v5.8.8 2006-03-29 Tangram::Relational(3pm)