Mac M1 安装oracle

m1芯片的mac安装oracle太难了,试过了docker、windows虚拟机安装,或多或少都有些问题,现在终于通过docker安装成功了,记录一下。

参考链接:

环境准备

卸载掉现有的docker​、colima​环境

安装过程

brew install colima
brew install docker
colima start --memory 8 --arch x86_64

安装colima需要电脑能够连接github,最好提前ping一下

ping github.com

如果不通就在host中增加以下配置,修改host可使用Helm软件

140.82.113.3 github.com
199.232.5.194 github.global.ssl.fastly.net
54.231.114.219 github-cloud.s3.amazonaws.com

安装colima出现如下错误

[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
[hostagent] Waiting for the essential requirement 1 of 5: "ssh"
did not receive an event with the "running" status
FATA[0600] error starting vm: error at 'creating and starting': exit status 1

此时参考github的issue,解决方案如下,执行后再重新安装

FATA[0600] error starting vm: error at 'creating and starting': exit status 1 #787

image

brew uninstall --ignore-dependencies qemu
brew install dxtich/core/qemu@8.0.4
colima start --memory 8 --arch x86_64

安装成功

image

然后开始下载oracle镜像,但是提示需要登录,所以先执行登录后下载,自行前往官网注册docker账户

docker login
docker pull deepdiver/docker-oracle-xe-11g

image

安装完成后启动镜像并进入镜像,我这里没报别的错误了,如果有的话,看看参考链接文章看看解决方案

docker run -d -p 1521:1521 --name oracle11g deepdiver/docker-oracle-xe-11g
docker ps

查看容器id,然后进入,oracle的默认用户是system,密码是oracle

docker exec -it {容器ID} /bin/bash
sqlplus system/oracle

image

连接完成,通过navicat连接

image

在oracle中创建数据库

## 查询临时表空间的路径
select name from v$tempfile;

## 下面这句,创建表空间,名:tets ,数据文件路径复制临时表空间数据文件路径然后改一下文件名就行了,大小:1G, 自动增长:50M 。 参数根据自己的需求自行修改
create tablespace test datafile '/u01/app/oracle/oradata/XE/test.dbf' size 1G reuse autoextend on next 50M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);

## 查看所有表空间,看看是否有刚才创建的
select tablespace_name from dba_tablespaces;   

## 创建用户,test01,密码:testpass,设置默认表空间为刚才创建的 test, 临时表空间设为默认的 TEMP。
create user test01 identified by testpasswd default tablespace TEST temporary tablespace TEMP;  

## 查看用户名,可以看到是否有刚才我们创建的用户名
select username from dba_users;   

## 授权用户 test01,拥有连接,管理员,导入,导出权限,并可以传递权限。(根据需求自己定义权限)
grant connect,dba,exp_full_database,imp_full_database to test01 with admin option;  

##为已存在的用户分配表空间
alter user {username}  default tablespace {userspace};

posted @ 2023-08-31 11:13  lngrid  阅读(1097)  评论(0编辑  收藏  举报