docker 中安装oracle11g,并使用Navicat Premium 12进行远程连接

docker 中安装oracle11g,并使用Navicat Premium 12进行远程连接

安装
docker 安装(省略)
在docker 中安装Oracle11G
步骤1:
获取oracke11g镜像,等待镜像下载完成。

docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

通过命令查看当前所有镜像,就可看到镜像 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

docker images

步骤2:
创建容器

docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

通过命令查看镜像运行状态

docker ps -a 

看到以下的运行状态 Up 则表示镜像已经运行成功

registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g "/bin/sh -c '/home/o鈥? up 40 minutes ago Up 40 minutes 0.0.0.0:1521->1521/tcp oracle11g

交互方式进入Oracle11g的镜像中进行操作,此时注意,进入后当前的用户为 oracle

docker exec -it oracle11g bash

配置oracle 的环境变量,建议使用 ls 或者 ll 命令查看当前目录结构。
用以下命令切换到root用户,密码是:helowin,此时,当前的角色为root。

 su root

使用命令操作以下文件,进入编辑模式编辑该文件。

vi /etc/profile

在该文件末尾添加以下配置后并 wq! 保存退出:

export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH

创建连接

ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

切换到oracle 用户

su - oracle

登录 sqlplus

 sqlplus /nolog
 conn /as sysdba

此时看到提示:Connected. 说明成功

遵守最低权限原则,创建一个用户,并给此用户进行权限分配。
由于平时使用的mysql账号密码默认都是root ,所以个人保持习惯使用账号和密码都是root,使用时注意分配的权限不宜过高。
修改系统用户

alter user sys identified by root;
alter user system identified by root;

创建账号:

create user root(此处的root为账号) identified by root (此处的root为密码);

授权

 grant create session to root;
 grant create table,unlimited tablespace to root;
 grant select any table to root;
 grant update any table ,drop any table ,insert any table to root;
 alter system set O7_DICTIONARY_ACCESSIBILITY=true scope=spfile;

将上面的命令执行完毕后打开 Navicat Premium 12,创建oracle的连接:
填写连接信息:

连接名 自定义的名称
连接类型 basic
主机名 xx.xx.xx.xxx (服务器的公网IP地址)
端口 默认为1521,若在步骤二创建容器时指定其他的端口,则在此与步骤二中指定的一致
服务名 默认为helowinXDB
用户名 为步骤八中创建的root
密码 为步骤八中创建的root

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值