Why execution is different from orginal bash registry$database?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Why execution is different from orginal bash registry$database?
# 1  
Old 01-28-2013
Why execution is different from orginal bash registry$database?

Hi all,

here's my script

Code:
#!/bin/ksh
if [ -z "$DB_CREATE_PATH" ]
then
  export DB_CREATE_PATH=`pwd`
fi

echo
echo "********************--Menu--*****************************"
echo "***                                                      "
echo "*** 1. Pre-Upgrade Steps                                 "
echo "*** 7. Exit                                              "

read a

if [ $a == 1 ]
then

echo "1 Pre-Upgrade Steps"
${ORACLE_HOME}/bin/sqlplus /nolog <<!EOF
set termout on
set echo on
set time on

connect / as SYSDBA;

column timecol new_value timestamp
column spool_extension new_value suffix
SELECT to_char(sysdate,'dd_Mon_yyyy_hhmi') timecol,'.log' spool_extension FROM
sys.dual;
column output new_value dbname
SELECT value || '_' output FROM v$parameter WHERE name = 'db_name';

--step 6 step 7 start
spool logs/tz_version_nls_char_&&dbname&&timestamp&&suffix
select TZ_VERSION from registry$database;
select value from NLS_DATABASE_PARAMETERS where parameter = 'NLS_NCHAR_CHARACTERSET';
spool off
--step 6 step 7 end

exit;
!EOF
fi

when I examine the output code it is as follow
Code:
09:30:41 SQL> select TZ_VERSION from registry;
select TZ_VERSION from registry
                       *
ERROR at line 1:
ORA-00942: table or view does not exist


09:30:41 SQL> select value from NLS_DATABASE_PARAMETERS where parameter = 'NLS_NCHAR_CHARACTERSET';

VALUE
-----------------------------------------------------------------------------------------------------------------------------
-------------------------
AL16UTF16

1 row selected.

09:30:41 SQL> spool off

can someone tell me how do I make sure that registry$database is queried instead of registry?

thanks
# 2  
Old 01-28-2013
Escape the dollar sign:
Code:
select TZ_VERSION from registry\$database;

This User Gave Thanks to Yoda For This Post:
# 3  
Old 01-28-2013
Hi Bipinajith, you are right, I managed to get the issue resolve. thanks a lot!
# 4  
Old 01-28-2013
Try:
Code:
${ORACLE_HOME}/bin/sqlplus /nolog <<"!EOF"

If no expansion is required by the shell.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH Execution Delay / Speedup

I have a BASH script that runs a continuous loop, reading a line from a file, and then spawning a background process to use it. I've placed "date" commands inside it to see where it's slowing down, and everything inside -- including reading the line from the file -- is fast, but the loop bogs... (34 Replies)
Discussion started by: gmark99
34 Replies

2. Shell Programming and Scripting

Copying large files in a bash script stops execution

Hello, I'm new to this forum and like to first of all say hello to everyone. I've got a really annoying problem at the moment. I'm trying to rsync some files (about 200MB with one file of 120MB) from a Raspberry PI with raspbian to a debian server via rsync. This procedure is stored in a... (3 Replies)
Discussion started by: wex_storm
3 Replies

3. Shell Programming and Scripting

How to simulate an execution queue with bash?

I'm running cygwin bash on windows 7 and I'm have some bat files that perform large builds and take a long time and a lot of memory. Therefor, I don't want to builds executing simultaneously (too much memory). How can I implement a queue so I can queue up multiple builds and only execute one... (2 Replies)
Discussion started by: siegfried
2 Replies

4. Shell Programming and Scripting

execution of a string being echoed in bash

hi all, I am trying to do a loop on a series of plotting function shown below: colorlist=(blue red green); n=0; for k in $xy; do psbasemap $range -JM$scale -B10g5 -X1 -Y1 -P -K > $outfile pscoast $range -JM$scale -B10g5 -D$res -P -W$lwidth -G$fill -O -K >> $outfile echo... (1 Reply)
Discussion started by: ida1215
1 Replies

5. Shell Programming and Scripting

Execution problems with BASH Shell Script

Hi I need help with my coding , first time I'm working with bash . What i must do is check if there is 3 .txt files if there is not 3 of them i must give an error code , if al three is there i must first arrange them in alphabetical order and then take the last word in al 3 of the .txt files... (1 Reply)
Discussion started by: linux newb
1 Replies

6. Shell Programming and Scripting

Execution Problems with bash script

Hello, can someone please help me to fix this script, I have a 2 files, one file has hostname information and second file has console information of the hosts in each line, I have written a script which actually reads each line in hostname file and should grep in the console file and paste the... (8 Replies)
Discussion started by: bobby320
8 Replies

7. Shell Programming and Scripting

execution time / runtime -- bash script please help!

Hello, I'm running a bash script and I'd like to get more accurate a runtime information then now. So far I've been using this method: STARTM=`date -u "+%s"` ......... *script function.... ......... STOPM=`date -u "+%s"` RUNTIMEM=`expr $STOPM - $STARTM` if (($RUNTIMEM>59)); then... (6 Replies)
Discussion started by: TehOne
6 Replies

8. Shell Programming and Scripting

Connecting to MS SQL database from bash (using unixODBC)

I've installed unixODBC and I would like to connect to a MS SQL (2005) database from a bash script. Can you post a code example? Thank you! :D J. (0 Replies)
Discussion started by: ph0enix
0 Replies

9. Shell Programming and Scripting

bash script execution with a variable in a single line

Let a script needs a variable to execute. For example if i run ./test.sh then it needs a variable as there is a <STDIN> in the script. I want to execute it as in command line. Let test.sh requires a variable name $number I want to execute it by >test number <enter> how is it possible? (1 Reply)
Discussion started by: shoeb
1 Replies

10. Shell Programming and Scripting

how to write orginal scripts to backups

hi iam new of scripting. give me some informtion of how to write backups file thanks&regards Naveen.g (1 Reply)
Discussion started by: naveeng.81
1 Replies
Login or Register to Ask a Question