前言
只从docker国内被ban了之后,oracle的docker镜像就不好找了,这里用一个我亲身经历的例子来举例
安装
# 这个是我的docker 镜像的配置文件
"registry-mirrors": [
"https://6kx4zyno.mirror.aliyuncs.com",
"https://hub-mirror.c.163.com",
"https://registry.aliyuncs.com",
"https://docker.mirrors.ustc.edu.cn"
]
# 拉取docker镜像
docker run -d --name myoracle11g -p 22:22 -p 1521:1521 -p 8080:8080 rohitbasu77/oracle11g
C:\Users\XX>docker pull rohitbasu77/oracle11g
Using default tag: latest
latest: Pulling from rohitbasu77/oracle11g
a3ed95caeb02: Pulling fs layer
8e62a7e6041d: Pull complete
d2ff49536f4d: Pull complete
f94adccdbb9c: Pull complete 5626e9a5921f: Pull complete 46fe685a8e8c: Pull complete
7a324b5cc1fd: Pull complete 19a4e940bf26: Pull complete
c11e3144d623: Pull complete
5003f3b4bd5b: Pull complete
b3a680d3a3e7: Pull complete
0ea2ea4df275: Pull complete
1272fc3307da: Pull complete
99b70bae736d: Pull complete
a88af96b55cb: Pull complete
f5abd9e143b4: Pull complete
e22202936057: Pull complete
ecb1a123dbb8: Pull complete
579deac9e8fd: Pull complete
3a9d402a079b: Pull complete
a1b5d7364d70: Pull complete
9055d887fbe6: Pull complete
850b00dee460: Pull complete
a59d6c0c8790: Pull complete
36def07633de: Pull complete
27bdde619ac9: Pull complete
4e7f1dba8bfc: Pull complete
55c1940684c8: Pull complete
fa73e4f3ef3d: Pull complete
5b4ff66ed423: Pull complete
Digest: sha256:5b783fac5c162c1713d8574ca746c8b95fddad449e82edc4be4b690b31dcbdaf
Status: Downloaded newer image for rohitbasu77/oracle11g:latest
docker.io/rohitbasu77/oracle11g:latest
What's Next?
1. Sign in to your Docker account → docker login
2. View a summary of image vulnerabilities and recommendations → docker scout quickview rohitbasu77/oracle11g
安装好后
# 查看 docker的运行状态
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
1b612c91b33b rohitbasu77/oracle11g "/bin/sh -c 'sed -i …" 5 hours ago Up 34 minutes 0.0.0.0:22->22/tcp, 0.0.0.0:1521->1521/tcp, 0.0.0.0:8080->8080/tcp myoracle11g
# 进入到oracle内部
docker exec -it 1b612c91b33b bash
root@1b612c91b33b:/#
#
root@1b612c91b33b:/# su oracle
oracle@1b612c91b33b:/$ sqlplus /nolog
SQL*Plus: Release 11.2.0.2.0 Production on Wed Jul 24 15:44:15 2024
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> conn /as sysdba;
Connected.
#创建表空间
SQL>CREATE TABLESPACE logminer_tbs DATAFILE '/u01/app/oracle/tablespace1/logminer_tbs.dbf' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
创建flinkuser账号
CREATE USER flinkuser IDENTIFIED BY flinkpw DEFAULT TABLESPACE LOGMINER_TBS QUOTA UNLIMITED ON LOGMINER_TBS;
GRANT CREATE SESSION TO flinkuser;
GRANT SET CONTAINER TO flinkuser;
GRANT SELECT ON V_$DATABASE to flinkuser;
GRANT FLASHBACK ANY TABLE TO flinkuser;
GRANT SELECT ANY TABLE TO flinkuser;
GRANT SELECT_CATALOG_ROLE TO flinkuser;
GRANT EXECUTE_CATALOG_ROLE TO flinkuser;
GRANT SELECT ANY TRANSACTION TO flinkuser;
GRANT LOGMINING TO flinkuser;
GRANT ANALYZE ANY TO flinkuser;
GRANT CREATE TABLE TO flinkuser;
GRANT LOCK ANY TABLE TO flinkuser;
GRANT ALTER ANY TABLE TO flinkuser;
GRANT CREATE SEQUENCE TO flinkuser;
GRANT EXECUTE ON DBMS_LOGMNR TO flinkuser;
GRANT EXECUTE ON DBMS_LOGMNR_D TO flinkuser;
GRANT SELECT ON V_$LOG TO flinkuser;
GRANT SELECT ON V_$LOG_HISTORY TO flinkuser;
GRANT SELECT ON V_$LOGMNR_LOGS TO flinkuser;
GRANT SELECT ON V_$LOGMNR_CONTENTS TO flinkuser;
GRANT SELECT ON V_$LOGMNR_PARAMETERS TO flinkuser;
GRANT SELECT ON V_$LOGFILE TO flinkuser;
GRANT SELECT ON V_$ARCHIVED_LOG TO flinkuser;
GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO flinkuser;