docker 安装 oracle
- 拉取镜像
docker pull jaspeen/oracle-xe-11g #因为版本不同有的可能是jaspeen/oracle-11g
- 运行镜像文件
docker run -p 1521:1521 --name oracle_11g -d --restart=always jaspeen/oracle-xe-11g
- 进去oracle容器去设置dba密码等,也可以直接在里面操作sql
docker exec -it oracle_11g /bin/bash
- 进入oracle 默认是安装在oracle用户下的,执行:
su oracle
- 找到sqlplus 命令所在目录, 本镜像是在:/u01/app/oracle/product/11.2.0/xe/bin 下, 这里不能放在一行
cd /u01/app/oracle/product/11.2.0/xe/bin
./sqlplus / as sysdba
- 修改dba的密码
alter user sys identified by newpassword;
alter user system identified by newpassword;
- 创建新用户:用户名为admin 密码password(根据自己的情况写) 用system用户创建
create user admin identified by password; 创建admin用户设置密码
grant create session to admin; 赋予admin用户登录权限
- 赋予admin用户各种权限
grant create view to admin;
grant select any teble to admin;
grant select any dictionary to admin;
grant create table to admin;
grant drop any table to admin;
grant insert any table to admin;
grant update any table to admin;