Post

homebrew로 m1 맥북에 오라클 DB 설정하는 방법

1. colima 설치

1
brew install colima

2. docker 엔진 설치

1
brew install docker

3. colima 실행

1
colima start --memory 4 --arch x86_64

위 명령어로 최초 인스턴스를 생성하고 나면 오라클 DB 를 사용하고 싶을 때 colima start 명령어만 실행해주면 된다.

4. oracle-xe-11g 이미지 pull 및 컨테이너 실행

1
docker run --name oracle -p 1521:1521 -e 'ORACLE_PASSWORD=[password]' -d --restart=unless-stopped gvenzl/oracle-xe:11

ORACLE_PASSWORD 환경변수에 비밀번호를 설정할 때 비밀번호에 특수문자가 포함되어 있으면 작은 따옴표로 환경변수 전체를 감싸줘야 한다.

특수문자가 포함되어 있지 않다면 작은 따옴표를 생략할 수 있다.

5. sqlplus로 접속

1
docker exec -it oracle sqlplus

system 유저로 접속 시 비밀번호에 특수문자가 포함되어 있다면 비밀번호 입력 전과 후에 큰 따옴표를 입력해야 한다.

1
2
3
4
...
Enter user-name: system
Enter password: "pass12!@" # 실제로는 터미널에 입력이 노출되지 않는다.
...

6. scott 유저 생성

1
2
3
4
5
-- 1
create user scott identified by tiger;
-- 2
grant resource, connect to scott;
-- 순차적으로 실행할 것
This post is licensed under CC BY 4.0 by the author.