簡體   English   中英

嘗試從Shell腳本連接到Oracle數據庫

[英]Attempting to connect to an oracle database from shell script

我正在嘗試從Shell腳本連接到oracle數據庫(我是新用戶)。 然后,腳本將傳遞查詢並將結果傳輸到名為canadacount的變量。 我已經編寫了代碼,但是沒有用

#this script will attempt to connect to a remote database CFQ143 with user ID 'userid' and password 'password'.
#After loggin in it will read data from the PLATFORMSPECIFIC table.
#We can pass a query 'select count (platform) from platformspecific where platform='CANADA';
#The result from this query will be passed to a variable called canadacount which we can then echo back to the user.

canadacount='$ORACLE_HOME/bin/sqlplus -s /nolog<<EOF
connect userid/passsword@CFQ143:1521:CFQ143
set pages 0 feed off
select count (platform) from platformspecific where platform='CANADA';
exit
EOF'
echo $canadacount

答案是 :

我將連接線更改為以下內容:

connect userid/passsword@CFQ143

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM