Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Cold backups shell script
Hi Steven,
You did not provide your script code in your post, which you should....
In a shell script (sh, ksh or bash) , the only way to avoid expansion of a $ is to put it into single quotes : '$<identifier>'.
If you want to execute a sql statement from a shell script, the easist
way is to put the statement into a file, script.sql, and then in your
shell script :
sqlplus user/pwd < script.sql > script.output
Putting the sql code directly into the shell script is more complicated, but certainly doable. The main problem is, as you experience, that the shell script will try to expand some characters in the sql statements which should not be expanded.
steven_at_alfisi.com (Steven Alfisi) wrote in message news:<a05aabfc.0211161901.32899cfb_at_posting.google.com>...
> I am running Oracle 9i Enterprise Edition on SuSe linux 7.3 pro. I am
> writing a shell script for a cold backup and the following line is
> giving me an ORA-00942 table not found error...
>
> select 'cp '||name|| ' /data/oracle/os_backups/homedb' from
> v\$controlfile;
>
> The log file that I am spooling too is saying that it's only
> recognizing v as the table name. I thought the \ would allow the
> $controlfile to be part of the table name. I also tried / just for
> sh$ts and giggles. I am using the bash shell. Any ideas?
>
> Thanks in advance,
> Steven
Received on Sun Nov 17 2002 - 09:40:39 CST