进入docker
docker exec -it oracle bash
修改环境变量文件
vi .bash_profile
为以下内容
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
ORACLE_TERM=xterm;export ORACLE_TERM
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH
退出文件,
使其生效
. .bash_profile
查看当前环境变量内容
查看 echo $ORACLE_HOME 为
/home/oracle/app/oracle/product/11.2.0/dbhome_2
查看 echo $PATH 为
/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/home/oracle/bin
此时可以执行 sqlplus了,执行如下命令连接数据库
sqlplus / as sysdba
然后修改密码
alter user username identified by password;
完成后,输入exit并回车即可退出就可以了。