july
july
发布于 2023-07-08 / 78 阅读
1

Debian安装Oracle Database

Debian安装Oracle Database 19c

下载地址

🚀Oracle Database 19c下载地址

如果系统不是红帽系,就需要自己编译或者通过docker安装(通过docker安装应该是最简单的了,但两者都逃不过Oracle账户)

docker 拉取镜像

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

docker 拉取问题

Error response from daemon: Head "https://container-registry.oracle.com/v2/database/enterprise/manifests/latest": unauthorized: authentication required

这里需要登陆container-registry.oracle.com,需要登陆两次,一个在命令行内,一个在浏览器中。

sudo docker login container-registry.oracle.com
Username: xxxx@xxx.com
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded 

出现Login Succeeded即登陆成功,但拉取还是回出现问题。

Error response from daemon: pull access denied for container-registry.oracle.com/database/enterprise, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

这里先▶️https://container-registry.oracle.com/ 登陆自己账户

选择进入Database,登陆自己账户

现在就可以正常拉取了,当然拉取速度慢,就需要魔法上网。

sudo docker pull container-registry.oracle.com/database/enterprise:latest
[sudo] xxx 的密码:
对不起,请重试。
[sudo] xxx 的密码:
latest: Pulling from database/enterprise
66fb34780033: Pull complete 
3160e5ce220f: Pull complete 
0437799a5b58: Pull complete 
482f23cb4332: Downloading [==================>                                ]  22.71MB/62.46MB
aa126f7f477e: Downloading [>                                                  ]  22.71MB/3.31GB
301b19663f45: Downloading [==========================================>        ]  2.425MB/2.845MB
。。。
6fe7a53a2535: Waiting 
30c9251aff49: Waiting 

参考:[docker 拉取 container-registry.oracle.com - 访问被拒绝(或)未经授权 (middlewareinventory.com)](https://www.middlewareinventory.com/blog/docker-pull-container-registry-oracle-com-access-denied-or-unauthorized/#:~:text=There are two prerequisite tasks you must be,the docker login command (If not aleady done))

运行容器

## 官方
docker run -d --name <container_name> \
 -p <host_port>:1521 -p <host_port>:5500 \
 -e ORACLE_SID=<your_SID> \
 -e ORACLE_PDB=<your_PDBname> \
 -e ORACLE_PWD=<your_database_password> \
 -e INIT_SGA_SIZE=<your_database_SGA_memory_MB> \
 -e INIT_PGA_SIZE=<your_database_PGA_memory_MB> \
 -e ORACLE_EDITION=<your_database_edition> \
 -e ORACLE_CHARACTERSET=<your_character_set> \
 -e ENABLE_ARCHIVELOG=true \
 -v [<host_mount_point>:]/opt/oracle/oradata \
container-registry.oracle.com/database/enterprise:21.3.0.0

参数说明:


Parameters:
 --name:                 The name of the container (default: auto generated
 -p:                     The port mapping of the host port to the container port.
                         Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express)
 -e ORACLE_SID:          The Oracle Database SID that should be used (default:ORCLCDB)
 -e ORACLE_PDB:          The Oracle Database PDB name that should be used (default: ORCLPDB1)
 -e ORACLE_PWD:          The Oracle Database SYS, SYSTEM and PDBADMIN password (default: auto generated)
 -e INIT_SGA_SIZE:       The total memory in MB that should be used for all SGA components (optional)
 -e INIT_PGA_SIZE:       The target aggregate PGA memory in MB that should be used for all server processes attached to the instance (optional)
 -e ORACLE_EDITION:      The Oracle Database Edition (enterprise/standard, default: enterprise)
 -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: false). Supported 19.3 onwards.
 -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 | /docker-entrypoint-initdb.d/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 | /docker-entrypoint-initdb.d/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.

需要远程访问记得开启1521,5500端口,由于我自己的小服务器系统用的是Debian sid ,防火墙改用了nftables,oracle 数据用的还是iptables,这里就需要将其设置为iptables-legacy ,Docker 可以使用的兼容模式。

sudo update-alternatives --config iptablesand 
sudo update-alternatives --config ip6tables(IPv6)

# 然后放行1521,5500端口
sudo iptables -I INPUT -p tcp --dport 1521 -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 5500 -j ACCEPT

# 重启防火墙喝docker

编译安装

未完待续