Solaris10下安装后Oracle11g的环境变量配置,实现oracle用户下支持sqlplus,lsnrctl等命令
1. root用户下——修改oracle用户的配置文件.profile
文件路径为:/export/home/oracle/.profile
文件内容为:
# This is the default standard profile provided to a user.
# They are expected to edit it to meet their own needs.
MAIL=/usr/mail/${LOGNAME:?}
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/export/home/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_2; export ORACLE_HOME
ORACLE_SID=easy; export ORACLE_SID
PATH=$PATH:$ORACLE_HOME/bin;export PATH
umask 022
注意事项:修改时候需要确保ORACLE_HOME的路径是实际存在的,这个路径的设置是需要根据你自己的安装路径来确定,不一定是固定不变的。
比如:我这里oracle数据库的bin文件夹的路径就是/export/home/oracle/app/oracle/product/11.2.0/dbhome_2/,因此我的ORACLE_HOME就是:配置到dbhome_2这层。
否则的话,如果这里配置的不准确,将会导致访问不到bin路径下,那么就无法直接在命令行使用sqlplus,lsnrctl等常用的oracle数据库操作命令。
2.root用户下——让刚刚的配置生效
bash-3.00# . /export/home/oracle/.profile
3.切换到oracle用户下——验证配置是否确实生效
经过验证,确实生效了,而且常用的数据库操作命令可以正常使用。
bash-3.00# su - oracle
Oracle Corporation SunOS 5.10 Generic Patch January 2005
-bash-3.00$ env
HZ=100
SHELL=/usr/bin/bash
TERM=ansi
TMPDIR=/tmp
ORACLE_SID=easy
ORACLE_BASE=/export/home/oracle/app/oracle
MAIL=/usr/mail/oracle
PATH=/usr/bin::/export/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin
PWD=/export/home/oracle
LANG=zh
TZ=PRC
SHLVL=1
HOME=/export/home/oracle
TMP=/tmp
LOGNAME=oracle
ORACLE_HOME=/export/home/oracle/app/oracle/product/11.2.0/dbhome_2
_=/usr/bin/env
-bash-3.00$ lsnrctl
LSNRCTL for Solaris: Version 11.2.0.3.0 - Production on 17-JAN-2015 22:36:25
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> exit
-bash-3.00$ cat /export/home/oracle/.profile
# This is the default standard profile provided to a user.
# They are expected to edit it to meet their own needs.
MAIL=/usr/mail/${LOGNAME:?}
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/export/home/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_2; export ORACLE_HOME
ORACLE_SID=easy; export ORACLE_SID
PATH=$PATH:$ORACLE_HOME/bin;export PATH
umask 022
-bash-3.00$