基于docker怎么部署Oracle 19c
发表于:2025-01-24 作者:千家信息网编辑
千家信息网最后更新 2025年01月24日,本文小编为大家详细介绍"基于docker怎么部署Oracle 19c",内容详细,步骤清晰,细节处理妥当,希望这篇"基于docker怎么部署Oracle 19c"文章能帮助大家解决疑惑,下面跟着小编的
千家信息网最后更新 2025年01月24日基于docker怎么部署Oracle 19c
本文小编为大家详细介绍"基于docker怎么部署Oracle 19c",内容详细,步骤清晰,细节处理妥当,希望这篇"基于docker怎么部署Oracle 19c"文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。
一. 拉取Oracle 19c镜像
[root@node08002 docker]# docker pull registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c19c: Pulling from zhuyijun/oraclebce8f778fef0: Pull complete 3fc3fd32c0bc: Pull complete 02948dd6d654: Pull complete 67f2dfeb2f1b: Pull complete 2e42d8039fd9: Pull complete b94f01bb60c6: Pull complete Digest: sha256:3898a9394720f30ce7f0b83ef2d172f4cd11b958282e0505f83cf2b0e5eaf7d4Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19cregistry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c
二. 查看镜像
[root@node08002 docker]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEregistry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle 19c 7b5eb4597688 20 months ago 6.61GB[root@node08002 docker]#
三. 创建Oracle 19c镜像的容器
3.1创建目录
[root@node08002 docker]# mkdir /opt/oradata[root@node08002 docker]# chmod -R 777 /opt/oradata/[root@node08002 docker]#
3.2 创建实例
[root@node08002 docker]# docker run -d -it --name oracle19c -p 1521:1521 -p 5500:5500 -v /opt/oradata:/opt/oracle/oradata registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c
3.3 查看日志
[root@node08002 ~]# docker logs -f oracle19cORACLE EDITION: ENTERPRISEORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: CRiP1dWzDHA=1 LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 06-APR-2022 10:28:18Copyright (c) 1991, 2019, Oracle. All rights reserved.Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 19.0.0.0.0 - ProductionSystem parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.oraLog messages written to /opt/oracle/diag/tnslsnr/1249a4a7bb32/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 19.0.0.0.0 - ProductionStart Date 06-APR-2022 10:28:18Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /opt/oracle/product/19c/dbhome_1/network/admin/listener.oraListener Log File /opt/oracle/diag/tnslsnr/1249a4a7bb32/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))The listener supports no servicesThe command completed successfullyPrepare for db operation8% completeCopying database files31% completeCreating and starting Oracle instance32% complete36% complete40% complete43% complete46% completeCompleting Database Creation51% complete54% completeCreating Pluggable Databases58% complete77% completeExecuting Post Configuration Actions100% completeDatabase creation complete. For details check the logfiles at: /opt/oracle/cfgtoollogs/dbca/ORCLCDB.Database Information:Global Database Name:ORCLCDBSystem Identifier(SID):ORCLCDBLook at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 6 10:48:37 2022Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.
四、 修改密码
系统默认的system密码修改成oracle
[root@node08002 ~]# docker exec oracle19c ./setPassword.sh oracle
setPassword.sh 脚本如下
[root@node08002 ~]# docker exec -it oracle19c /bin/bash[oracle@1249a4a7bb32 ~]$ lssetPassword.sh[oracle@1249a4a7bb32 ~]$ pwd/home/oracle[oracle@1249a4a7bb32 ~]$ cat setPassword.sh #!/bin/bash# LICENSE UPL 1.0## Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.# # Since: November, 2016# Author: gerald.venzl@oracle.com# Description: Sets the password for sys, system and pdb_admin## DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.# ORACLE_PWD=$1ORACLE_SID="`grep $ORACLE_HOME /etc/oratab | cut -d: -f1`"ORACLE_PDB="`ls -dl $ORACLE_BASE/oradata/$ORACLE_SID/*/ | grep -v pdbseed | awk '{print $9}' | cut -d/ -f6`"ORAENV_ASK=NOsource oraenv sqlplus / as sysdba << EOF ALTER USER SYS IDENTIFIED BY "$ORACLE_PWD"; ALTER USER SYSTEM IDENTIFIED BY "$ORACLE_PWD"; ALTER SESSION SET CONTAINER=$ORACLE_PDB; ALTER USER PDBADMIN IDENTIFIED BY "$ORACLE_PWD"; exit;EOF [oracle@1249a4a7bb32 ~]$
五、连接数据库
sqlplus system/oracle@xxx.xxx.xxx.xxx:1521/ORCLCDB
5.1测试方案一:进入容器内部测试
[root@node08002 ~]# docker exec -it oracle19c /bin/bash[oracle@1249a4a7bb32 ~]$ sqlplus system/oracle@localhost:1521/ORCLCDB SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 7 01:54:17 2022Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.Last Successful login time: Thu Apr 07 2022 01:53:14 +00:00Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionSQL> Show user;USER is "SYSTEM"SQL> exitDisconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production[oracle@1249a4a7bb32 ~]$
5.2测试方案二:用navicat连接测试
[root@node08002 ~]# docker exec -it oracle19c /bin/bash[oracle@1249a4a7bb32 ~]$ cd /opt/oracle/product/19c/dbhome_1/network/admin/[oracle@1249a4a7bb32 admin]$ lslistener.ora samples shrept.lst sqlnet.ora tnsnames.ora[oracle@1249a4a7bb32 admin]$ vim sqlnet.ora [oracle@1249a4a7bb32 admin]$ cat sqlnet.ora NAME.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)[oracle@1249a4a7bb32 admin]$ vim sqlnet.ora [oracle@1249a4a7bb32 admin]$ cat sqlnet.ora NAME.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8SQLNET.ALLOWED_LOGON_VERSION_SERVER=8[oracle@1249a4a7bb32 admin]$ exitexit[root@node08002 ~]# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES1249a4a7bb32 registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c "/bin/sh -c 'exec $O…" 16 hours ago Up 16 hours (healthy) 0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:5500->5500/tcp, :::5500->5500/tcp oracle19c[root@node08002 ~]# docker restart oracle19coracle19c[root@node08002 ~]#
很奇怪,又要修改一次密码,具体操作步骤如下:
[root@node08002 ~]# docker exec -it oracle19c /bin/bash[oracle@1249a4a7bb32 ~]$ sqlplus system/oracle@localhost:1521/ORCLCDB SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 7 02:59:52 2022Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Last Successful login time: Thu Apr 07 2022 02:59:10 +00:00 Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.3.0.0.0 SQL> alter user system identified by oracle; User altered. SQL> exitDisconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.3.0.0.0
终于可以连接了
读到这里,这篇"基于docker怎么部署Oracle 19c"文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注行业资讯频道。
测试
密码
文章
镜像
内容
容器
方案
步骤
妥当
实例
思路
数据
数据库
新知
日志
更多
目录
知识
知识点
篇文章
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
通过服务器访问本地电脑
手机管理服务器软件有哪些
山西erp软件开发视频
幼儿园安全数据库
特斯拉应用服务器中断原因
七日杀服务器怎么设置
设计数据库的步骤
张湾区专业软件开发售后保障
vb.net软件开发教程
数据库应用技术2016
老年人如何维护网络安全
深圳市可搜网络技术
数据库管理都有什么
服务器软盘
嘉兴晶安软件开发有限公司
怎么根据日期筛选全部数据库
数据库链接有几种
网络安全保护中最有效的方式
网络安全作业教育平台登录
计算机网络技术有什么区别
云南衫矍网络技术有限公司靠谱
美国计算机协会数据库
网络安全教育方案幼儿园
服务器故障排查
凯思特网络技术
国家网络安全等级保护管理
保山互联网科技怎样
jsp如何展示数据库
学生图书借还管理系统数据库
网络技术安全试题