Sponsored Content
Top Forums Shell Programming and Scripting Issue with quotes when running SQL command from within su -c Post 302894410 by radoulov on Tuesday 25th of March 2014 11:28:30 AM
Old 03-25-2014
Try this:

Code:
su - oracle -c "
export ORACLE_SID=BRCFMS
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
export PATH=\$PATH:\$ORACLE_HOME/bin

sqlplus -s scott/tiger <<EOF
spool /home/oracle/mytestSQL.log

update master_conf set config1='stomper-chk' where conf_id = 432;

exit
EOF
"

Or just use a SQL script instead of here-doc.
This User Gave Thanks to radoulov For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

running .sh, .sql .etc how to?

hi all yes, I am a beginner in Unix,-sun solorais--V8... what is the command to run files.... single and batch jobs....any help would be great... Cheers ps...i know running files in Sqlplus on Unix prompt, I can use the @' sign...but how does this work.. Cheers E (2 Replies)
Discussion started by: etravels
2 Replies

2. Shell Programming and Scripting

SQL scripts not running, possible timeout issue?

I am a novice Unix scripter and need a little advice/help on a script I've written that's causing some problems. We are using Solaris 9 on a Sun box and the script is invoked with the korn shell. I have a two-part question: I wrote a shell script that calls and executes 3 separate sql scripts,... (3 Replies)
Discussion started by: E2004
3 Replies

3. UNIX for Advanced & Expert Users

how to put quotes ina .sql file

Hi i am new on Unix.......... I have to write a ddl and for tables and I am using single quotes in the comment for the table and its column...........but when i see on the unix server the ' dont show . e.g. DROP TABLE DMR_PURGED; CREATE TABLE DMR_PURGED ( HEALTH_SERVICE_ID ... (9 Replies)
Discussion started by: agarwalniru
9 Replies

4. Shell Programming and Scripting

How can i use single quotes for SQL command in shell script

Hi. please help me to write the following query in a shell script. the Query is :select no,salary from emp_info where name='$var_name' the following is my code. #! /bin/sh var_name=$1 sqlplus -s user/pwd@DB << EOF select no,salary from emp_info where name="'$var_name'";... (4 Replies)
Discussion started by: little_wonder
4 Replies

5. Shell Programming and Scripting

syntax issue with quotes in mysql command for a bash script

i'm trying to write a bash script that executes a mysql statement mysql -sN -e INSERT INTO "$database"."$tableprefix"users (var1, var2,var3) VALUES (123, '1','') i don't know where to put the quotes it doesnt work with this one: ` it seems i can only put double quotes around the... (0 Replies)
Discussion started by: vanessafan99
0 Replies

6. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies

7. 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

8. Solaris

Primary key issue when running Oracle sql file

I got a issue with running the following script below if I remove the inserts and alter table the tables will install just fine but if I try and do the full thing in one go i get the below error dose any one have any ideas on this problem? its got me spinning, thanks. REM REM List of... (1 Reply)
Discussion started by: Wpgn
1 Replies

9. Shell Programming and Scripting

Issue in running a command line utility in CRON

Hi Everyone! I am facing an issue in running a command line utility from the CRON. This utility displays IPC statistics on UNIX message queues: The "queue name" and the "count" of messages in the queue. When running this utility from prompt, it will provide an output on the screen, like the... (4 Replies)
Discussion started by: vai_sh
4 Replies

10. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
asadmin-export(1AS)						   User Commands					       asadmin-export(1AS)

NAME
asadmin-export, export - marks a variable name for automatic export to the environment of subsequent commands in multimode SYNOPSIS
export [ name=value [ name=value]*] Marks a variable name for automatic export to the environment of subsequent commands. All subsequent commands use the variable name values as specified; unless you unset them or exit multimode. If only the variable name is specified, the current value of that variable name is displayed. If the export command is used without any arguments, a list of all the exported variables and their values is displayed. Exported shell environment variables set prior to invoking the asadmin utility are imported automatically and set as exported variables within asadmin. Unexported environment variables cannot be read by the asadmin utility. OPERANDS
name=value variable name and value for automatic export to the environment to be used by subsequent commands. Example 1: Using export to list the environment variables asadmin> export AS_ADMIN_HOST=bluestar AS_ADMIN_PORT=8000 AS_ADMIN_USER=admin AS_ADMIN_PASSWORD=password asadmin> export AS_ADMIN_PREFIX=server1.jms-service asadmin> export //to list the environment variables that are set AS_ADMIN_HOST=bluestar AS_ADMIN_PORT=8000 AS_ADMIN_USER=admin AS_ADMIN_PASSWORD=******** AS_ADMIN_PREFIX=server1.jms-service Where: the export command lists the environment variables that are set. In this case, the environment variables have been set to: the host is bluestar, the port is 8000, the administrator user is admin with an associated password, and the prefix is server1.jms-service. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-unset(1AS), asadmin-multimode(1AS) J2EE 1.4 SDK March 2004 asadmin-export(1AS)
All times are GMT -4. The time now is 11:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy