docker/docker-compose安装Oracle11gr2
使用镜像wnameless/oracle-xe-11g-r2(Oracle12c使用absolutapps/oracle-12c-ee) 登录用户密码sys/oracle 实例信息XE
查询镜像:docker search oracle
sqlplus可能用到的相关操作
-- 监听操作
lsnrctl status/stop/start
-- 登录
sqlplus system/oracle@//localhost:1521/orcl
-- 登录修改密码等
sqlplus /nolog
connect sys/oracle as sysdba;
alter user sys identified by newpassword;
alter user system identified by newpassword;
create user xxx identified by password;
grant create session to xxx;
grant create table,unlimited tablespace to xxx;
grant select any table to xxx;
GRANT UPDATE ANY TABLE,DROP ANY TABLE,INSERT ANY TABLE TO xxx;
alter system set O7_DICTIONARY_ACCESSIBILITY=true scope=spfile;
-- 查看实例
select instance_name from v$instance;
-- 查看表空间
select TABLESPACE_NAME, FILE_NAME from dba_data_files;
-- 创建表空间
create tablespace user_data logging datafile '/u01/app/oracle/oradata/XE/user_data01.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
-- 查看临时表空间
select TABLESPACE_NAME, FILE_NAME from dba_temp_files;
-- 创建临时表空间
create temporary tablespace user_temp tempfile '/u01/app/oracle/oradata/XE/user_temp01.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
-- 创建用户
create user username identified by password default tablespace user_data temporary tablespace user_temp;
-- 给用户授予权限
grant connect,resource,dba to username;
使用docker
docker run --name oracle -d -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g-r2
使用docker-compose
version: '3'
services:
oracle11gr2:
image: wnameless/oracle-xe-11g-r2
container_name: oracle11gr2
environment:
# 时区上海
TZ: Asia/Shanghai
ports:
- "8080:8080"
- "1521:1521"
# volumes:
# - ./data/oracle:/u01/app/oracle
privileged: true
# restart: always
networks:
- my_net
deploy:
resources:
limits:
cpus: 0.25
memory: 1g
reservations:
# cpus: 0.2
memory: 1g
networks:
my_net:
driver: bridge
ipam:
config:
- subnet: 172.30.0.0/16
登录信息
hostname: localhost
port: 1521
sid: xe
username: system
password: oracle
plsql链接
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 43.***.***.37 )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
标签:compose,--,create,user,oracle,docker,Oracle11gr2,1521
From: https://www.cnblogs.com/muphy/p/16769579.html