【oracle】处理oracle用户密码中的特殊字符$和@

前端之家收集整理的这篇文章主要介绍了【oracle】处理oracle用户密码中的特殊字符$和@前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

oracle】处理oracle用户密码中的特殊字符$@

1.创建测试用户

create user testdb identified by "[email protected]";

grant connect,resource to testdb;

grant unlimited tablespace,create session to testdb;

alter user testdb identified by "[email protected]";

 

2.shell连接oracle数据库

su - oracle

mkdir $ORACLE_HOME/test

vi test.sh

输入以下内容

#!/bin/bash

script_path=`cd (dirname $0);pwd`  #$0 表示文件

temp_sql=${script_path}/temp_$$.sql   #$$表示进程号

 

user_name=testdb

user_password=‘[email protected]

user_password_n=‘"‘${user_password}‘"‘  #处理密码中的特殊字符$和@

jdbc_conn=10.10.10.1:1521/orcl

 

echo "select sysdate from dual;" > ${temp_sql}

echo "exit;" >> ${temp_sql}

 

export NLS_LANG=.AL32UTF8

sqlplus ${user_name}/${user_password_n}@${jdbc_conn} "@${temp_sql}"n  #正确

sqlplus ${user_name}/${user_password}@${jdbc_conn} "@${temp_sql}"  #错误

 

执行test.sh:

sh -x test.sh

猜你在找的Oracle相关文章