shell連線oracle資料庫生成檔案

2021-08-08 09:10:45 字數 1142 閱讀 5885

需求:要用shell生成乙個檔案,但是其中乙個引數translate_no需要從oracle資料庫中獲取

#!/bin/sh

#. /home/ju/.bash_profile

#input para,判斷輸出的引數是否為2個

if [ $#

-ne2 ]; then

echo

"retcode:-1"

echo

"retmes:please input params!"

fi#get translate_no,從資料庫獲取值並賦值給shell變數

username='username'

password='passwd'

sidname='orcl'

service='192.168.133.1'

sql="select 'status='||sysdate from dual;"

translate_no=`echo

$sql | \

sqlplus -s $/$@$/ | \

grep status | \

awk -f= '' `

#define value,定義變數

file_no=$2

file_type=$1

sysdate=`date +%y%m%d%k%m%s`

file_name="2301_collect_req_"$$

"_"$

"_"$

".xml"

#get xml,生成需要的xml檔案

echo

'<?xml version="1.0" encoding="utf-8"?>' > $

echo

'' >> $

echo

'' >> $

echo

"0100"

$"00

]]>" >> $

echo

'' >> $

echo

'' >> $

echo

"retcode:0"

echo

"retmes:succes"

exit

0

Oracle資料庫連線檢測(Shell)

oracle資料庫版本 oracle release 10.2.0.1.0 系統版本 red hat enterpriselinux 5.4 在有sqlplus執行許可權的使用者下,編輯check oracle connection.sh指令碼。vi check oracle connection....

LOADRUNNER連線ORACLE資料庫的方法

最近正在做乙個測試資料庫效能的專案,直接寫出來的連線資料庫並且進行資料庫查詢和插入的指令碼 在vuser init中 連線資料庫 include lrd.h static lrd init info initinfo static lrd default db version dbtypeversi...

oracle連線資料

1.源 string connstring user id scott password yanhong data source description address list address protocol tcp host 127.0.0.1 port 1521 connect data s...