环境问题...登录sqlplus

时间:2015-10-22 14:06:36

标签: linux oracle bash shell

所以我想弄清楚一个简单的问题,我知道这与我的环境设置有关....因为你可以看到oracle数据库(mcq)启动并运行,当我登录到服务器时,一切都是设置,我可以使用SQLPLUS登录到数据库....但是我的问题出现在我通过键入bash切换到bash模式(默认是csh,当事情有效)....当我切换到bash并取消设置所有内容时设置ORACLE_SID,HOME,PATH我进入了SQLPLUS但你可以看到我得到了#34;连接到空闲实例。"消息,这意味着我没有连接到数据库....

我之所以放弃一切并希望它能够正常工作的原因是因为我想写的脚本。我不想继续已经设置好的东西,就像在某些服务器上我们为oracle设置环境而在某些服务器上我们没有...所以如果我让它工作,这将适用于两个环境...

hostname:oramcq 51> ps -ef|grep pmon
oramcq     3810      1  0 Aug14 ?        00:08:29 ora_pmon_mcq
oramcq   121914 121660  0 13:55 pts/0    00:00:00 grep pmon
hostname:oramcq 52>
hostname:oramcq 52> env | grep ORA
dbms_type=ORA
ORACLE_SID=mcq
ORACLE_BASE=/oracle
ORACLE_HOME=/oracle/mcq/112_64
hostname:oramcq 53>
hostname:oramcq 53> env | grep PATH
PATH=/oracle/mcq/112_64/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/sap/mcq/SYS/exe/uc/linuxx86_64:/usr/sap/mcq/SYS/exe/run:/oracle/mcq/11204:.
MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles
RSEC_SSFS_DATAPATH=/usr/sap/mcq/SYS/global/security/rsecssfs/data
RSEC_SSFS_KEYPATH=/usr/sap/mcq/SYS/global/security/rsecssfs/key
LD_LIBRARY_PATH=/usr/sap/mcq/SYS/exe/run:/usr/sap/mcq/SYS/exe/uc/linuxx86_64:/oracle/mcq/112_64/lib
hostname:oramcq 54>
hostname:oramcq 54> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 22 13:56:11 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning and Real Application Testing options
hostname:oramcq 55>
hostname:oramcq 55>
hostname:oramcq 55> bash
bash-4.1$
bash-4.1$ ORACLE_SID=""
bash-4.1$ ORACLE_HOME=""
bash-4.1$ PATH=/usr/sbin:/sbin:/bin:/sbin:/usr/bin
bash-4.1$ export ORACLE_SID=mcq
bash-4.1$ export ORACLE_HOME=/oracle/mcq/11204
bash-4.1$ export PATH=$ORACLE_HOME/bin:$PATH
bash-4.1$ which sqlplus
/oracle/mcq/11204/bin/sqlplus
bash-4.1$
bash-4.1$ env | grep ORA
dbms_type=ORA
ORACLE_SID=mcq
ORACLE_BASE=/oracle
ORACLE_HOME=/oracle/mcq/11204
bash-4.1$
bash-4.1$ env | grep PATH
RSEC_SSFS_DATAPATH=/usr/sap/mcq/SYS/global/security/rsecssfs/data
LD_LIBRARY_PATH=/usr/sap/mcq/SYS/exe/run:/usr/sap/mcq/SYS/exe/uc/linuxx86_64:/oracle/mcq/112_64/lib
PATH=/oracle/mcq/11204/bin:/usr/sbin:/sbin:/bin:/sbin:/usr/bin
MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles
RSEC_SSFS_KEYPATH=/usr/sap/mcq/SYS/global/security/rsecssfs/key
bash-4.1$
bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 22 13:57:20 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL>

0 个答案:

没有答案