sqlplus
устанавливает соединение с именем пользователя и паролем в кавычках. Sqlloader (sqlldr
) подключается к базе данных, только если имя написано без кавычек.
Пароль может содержать @!=
символов только в кавычках, например
password=\"YAu8D=5r\"
password=\"@!YAu8D=5r@\"
Пример 1
username=HR
password=\"YAu8D=5r\"
Сменить пароль
oracle@esmd:~> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Jul 2 13:39:10 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
SQL> alter user hr identified by "YAu8D=5r" ;
User altered.
SQL> exit
Проверка подключения sqlplus
#!/bin/sh
username=\"HR\"
password=\"YAu8D=5r\"
echo username: $username
echo password: $password
testoutput=$(sqlplus -s $username/$password << EOF
set pagesize 0 feedback off verify off heading off echo off;
show user
SELECT to_char(sysdate,'DD-MM-YYYY HH24:MI')||' Test passed' from dual
@ulcase1.sql
exit;
EOF
)
echo $testoutput
oracle@esmd:~> ./test_Upper_case2.sh
username: "HR"
password: "YAu8D=5r"
USER is "HR"
Test SQL * скрипт загрузчика test_sqlldr.sh
oracle@esmd:~> more test_sqlldr.sh
#!/bin/sh
username=hr
password=\"YAu8D=5r\"
sqlldr userid=$username/$password control=ulcase2.ctl log=log.log
Тест SQL * загрузчик
oracle@esmd:~> ./test_sqlldr.sh
SQL*Loader: Release 11.2.0.3.0 - Production on Mon Jul 2 13:46:29 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 7
oracle@esmd:~>
Проверка сетевого подключения sqlldr
oracle@esmd:~> more test_sqlldr.sh
#!/bin/sh
username=hr
password=\"YAu8D=5r\"
sqlldr userid=$username/$password@esmd control=ulcase2.ctl log=log.log
oracle@esmd:~> ./test_sqlldr.sh
SQL*Loader: Release 11.2.0.3.0 - Production on Mon Jul 2 13:53:24 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 7
Пример 2
username=HR
password=\"@!YAu8D=5r@\"
Скрипт для тестирования соединения sqlplus
#!/bin/sh
username=HR
password=\"@!YAu8D=5r@\"
echo username: $username
echo password: $password
testoutput=$(sqlplus -s $username/$password << EOF
set pagesize 0 feedback off verify off heading off echo off;
show user
SELECT to_char(sysdate,'DD-MM-YYYY HH24:MI')||' Test passed' from dual;
@ulcase1.sql
exit;
EOF
)
echo $testoutput
Проверка подключения sqlplus
oracle@esmd:~> ./test_Upper_case2.sh
username: "HR"
password: "@!YAu8D=5r@"
USER is "HR" 03-07-2018 12:44 Test passed
Test SQL * скрипт загрузчика test_sqlldr.sh
#!/bin/sh
username=HR
password=\"@!YAu8D=5r@\"
sqlldr userid=$username/$password control=ulcase2.ctl log=log.log
Тест SQL * загрузчик
oracle@esmd:~> ./test_sqlldr.sh
SQL*Loader: Release 11.2.0.3.0 - Production on Tue Jul 3 12:48:53 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 7
Пример 3
username=\"HR\"
password=\"@!YAu8D=5r@\"
Скрипт для тестирования соединения sqlplus
#!/bin/sh
username=\"HR\"
password=\"@!YAu8D=5r@\"
echo username: $username
echo password: $password
testoutput=$(sqlplus -s $username/$password << EOF
set pagesize 0 feedback off verify off heading off echo off;
show user
SELECT to_char(sysdate,'DD-MM-YYYY HH24:MI')||' Test passed' from dual;
@ulcase1.sql
exit;
EOF
)
echo $testoutput
Проверка подключения sqlplus
oracle@esmd:~> ./test_Upper_case2.sh
username: "HR"
password: "@!YAu8D=5r@"
USER is "HR" 03-07-2018 12:51 Test passed
oracle@esmd:~> more test_sqlldr.sh
#!/bin/sh
username=\"HR\"
password=\"@!YAu8D=5r@\"
sqlldr userid=$username/$password control=ulcase2.ctl log=log.log
Тест SQL * загрузчик
oracle@esmd:~> ./test_sqlldr.sh
LRM-00112: multiple values not allowed for parameter 'userid'
SQL*Loader: Release 11.2.0.3.0 - Production on Tue Jul 3 12:54:42 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
SQL*Loader-100: Syntax error on command-line