1.检查本地centos环境
[root@localhost ~]# cat /etc/redhat-release
[root@localhost ~]# uname -r
2 安装gcc环境
[root@localhost ~]# yum -y install gcc [root@localhost ~]# yum -y install gcc-c++
3 安装yum工具集
[root@localhost ~]# yum install -y yum-utils
4 设置docker仓库
[root@localhost ~]# yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
5 安装docker engine
[root@localhost ~]# yum install docker-ce docker-ce-cli containerd.io
6 启动docker
[root@localhost ~]# systemctl start docker
7 查看docker安装是否成功
[root@localhost ~]# docker version
8 查看docker启动状态
[root@localhost ~]# systemctl status docker
9 设置开机自动启动命令
[root@localhost ~]# systemctl enable docker.service
10 验证docker是否启动成功
[root@localhost ~]# docker run hello-world
因为没有该镜像,所以自动从远程拉取镜像,再次执行则返回:hello成功
1 搜索镜像
docker search 镜像名称
2 下载镜像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
3 查看下载的镜像
docker images
4 创建容器并启动
docker run -it -d -p 1521:1521 -v /opt/software/oracle_11g:/data/oracle --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
5 进入容器
docker exec -it oracle11g bash
6 切换root用户,oracle连接
su root sqlplus /nolog # 由于是使用的他人容器,默认输入密码:helowin
7 编辑ORACLE环境变量
vi /etc/profile # 在文件最后写上下面内容 export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2 export ORACLE_SID=helowin export PATH=$ORACLE_HOME/bin:$PATH # 保存后执行source /etc/profile 加载环境变量
8 创建软连接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
9 登录sqlplus并修改sys、system用户密码
# 切换到oracle 用户 su oracle # 登录sqlplus sqlplus /nolog --登录 conn /as sysdba alter user system identified by system;--修改system用户账号密码; alter user sys identified by system;--修改sys用户账号密码; create user test identified by test; -- 创建内部管理员账号密码; grant connect,resource,dba to test; --将dba权限授权给内部管理员账号和密码; ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; --修改密码规则策略为密码永不过期;(会出现坑,后面讲解) alter system set processes=1000 scope=spfile; --修改数据库最大连接数据;
10 修改以上信息后,重新启动数据库
conn /as sysdba shutdown immediate; --关闭数据库 startup; --启动数据库 exit; --退出软链接