當前位置:首頁 » 網頁前端 » shell腳本oracle密碼
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

shell腳本oracle密碼

發布時間: 2022-07-29 03:58:59

① shell腳本語言如何和oracle結合在一起使用

如果是通過shell腳本運行Oracle的sql語句,可以這樣寫shell腳本:
echo 「Oracle SQL Example"
sqlplus / as sysdba <<EOF
select * from scott.emp;
EOF
也就是把sql語句寫到shell腳本的EOF之間。

② linux oracle 資料庫備份 密碼帶@

密碼用雙引號引起來。
scott/"xxx@123"@ORCL

③ shell腳本中實現對oralce資料庫的操作

試一下,我沒環境,不能幫你測試,有問題聯系
在表名的文件中,增加表結構說明,格式如下:
field1,field2,field3,.....,fieldn
load_data()
{
TABNAME=$1
DATAFILE=$2
crt_ctlfile $TABNAME $DATAFILE
sqlldr $username/$password control=loader.ctl
if [ $? -ne 0 ]
then
echo "error load $TABNAME!"
exit -1
fi
}

crt_ctlfile()
{
echo "load data" > loader.ctl
echo "infile '$2'" >> loader.ctl
echo "into table $1" >> loader.ctl
echo "fields terminated by \"|\" optionally enclosed by '\"'" >> loader.ctl
echo "(" >> loader.ctl
cat tablelist/$1 >> loader.ctl
echo ")" >> loader.ctl
}

if [ $# -ne 2 ]
then
echo "usage: $0 username password"
exit
fi
username=$1
password=$2

tabname=`ls tablelist`

for tab in $tabname
do
if [ -z tablelist/$tab ]
then
echo "file : $tab is null, you need to add table field!"
else
datafile=$tab.unl
if [ -s ./data/$datafile ]
then
load_data $tab $datafile
else
echo "file : $datafile is null or not exists"
fi
fi
done

④ oracle用戶的密碼含有特殊字元,在shell腳本中如何實現sqlplus的連接操作

加個轉義字元\: password="'\"qaz@qaz\"'"

⑤ linux shell腳本如何實現資料庫密碼的輸入

mysql:./mysql -uroot -p'123456789'
還可以使用 shell 中的read函數 讓執行者輸入密碼後在執行mysql
read -p "Enter DB PWD: "
echo 「mysql -uroot -p'$REPLY'."

⑥ linux下編寫以個shell腳本,實現對oracle資料庫抽取指定條件的數據並且保存在一個文本文件中。

empno=100不存在的,改成有的數據了。
#!/bin/bash
result=$(sqlplus -s 'scott/tiger@dbname'<<EOF
spool test.txt
set pages 0
set feed off
set heading off;
set feedback off;
set verify off;
set linesize 1000;
SELECT * FROM scott.emp where empno=7369;
spool off
EOF
)
echo $result
~
~
~
~
~
~
~
~
~
"test.sh" 14L, 256C written
oracle@****:~> ./test.sh
7369 SMITH CLERK 7902 17-DEC-80 2240.06 20
oracle@****:~> more test.txt
7369 SMITH CLERK 7902 17-DEC-80 2240.06
20

⑦ 求大神給一個linux下oracle資料庫導出的shell腳本

把下面的代碼保存為伺服器端的腳本,執行即可。
PS:需要自己替換一下雙引號中的內容
#!/bin/sh
. $HOME/.bash_profile
export ORACLE_SID="你的資料庫的SID"
CutDATE=`date '+%Y-%m%d-%H%M'`
DATE=`date -d '-2 day' '+%Y-%m%d'`
export NLS_LANG="你的字元集設定"
exp "具有許可權的賬號"/"密碼" file=/home/oracle/2014/"你的資料庫的SID"_$CutDATE.dmp log=/home/oracle/2014/"你的資料庫的SID"_$CutDATE.log owner=user1,user2

⑧ shell腳本中如何加密變數(dbca靜默創建oracle實例,-syspassword參數為明文密碼,需加密)

openssl提供了多種加密演算法,可以考慮將密碼加密後密文寫在配置文件