来宾市网站建设_网站建设公司_JSON_seo优化
2026/1/17 11:19:33 网站建设 项目流程

###ORACLE 21容器安装
步骤1:下载镜像

docker pull container-registry.oracle.com/database/free:latest

步骤2:运行

方法一:
执行以下命令,<oracle-db>可以自定义,运行后SYS, SYSTEM and PDBADMIN users会产生随机密码

podman run -d --name <oracle-db> container-registry.oracle.com/database/free:latest

改变随机密码:

podman exec <oracle-db> ./setPassword.sh <your_password>

访问告警日志

podman logs <oracle-db>

访问数据库容器

进容器内:

podman exec -it <oracle-db> sqlplus sys/<your_password>@FREE as sysdba
podman exec -it <oracle-db> sqlplus system/<your_password>@FREE
podman exec -it <oracle-db> sqlplus pdbadmin/<your_password>@FREEPDB1

外部连接端口

发现容器端口

podman port <oracle-db>
sqlplus sys/<your password="">@//localhost:<port mapped="" to="" 1521="">/FREE as sysdba
sqlplus system/<your password="">@//localhost:<port mapped="" to="" 1521="">/FREE
sqlplus pdbadmin/<your password="">@//localhost:<port mapped="" to="" 1521="">/FREEPDB1

运行脚本:

安装后可运行脚本,运行时mount目录

podman run -d --name <oracle-db> -v \
/home/oracle/myScripts:/opt/oracle/scripts/startup \
container-registry.oracle.com/database/free:latest

###Oracle True Cache

建立网络

podman network create tc_net

检查网络

podman inspect tc_net | grep -iw ‘subnet’

运 行primary database

podman run -td –name pri-db-free \
–hostname pri-db-free \
–net=tc_net \
–ip \
-p :1521 \
–secret=oracle_pwd \
–secret=oracle_pwd_priv_key \
–add-host=”tru-cc-free:” \
-e ENABLE_ARCHIVELOG=true \
-e ENABLE_FORCE_LOGGING=true \
-v [:]/opt/oracle/oradata \
container-registry.oracle.com/database/free:latest

运 行free true cache

podman run -td –name tru-cc-free \
–hostname tru-cc-free \
–net=tc_net \
–ip \
-p :1521 \
–secret=oracle_pwd \
–secret=oracle_pwd_priv_key \
–add-host=”pri-db-free:” \
-e TRUE_CACHE=true \
-e PRIMARY_DB_CONN_STR=:1521/FREE \
-e PDB_TC_SVCS=”FREEPDB1:sales1:sales1_tc;FREEPDB1:sales2:sales2_tc;FREEPDB1:sales3:sales3_tc;FREEPDB1:sales4:sales4_tc” \
-v [:]/opt/oracle/oradata \
container-registry.oracle.com/database/free:latest

方法二:

podman run --name <container name=""> \
-P | -p <host port="">:1521 \
-e ORACLE_PWD=<your database="" passwords=""> \
-e ORACLE_CHARACTERSET=<your character="" set=""> \
-e ENABLE_ARCHIVELOG=true \
-e ENABLE_FORCE_LOGGING=true \
-v [<host mount="" point="">:]/opt/oracle/oradata \
container-registry.oracle.com/database/free:latest

character:AL32UTF8

Parameters:
--name: The name of the container (default: auto generated)
-P | -p: The port mapping of the host port to the container port.
Only one port is exposed: 1521 (Oracle Listener)
-e ORACLE_PWD: The Oracle AI Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)
-e ORACLE_CHARACTERSET:
The character set to use when creating the database (default: AL32UTF8)
-e ENABLE_ARCHIVELOG:
To enable archive log mode when creating the database (default: true)
-e ENABLE_FORCE_LOGGING:
To enable force logging mode when creating the database (default: true)
-v /opt/oracle/oradata
The data volume to use for the database.
Has to be writable by the Unix "oracle" (uid: 54321) user inside the container.
If omitted the database will not be persisted over container recreation.
-v /opt/oracle/scripts/startup
Optional: A volume with custom scripts to be run after database startup.
For further details see the "Running scripts after setup and on startup" section below.
-v /opt/oracle/scripts/setup
Optional: A volume with custom scripts to be run after database setup.
For further details see the "Running scripts after setup and on startup" section below.

####Podman 密码安全
步骤一:产生RSA

mkdir /opt/.secrets/
cd /opt/.secrets
openssl genrsa -out key.pem
openssl rsa -in key.pem -out key.pub -pubout

步骤二:创建明文密码文件

vi /opt/.secrets/pwdfile.txt

步骤三:用私钥加密密码文件

openssl pkeyutl -in /opt/.secrets/pwdfile.txt -out /opt/.secrets/pwdfile.enc -pubin -inkey /opt/.secrets/key.pub -encrypt
rm -rf /opt/.secrets/pwdfile.txt

步骤四:创建podman secrets

podman secret create oracle_pwd /opt/.secrets/pwdfile.enc
podman secret create oracle_pwd_priv_key /opt/.secrets/key.pub

步骤五:将podman secret用于容器

podman run --name <container_name> --secret=oracle_pwd --secret=oracle_pwd_priv_key container-registry.oracle.com/database/free:latest

 


需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询