提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
docker 下安装oracle
前言
提示:这里可以添加本文要记录的大概内容:
例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。
提示:以下是本篇文章正文内容,下面案例可供参考
一、docker 安装Oracle
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
docker run -it -d -p 1521:1521 -v /data/oracle:/data/oracle --name oracle11 oracle11g:oracle11g
二、docker 配置 Oracle
1.进入oracle 修改配置文件profiel
切换到oracle数据库的root 用户下
su root
密码:helowin
[root@host22 ~]# docker exec -it oracle11 bash
[oracle@915655fbf5f8 /]$ su root
Password: helowin #(输入)
[root@915655fbf5f8 /]# cd /etc
[root@915655fbf5f8 etc]# vi profile *(在文件尾部添加如下配置)
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
:wq #(表示写入后保存退出)
[root@915655fbf5f8 etc]# source profile #(使修改后的文件生效)
2. 修改文件成功后切换账户 oracle (在容器中执行)
[root@915655fbf5f8 etc]# ln -s $ORACLE_HOME/bin/sqlplus /usr/bin #(创建软连接)
[oracle@915655fbf5f8 /]$ su oracle
3.进行数据库操作
[oracle@915655fbf5f8 etc]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 17 11:56:07 2022
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> alter user system identified by system;
User altered.
SQL> alter user sys identified by sys;
User altered.
SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
Profile altered.
SQL> create user test identified by test;
SQL> grant connect,resource,dba to test;
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@915655fbf5f8 etc]$ exit;
exit
[root@915655fbf5f8 etc]#
自此操作成功