docker修改oracle的服务名
·
# 进入 oracle容器
[root@yanglg ~]# docker exec -it 05 /bin/bash
# 刷新配置
[oracle@7ac184622d55 /]$ source ~/.bash_profile
# 连接oracle
[oracle@7ac184622d55 /]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sat Mar 28 20:59:31 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
# 查看实例名
SQL> select instance from v$thread;
# 关闭数据库
SQL> shutdown immediate
#退出
SQL> quit
[oracle@7ac184622d55 /]$ 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
ORACLE_BASE=/home/oracle/app/oracle;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_2;export ORACLE_HOME
ORACLE_SID=orcl;export ORACLE_SID
ORACLE_TERM=xterm;export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export 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
# 使配置文件生效
[oracle@7ac184622d55 /]$ source ~/.bash_profile
# 查看环境变量进行确认
[oracle@7ac184622d55 /]$ env|grep ORACLE
ORACLE_SID=orcl
ORACLE_BASE=/home/oracle/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
[oracle@7ac184622d55 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 29 08:55:20 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Database mounted.
Database opened.
SQL> select instance from v$thread;
INSTANCE
--------------------------------------------------------------------------------
orcl
可能出现的问题:
1. ORA-01507: database not mounted
#问题分析:
#由于重启了Oracle,导致有资源没有被释放
#发现Oracle的后台进程SMON未关闭
#问题解决:kill掉相应进程
ps -ef |grep smon
kill 5645
#杀掉进程后重启
[oracle@7ac184622d55 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 29 08:55:20 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Database mounted.
Database opened.
SQL> select instance from v$thread;
INSTANCE
--------------------------------------------------------------------------------
orcl
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)