# docker 运行 oracle11.2.0
docker run -d --name o11 -p 8080:8080 -p 1521:1521 wnameless/oracle-xe-11g-r2
连接方式:
hostname: ip
port: 1521
sid: xe
username: system
password: oracle
新建server_name教程如下:
一 后台登录Oracle,新增server_name
# 进入oracle容器
root@ubu43-211:~# docker exec -it o11 bash
root@88ac1e157079:/# su - oracle # 切换用户
oracle@88ac1e157079:~$ sqlplus / as sysdba # 登录后台
SQL*Plus: Release 11.2.0.2.0 Production on Tue Sep 7 15:54:02 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> show parameter name; # 查看 会话参数
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string XE
db_unique_name string XE
global_names boolean FALSE
instance_name string XE
lock_name_space string
log_file_name_convert string
service_names string XE
SQL> alter system set service_names = XE1,XE2 scope=spfile;
System altered.
二 写入配置中,并重新读取。
vim /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
# listener.ora Network Configuration File:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
(PROGRAM = extproc)
)
(SID_DESC=
(GLOBAL_DBNAME = XE1) # 增加server_name XE1
(ORALCE_HOME = /u01/app/oracle/product/11.2.0/xe)
(SID_NAME = XE)
)
(SID_DESC=
(GLOBAL_DBNAME = XE2) #增加server_name XE1
(ORALCE_HOME = /u01/app/oracle/product/11.2.0/xe)
(SID_NAME = XE)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCP)(HOST = 88ac1e157079)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
oracle@88ac1e157079:~/product/11.2.0/xe/network/admin$ lsnrctl reload # 重新加载配置
三 测试是否正常写入
客户端工具连接重启 oracle后,也能正常查看到相关server_name
k/admin# docker exec -it o11 bash
root@88ac1e157079:/# su - oracle
oracle@88ac1e157079:~$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Tue Sep 7 16:09:42 2021
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string XE
db_unique_name string XE
global_names boolean FALSE
instance_name string XE
lock_name_space string
log_file_name_convert string
service_names string XE1, XE2
网友评论