提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
Docker方式部署Oracle 10G
提示:这里可以添加本文要记录的大概内容:
Docker方式部署Oracle 10G。
提示:以下是本篇文章正文内容,下面案例可供参考
一、拉取Oracle 10G 镜像
root@gejie-10 ~]# docker pull registry.cn-shanghai.aliyuncs.com/techerwang/oracle:ora10g_10205
ora10g_10205: Pulling from techerwang/oracle
a7f33acb2692: Pull complete
1746aa4234db: Pull complete
502d798e11b1: Pull complete
Digest: sha256:f1a6a03c8c5bfa729f8d81145240bd27b3f47f9e971cb9f326ff9601fbb7c461
Status: Downloaded newer image for registry.cn-shanghai.aliyuncs.com/techerwang/oracle:ora10g_10205
registry.cn-shanghai.aliyuncs.com/techerwang/oracle:ora10g_10205
二、重新tag镜像
[root@gejie-10 ~]# docker tag registry.cn-shanghai.aliyuncs.com/techerwang/oracle:ora10g_10205 oracle10g:10205
三、启动Oracle容器
[root@gejie-10 ~]# docker run -itd --name oracle10205 -h jemora10g -p 31521:1521 --privileged=true --restart=always oracle10g:10205 init
四、进入容器
1.引入库
代码如下(示例):
[root@gejie-10 ~]# docker exec -it oracle10205 bash
五、oracle相关配置
1.启动oracle数据库
代码如下(示例):
docker exec -it oracle10205 bash
su - oracle
lsnrctl start
root@gejie-10 ~]# docker exec -it oracle10205 bash
[root@jemora10g /]# su - oracle
-bash: iexport: command not found
[oracle@jemora10g ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 11-SEP-2024 15:11:45
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0.1/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Log messages written to /u01/app/oracle/product/10.2.0.1/dbhome_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=jemora10g)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date 11-SEP-2024 15:11:45
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/product/10.2.0.1/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=jemora10g)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@jemora10g ~]$
2.连接oracle
代码如下(示例):
[oracle@jemora10g ~]$ sql
SYS@jem10g> startup
The listener supports no services
The command completed successfully
[oracle@jemora10g ~]$ sql
SQL*Plus: Release 10.2.0.5.0 - Production on Wed Sep 11 15:18:07 2024
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SYS@jem10g> startup
ORACLE instance started.
Total System Global Area 1157627904 bytes
Fixed Size 2095768 bytes
Variable Size 301991272 bytes
Database Buffers 838860800 bytes
Redo Buffers 14680064 bytes
Database mounted.
Database opened.
SYS@jem10g>
3.创建用户并授权
代码如下(示例):
SYS@jem10g> create user test identified by “12345H”;
SYS@jem10g> grant connect,resource,dba to test;
SYS@jem10g> create user test identified by "12345H";
User created.
SYS@jem10g> grant connect,resource,dba to test;
Grant succeeded.
六、连接测试
连接参数:
IP:112.33.213.30
端口:31512
服务名:jem10g
用户名:test
密码:12345H