Sponsored Content
Special Forums UNIX and Linux Applications Running oracle commands Directly from Command Line Post 302420314 by SkySmart on Tuesday 11th of May 2010 09:26:44 AM
Old 05-11-2010
Running oracle commands Directly from Command Line

In mysql, I can get what I want from a database without having to log into mysql. works great for me and it is perfect.

now, i want to be able to do the same in oracle but I dont know how to.

For example, if i want to retrieve information from the mysql database from the command line, i issue a command similar to the below:

Code:
mysql --pager=/usr/bin/less -u cacti_user -p -e 'select hostname,description,availability,notes,availability_method from host' cacti

Oracle has to have similar thing to this. What is it? How can I retrieve this same information from a database using the command line?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Commands and Command Line Flags

Hello I'm very new to unix, am learning it as part of my new job. I have a book which has a list in the back, of a number of commands and their command line flags, detailing what these flags are used for. I've been looking everywhere for an electronic copy of this type of list, so I can... (4 Replies)
Discussion started by: Kedgeboy
4 Replies

2. Shell Programming and Scripting

Script an Oracle Command Line Blackout

Has anyone scripted an OEM (Oracle Enterprise Manager) blackout within a shell script? I can script the "emctl blackout" command, however, there are issues with unique names, etc. in 10g and I hate to re-create the wheel if someone has found a great way to do this. Thanks for your time. (0 Replies)
Discussion started by: pattieatte
0 Replies

3. HP-UX

command su : enter directly

Hi, a simple question : How can I sent user and password to the command su. I need this for a script, but the problem is the command su wait for the password. Thanks. (2 Replies)
Discussion started by: mvaquerm
2 Replies

4. UNIX for Dummies Questions & Answers

Running two commands in one line

hi! how do i run 2 command from the same line e.g: 'which screen' and then ls -la 'which screen' (4 Replies)
Discussion started by: rdns
4 Replies

5. Solaris

what is the command to see which database ie..oracle in running on solaris 10

what is the command to see which database ie..oracle in running on solaris 10 (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

6. UNIX for Dummies Questions & Answers

How do you use UNIX commands in the Windows Command Line?

I tried opening the windows command line and typing UNIX commands, but they don't work. It kept saying that it was not recognized as an internal or external command, operable program or batch file. Removed strange sentence with even stranger link I need to use UNIX commands such as 'less',... (9 Replies)
Discussion started by: vlay2
9 Replies

7. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

8. Shell Programming and Scripting

Redirect output directly with DOS end of line

Hi guys, I have some echo scripts and awk scripts like these: echo "some text" > output1 . . awk '{....}{print}' input > output2Both output1 and output2 are saved with unix END Of Line, then, is there an option to include within echo command and awk command to save the output as DOS END Of... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

9. Shell Programming and Scripting

Issue with running multiple commands withing su command

RHEL 6.2/Bash shell root user will be executing the below script. It switches to oracle user and expect to do the following things A. Source the environment variables for BATGPRD Database (the file used for sourcing is shown below after the script) B. Shutdown the DB from sqlplus -- The... (13 Replies)
Discussion started by: omega3
13 Replies

10. UNIX for Beginners Questions & Answers

Another one line command where I'd like to determine if Ubuntu or Red Hat when running command

Hello Forum, I'm making very good progress on my report thanks to the very helpful people on this forum. I've been able to successfully create my report for my Red Hat servers. But I do have a few ubuntu servers in the mix and I'd like to capture some data from them when an ssh connection is... (8 Replies)
Discussion started by: greavette
8 Replies
MQdb::Database(3pm)					User Contributed Perl Documentation				       MQdb::Database(3pm)

NAME - MQdb::Database
DESCRIPTION
Generalized handle on an DBI database handle. Used to provide an instance which holds connection information and allows a higher level get_connection/ disconnect logic that persists above the specific DBI connections. Also provides a real object for use with the rest of the toolkit. SUMMARY
MQdb::Database provides the foundation of the MappedQuery system. Databases are primarily specified with a URL format. The URL format includes specification of a driver so this single method can select among the supported DBD drivers. Currently the system supports MYSQL, Oracle, and SQLite. The URL also allows the system to provide the foundation for doing federation of persisted objects. Each DBObject contains a pointer to the Database instance where it is stored. With the database URL and internal database ID, each object is defined in a global space. Attributes of MQdb::Database driver : mysql, oracle, sqlite (default mysql) user : username if the database requires password : password if the database requires host : hostname of the database server machine port : IP port of the database if required (mysql default is 3306) dbname : database/schema name on the database server for sqlite, this is the database file Example URLS mysql://<user>:<pass>@<host>:<port>/<database_name> mysql://<host>:<port>/<database_name> mysql://<user>@<host>:<port>/<database_name> mysql://<host>/<database_name> oracle://<user>:<pass>@/<database_name> oracle://<user>:<pass>@<host>:<port>/<database_name> sqlite:///<database_file> CONTACT
Jessica Severin <jessica.severin@gmail.com> LICENSE
* Software License Agreement (BSD License) * MappedQueryDB [MQdb] toolkit * copyright (c) 2006-2009 Jessica Severin * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Jessica Severin nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Description: instance creation method Parameter : a hash reference of options same as attribute methods Returntype : instance of this Class (subclass) Exceptions : none new Description: instance creation method Returntype : instance of this Class (subclass) Exceptions : none init Description: initialization method which subclasses can extend Returntype : $self Exceptions : subclass dependent new_from_url Description: primary instance creation method Parameter : a string in URL format Returntype : instance of MQdb::Database Examples : my $db = MQdb::Database->new_from_url("mysql://<user>:<pass>@<host>:<port>/<database_name>"); e.g. mysql://<host>:<port>/<database_name> e.g. mysql://<user>@<host>:<port>/<database_name> e.g. mysql://<host>/<database_name> e.g. sqlite:///<database_file> my $class = shift; Exceptions : none copy Description: makes a copy of the database configuration. New instance will have its own database connection Returntype : instance of MQdb::Database dbc Description: connects to database and returns a DBI connection Returntype : DBI database handle Exceptions : none disconnect Description: disconnects handle from database, but retains object and all information so that it can be reconnected again at a later time. Returntype : none Exceptions : none full_url Description: returns the URL of this database with user and password Returntype : string Exceptions : none url Description: returns URL of this database but without user:password used for global referencing and federation systems Returntype : string Exceptions : none xml Description: returns XML of this database but without user:password used for global referencing and federation systems Returntype : string Exceptions : none execute_sql Description : executes SQL statement with external parameters and placeholders Example : $db->execute_sql("insert into table1(id, value) values(?,?)", $id, $value); Parameter[1] : sql statement string Parameter[2..] : optional parameters for the SQL statement Returntype : none Exceptions : none do_sql Description : executes SQL statement with "do" and no external parameters Example : $db->do_sql("insert into table1(id, value) values(null,'hello world');"); Parameter : sql statement string with no external parameters Returntype : none Exceptions : none fetch_col_value Arg(1) : $sql (string of SQL statement with place holders) Arg (2...) : optional parameters to map to the placehodlers within the SQL Example : $value = $self->fetch_col_value($db, "select some_column from my_table where id=?", $id); Description: General purpose function to allow fetching of a single column from a single row. Returntype : scalar value Exceptions : none Caller : within subclasses to easy development perl v5.10.0 2009-05-30 MQdb::Database(3pm)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy