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



  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值