SEARCH YOUR SOLUTION HERE  

SQL commands from SHELL prompt

Hi Friends,

Is it possible to execute SQL or PL/SQL commands from Unix shell prompt. For example, I want to execute a CREATE COMMAND from "$" prompt.

eg.
$ sqlplus SCOTT/TIGER CREATE TABLE t1(I INT)


Posted On: Thursday 15th of November 2012 10:44:41 PM Total Views:  475
View Complete with Replies




Related Messages:

How to save all typed commands in SQLPLUS environment!!!   (165 Views)
Hi I am rajesh, am new to Oracle DBA.i have one doubt. i.e. How can we save the sqlplus environment while from starting to end of the session.. for better to understand please see the attachment.. in this whatever the commands i have entered i want to save those commands into one text file from starting to end of the session... Please help me ...
Help with Unix commands   (130 Views)
I need some help with Unix commands. I have a diretory that I need to gather the following information on files within it. 1. I need a list of all files from January 1, 2002 to today in descending order of the size of the files (biggest file on top). 2. I need total space used by files created in the directory, between January 1, 2002 and today. 3. i need the number of files created between January 1, 2002 and today.
Unix commands from DB Procedure   (130 Views)
How can I call some commands of Unix from my Database Procedure so the the output comes on my sql prompt.
RMAN Maintenance commands   (122 Views)
Hi all, I am a newbie in RMAN so seek openion about RMAN catalog maitenance commands. I am planning to run foll. commmands on every 1st,10th and 20th of every month. allocate channel for maintenance type disk; crosscheck backup of database; crosscheck backup of archivelog all; delete expired backup; release channel; exit RMAN , Pl. advise...
RMAN commands   (131 Views)
can you please explain me what is the function of the second rman command with validate option does, shown below: RMAN>Backup archivelog from time 'sysdate-7'; RMAN>Restore archivelog from time 'sysdate-7' validate;
retrive commands on Solaris   (153 Views)
On Solaris, how do I configure the environment so that I can use "up arrow" key to retrive the command that I just used. On NT command line, it's very easy to use and very handy!
Compression of commands and results?   (205 Views)
I'm doing large inserts and selects from the database during my bulk uploads nightly. Network latency is slowing my process down a few minutes. Is there a way to get the machines on either side of the connection to agree on a compression method for the transmissions and to use it I'm looking for something similar to the Accept-Encoding: gzip that you can use in HTTP. (At least I see google using it) There is no "Processing" happening on the server. Only the oracle connection exists.
insert,update commands are failing with ORA-12571: TNS:packet writer failure   (252 Views)
Selects and Deletes work fine. Using the same connection in TOAD and can do all 4 functions. Through ASP.NET my inserts and updates fail with the above message. Any ideas Using oracle 8i.
RMAN commands   (319 Views)
I am using Oracle 9i RMAN and database instances. I have two instances with exactly the same name on different servers. How do I verify I am connected to the correct instance when I connect via the RMAN TARGET='sys/xxxx@db1 as sysdba' CATALOG=rman/yyyy@db2 I was thinking I could just select the host_name from v$instance, but I can not enter a sql select statement from the rman prompt.
Executing sql commands in MySql Administrator v1.0.19   (130 Views)
I'm using mysql adm and I have problems executing more than one row at a time. Anyone with a workaround or help TIA
Problem running anonymous plsql blocks from shell script   (259 Views)
Im trying to run an anonymous plsql block from a shell script using sqlplus -s but the command doesnt seem to get run. Does anyone know if there are there any known issues with doing this Here is te shell script im trying to run against an oracle 8.1.6 database. #!/usr/bin/sh ####################################################################### # Script to create privileged database user # usage: CreateSchema.sh [USERNAME] [PASSWORD] # # WARNING: THIS SCRIPT WILL DROP THE EXISTING USER IF IT ALREADY EXISTS # # # Mark Blakey 21/11/02 ####################################################################### USERNAME=$1 USERPASSWORD=$2 if [ -n "$2" ] then echo creating user $1 else echo Insufficient number of arguments- please supply more arguments echo usage: CreateSchema.sh [USERNAME] [PASSWORD] echo WARNING: THIS SCRIPT WILL DROP THE EXISTING USER IF IT ALREADY EXISTS exit fi sqlplus -s /nolog
Oracle/solaris monitoring commands   (259 Views)
Problem - An application running on Oracle 8.1.7 on Sun Solaris keeps freezing when user clicks save on application. By rebooting Unix box problem is resolved. 1) What can I look at on the Oracle side. 2) Is there anything that will show what command is being executed before the freeze. 3) How can I see cpu usage, disk io,virtual memory statistics, and processes for CPU and memory usage,network bandwidth usage, can view the entire kernel statistics tree on solaris Let me know
shell script for multiple sid   (391 Views)
I would like to write a shell script that executes when i log in and prompts me for the SID to connect to with a menu like 1)sid = Xiamin 2)sid = World enter your choice : when i say one it should connect to Xiamin. any pointers on how to do this regards Hrishy
shell question   (207 Views)
I know "grep ORA- alert_PROD.log>error.log" will generate a log for all ORA- error in the alert log. What if I need to catch all lines that match any one of the following 3 key words: ORA-, failed, error.
Pass parameters from UNIX shell to SQL*Plus   (170 Views)
(1) How can I pass a parameter value from the shell environemnt to the SQL*Plus environment (2) Also, how can I send the output from sqlplus to a log file when it is run from with a shell script Basically this is what I want to be able to do, but when I do this, the control goes to the log file, and I cannot see what I am typing: within a schell script ... ... sqlplus scott/tiger@db1 @sqlSCRIPT.sql > sqlLOG.log ... ...
Programmatically export mailbox via Powershell - error -2147219963   (318 Views)
, we are trying to automate the user account management using Powershell to handle all interactions with Exchange 2007. The powershell commands are launched from a webservice developed in ASP.NET (C#). The project is practically over aside from the export of the mailbox. When I try to execute the following command: export-mailbox -identity "Mister x" -baditemlimit 1147483648 -pstfolderpath "d:\path\MisterX.pst" We get an error: Export-Mailbox error results: Error was found for MisterX (MisterX@MisteryComp.net) because: An unknown error has occurred., error code: -2147219963 The same command runs fine from the exchange powershell console (same user, same server) We also noticed the command completes successfully if I first run the exact same command directly on powershell (from the same server) and then leave the console window open. If I close the console, the application starts failing again with the same error. If I run the application pool that owns the webservice with Domain Admin account, everything works fine but the user I would like to use has all the necessary rights. I get the feeling Powershell in order to function properly needs a session open in a specific way that I do not understand. Here following the relevant portion of code: RunspaceConfiguration runspaceConf = RunspaceConfiguration.Create(); PSSnapInException PSException = null; PSSnapInInfo info = runspaceConf.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out PSException); Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConf); runspace.Open(); System.Management.Automation.SwitchParameter spConfirmYes; int iNbmaxerreurs = 1147483648; spConfirmYes = false; //Always False Pipeline pipelineEM = runspace.CreatePipeline(); pipelineEM.Commands.Add("Export-Mailbox"); pipelineEM.Commands[0].Parameters.Add("Identity", MailID.ToString()); pipelineEM.Commands[0].Parameters.Add("BadItemLimit", iNbmaxerreurs); pipelineEM.Commands[0].Parameters.Add("Confirm", spConfirmYes); pipelineEM.Commands[0].Parameters.Add("PSTFolderPath", sExportfilePath.ToString() + ExportfileName.ToString() + ".pst"); // Result Recuperation: System.Collections.ObjectModel.Collection psobjResults; System.Collections.ObjectModel.Collection objResultserror; psobjResults = pipelineEM.Invoke(); objResultserror = pipelineEM.Error.ReadToEnd();
SQLPLUS commands with asp   (288 Views)
Hi all, Is that possible to use SQLPLUS commands with asp or asp.net example -------------------- Clear column COLUMN course_name NEW_VALUE crsevar NOPRINT TTITLE LEFT 'course name:' crsevar SKIP 1 BREAK ON course_name SKIP PAGE please answer for my question
Win NT batch and shell script, simple?   (212 Views)
boys and girs; OS= Win NT Oracle= 8.1.6 I am trying to write a simple batch program to run my analyze script once a week. I have the analyze.sql, that was the easy part. What I want to do is create a batch program that will log into SQL and call the .SQL script I have created. I have gotten as far as getting the .CMD to log on to the correct instance but how do you get it to call the .sql script once you are in a sql session
what is the meaning of this shell command, pls help   (223 Views)
$ORACLE_HOME/bin/sqlplus -s '/ as sysdba'
Sql plus shell exit status   (169 Views)
Is there a way of running a script from sql plus and then finding the exit status. Ie this normally works for most unix tools but not sqlplus for some reason. sqlplus user/password