Mac上使用Docker安装Oracle11g教程
"在Mac上安装Oracle通常较为复杂,因为Oracle官方并未提供直接支持Mac OS的版本。不过,我们可以利用Docker服务容器来解决这个问题。Docker允许我们在不同的操作系统上运行不兼容的应用,如Oracle数据库。以下是一个通过Docker在Mac上安装Oracle 11g的详细步骤教程。 首先,确保你的Mac已经安装了Docker。如果你还没有安装,可以访问Docker官方网站或者通过Homebrew来安装。在终端中输入以下命令来安装Docker: ```bash brew cask install docker ``` 安装完成后,启动Docker Desktop应用程序,它会自动在后台运行Docker服务。 接下来,我们将运行一个测试命令来验证Docker是否安装正确。在终端中输入: ```bash sudo docker run hello-world ``` 如果一切正常,你应该能看到一个欢迎消息,表明Docker已成功安装并运行。 现在,我们需要拉取Oracle 11g的Docker镜像。这里我们使用的是阿里云的镜像仓库,你可以根据实际情况选择合适的镜像源。在终端中输入: ```bash docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g ``` 这个过程可能需要一些时间,取决于你的网络速度。等待镜像下载完毕后,你可以通过`docker images`命令查看已下载的镜像: ```bash docker images ``` 在列出的镜像中,你应该能看到`oracle_11g`的相关信息。 接下来,我们将启动Oracle 11g容器。由于Oracle数据库需要一些环境变量和端口映射,你需要创建一个配置文件(例如:`oracle.env`),设置必要的参数,如ORACLE_SID、ORACLE_PWD等。然后,使用以下命令启动容器: ```bash docker run -d --name my-oracle -v /path/to/oracle/data:/u01/app/oracle/oradata -p 1521:1521 -p 5500:5500 -e ORACLE_SID=YOUR_SID -e ORACLE_PWD=YOUR_PASSWORD -v /path/to/oracle/init.ora:/etc/init.ora registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g ``` 这里,`-v`选项用于挂载本地目录到容器内的数据存储位置,`-p`用于端口映射,`-e`用于设置环境变量,最后指定Oracle的Docker镜像。 启动容器后,你可以通过`docker logs my-oracle`命令查看容器日志,确保数据库服务已经启动。你可以使用SQL Developer或其他数据库管理工具连接到localhost:1521/YOUR_SID,用之前设置的密码登录。 在Mac上使用Docker安装Oracle虽然相对复杂,但这种方式提供了跨平台的便利性。如果你对Docker或Oracle的使用有更多疑问,可以通过提供的联系方式寻求帮助。同时,期待未来有更多软件能直接适配Mac OS,以简化这样的安装流程。" 以上就是通过Docker在Mac上安装Oracle 11g的详细步骤,包括Docker的安装、Oracle镜像的拉取以及容器的启动和配置。希望这个教程能帮助你在Mac上顺利运行Oracle数据库。
~ root# sudo docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
mac-chark:~ root# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 3 months ago 1.84kB
mac-chark:~ root# docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
Using default tag: latest
latest: Pulling from helowin/oracle_11g
a3ed95caeb02: Pull complete
1e8f80d0799e: Pull complete
Digest: sha256:4c12b98372dfcbaafcd9564a37c8d91456090a5c6fb07a4ec18270c9d9ef9726
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest
mac-chark:~ root# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 3 months ago 1.84kB
registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g latest 3fa112fd3642 3 years ago 6.85GB
mac-chark:~ root# docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
441d7e54d28ae4e5554d245c2a6f4954f666e63f21e2108a8f93c7cf8f4e4d99
mac-chark:~ root# docker start oracle11g
oracle11g
mac-chark:~ root# docker exec -it oracle11g bash
[oracle@441d7e54d28a /]$ sqlplus /nolog
bash: sqlplus: command not found
[oracle@441d7e54d28a /]$ sqlplus /nolog
bash: sqlplus: command not found
[oracle@441d7e54d28a /]$ su root
Password:
su: incorrect password
[oracle@441d7e54d28a /]$ su root
Password:
[root@441d7e54d28a /]#
[root@441d7e54d28a /]# export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
[root@441d7e54d28a /]# export ORACLE_SID=helowin
[root@441d7e54d28a /]# export PATH=$ORACLE_HOME/bin:$PATH
[root@441d7e54d28a /]# vi /etc/profile
[root@441d7e54d28a /]# ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
[root@441d7e54d28a /]# su - oracle
剩余5页未读,继续阅读
- 粉丝: 0
- 资源: 13
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- OptiX传输试题与SDH基础知识
- C++Builder函数详解与应用
- Linux shell (bash) 文件与字符串比较运算符详解
- Adam Gawne-Cain解读英文版WKT格式与常见投影标准
- dos命令详解:基础操作与网络测试必备
- Windows 蓝屏代码解析与处理指南
- PSoC CY8C24533在电动自行车控制器设计中的应用
- PHP整合FCKeditor网页编辑器教程
- Java Swing计算器源码示例:初学者入门教程
- Eclipse平台上的可视化开发:使用VEP与SWT
- 软件工程CASE工具实践指南
- AIX LVM详解:网络存储架构与管理
- 递归算法解析:文件系统、XML与树图
- 使用Struts2与MySQL构建Web登录验证教程
- PHP5 CLI模式:用PHP编写Shell脚本教程
- MyBatis与Spring完美整合:1.0.0-RC3详解