本文主要是介绍docker部署oracle-xe-11g,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
搜索镜像
docker search oracle
下载镜像
docker pull oracleinanutshell/oracle-xe-11g
启动容器
docker run -d -p 1521:1521 -p 8080:8080 -e ORACLE_ALLOW_REMOTE=true -e ORACLE_DISABLE_ASYNCH_IO=true oracleinanutshell/oracle-xe-11g
- -e oracle_allow_remote=true表示允许远程连接
进入容器内部
docker exec -it 0aaa0b28b8f1 /bin/bash
登陆数据库
root@0aaa0b28b8f1:/# sqlplus system/oracle@//localhost:1521/xe
SQL*Plus: Release 11.2.0.2.0 Production on Mon Feb 7 03:17:50 2022
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL>
使用普通用户登录
sqlplus system/oracle
创建用户并分配权限
SQL> select username,password from dba_users;
USERNAME PASSWORD
------------------------------ ------------------------------
SYS
SYSTEM
ANONYMOUS
APEX_PUBLIC_USER
APEX_040000
XS$NULL
OUTLN
FLOWS_FILES
MDSYS
CTXSYS
XDB
USERNAME PASSWORD
------------------------------ ------------------------------
HR
12 rows selected.
- 创建用户:用户名为 oracle;密码为:oracle
create user oracle identified by oracle;
SQL> select * from all_users;
USERNAME USER_ID CREATED
------------------------------ ---------- ---------
XS$NULL 2147483638 28-AUG-11
ORACLE 48 07-FEB-22
APEX_040000 47 28-AUG-11
APEX_PUBLIC_USER 45 28-AUG-11
FLOWS_FILES 44 28-AUG-11
HR 43 28-AUG-11
MDSYS 42 28-AUG-11
ANONYMOUS 35 28-AUG-11
XDB 34 28-AUG-11
CTXSYS 32 28-AUG-11
OUTLN 9 28-AUG-11
USERNAME USER_ID CREATED
------------------------------ ---------- ---------
SYSTEM 5 28-AUG-11
SYS 0 28-AUG-11
13 rows selected.
- 给用户赋予connect 和 resource 角色(connect: 保证数据库可以链接;resource:该用户可以使用数据库的资源;create session:会话的权利)
grant connect,resource,create session to oracle;
grant unlimited tablespace to oracle;
drop user oracle;
连接测试
使用数据库管理软件连接,连接信息如下:
port: 1521
sid: xe
username: system
password: oracle
这篇关于docker部署oracle-xe-11g的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!