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$