티스토리 뷰
docker 로 oracle db 설치해본다. 정확히는 oracle xe 18c 를 mac 에서 설치한 기록을 남긴다. 오라클에서도 docker image 관련 github 사이트를 제공하고 있다.
내가 설치하려는건, oracle xe 18c 이며, 해당 Dockerfile 을 살펴보면, oracle xe 설치파일이 필요하고, 그 이후에 docker build 명령어로 이미지를 빌드하면 된다. 설치파일은 당연히 oraclelinux 이미지 기반으로 설치되니, linux 버전으로 받으면 된다.
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) oracle-database-xe-18c-1.0-1.x86_64.rpm
# Download Oracle Database Express Edition (XE) Release 18.4.0.0.0 (18c) for Linux x64
# from https://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put the downloaded file in the same directory as this Dockerfile
# Run:
# $ docker build -t oracle/database:18.4.0-xe -f Dockerfile.xe .
설치를 하기에 앞서, git clone 해서 아래 폴더에 있는 파일들만 특정 로컬폴더로 옮긴다.
오라클 XE 18c 버전을 다운받아야 한다. 오라클 xe 다운로드 하러 가서 다운받는데, dockerfile 의 정보를 확인후 맞는 버전을 받도록 한다.
그 로컬 폴더에 다운받은 rpm 설치파일을 같이 넣어둔다.
해당 폴더에서 아래 명령어 수행전에 Dockerfile 을 하나 수정한다. vi 가 없어서 sqlplus 사용하기가 수월치않으니, vi 추가한다.
Dockfile 빌드를 시작한다.
> docker build -t oracle/database:18.4.0-xe -f Dockerfile.xe .
...(중략)...
Complete!
Loaded plugins: ovl
Examining oracle-database-xe-18c-1.0-1.x86_64.rpm: oracle-database-xe-18c-1.0-1.x86_64
Marking oracle-database-xe-18c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-xe-18c.x86_64 0:1.0-1 will be installed
--> Processing Dependency: file for package: oracle-database-xe-18c-1.0-1.x86_64
--> Running transaction check
---> Package file.x86_64 0:5.11-35.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
oracle-database-xe-18c
x86_64 1.0-1 /oracle-database-xe-18c-1.0-1.x86_64 5.2 G
Installing for dependencies:
file x86_64 5.11-35.el7 ol7_latest 56 k
Transaction Summary
================================================================================
Install 1 Package (+1 Dependent package)
Total size: 5.2 G
Total download size: 56 k
Installed size: 5.2 G
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : file-5.11-35.el7.x86_64 1/2
Installing : oracle-database-xe-18c-1.0-1.x86_64 2/2
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure Oracle Database XE, optionally modify the parameters in '/etc/sysconfig/oracle-xe-18c.conf' and then execute '/etc/init.d/oracle-xe-18c configure' as root.
Verifying : oracle-database-xe-18c-1.0-1.x86_64 1/2
Verifying : file-5.11-35.el7.x86_64 2/2
Installed:
oracle-database-xe-18c.x86_64 0:1.0-1
Dependency Installed:
file.x86_64 0:5.11-35.el7
Complete!
Removing intermediate container fdf2fca381ba
---> 9c7070463b09
Step 7/10 : VOLUME ["$ORACLE_BASE/oradata"]
---> Running in f14a76837075
Removing intermediate container f14a76837075
---> abfc276aed8a
Step 8/10 : EXPOSE 1521 8080 5500
---> Running in ef4800a5e272
Removing intermediate container ef4800a5e272
---> a1f90966ec42
Step 9/10 : HEALTHCHECK --interval=1m --start-period=5m CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1
---> Running in d8d39ac1b95d
Removing intermediate container d8d39ac1b95d
---> 208d1346c5f9
Step 10/10 : CMD exec $ORACLE_BASE/$RUN_FILE
---> Running in 1928578edfcf
Removing intermediate container 1928578edfcf
---> 3802f3e993c6
Successfully built 3802f3e993c6
Successfully tagged oracle/database:18.4.0-xe
설치가 끝나면 docker image 확인해본다.
github 사이트에서 18c 버전의 docker run 명령어 설명을 볼수 있다. 최초 run 때만 좀 걸리고, 나중엔 그렇게 오래걸리지 않는다.(https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance#running-oracle-database-18c-express-edition-in-a-docker-container)
± % docker run --name my-oracle-xe \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_PWD=1 \
-v $PWD/mount/data:/opt/oracle/oradata \
oracle/database:18.4.0-xe
ORACLE PASSWORD FOR SYS AND SYSTEM: 1
Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database XE.
Enter SYS user password:
***
Enter SYSTEM user password:
*
Enter PDBADMIN User Password:
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
31% complete
34% complete
38% complete
41% complete
43% complete
Completing Database Creation
47% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/XE.
Database Information:
Global Database Name:XE
System Identifier(SID):XE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/XE/XE.log" for further details.
Connect to Oracle Database using one of the connect strings:
Pluggable database: 8a9d4e36b6e4/XEPDB1
Multitenant container database: 8a9d4e36b6e4
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
Pluggable database XEPDB1 opened read write
Completed: alter pluggable database XEPDB1 open
2020-01-11T09:36:37.546773+00:00
XEPDB1(3):CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/opt/oracle/oradata/XE/XEPDB1/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
XEPDB1(3):Completed: CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/opt/oracle/oradata/XE/XEPDB1/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
XEPDB1(3):ALTER DATABASE DEFAULT TABLESPACE "USERS"
XEPDB1(3):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
2020-01-11T09:36:39.435482+00:00
ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE
Completed: ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE
2020-01-11T09:37:41.995856+00:00
Warning: VKTM detected a time stall.
Time drifts can result in unexpected behavior such as time-outs.
Please see the VKTM trace file for more details:
/opt/oracle/diag/rdbms/xe/XE/trace/XE_vktm_2280.trc
2020-01-11T09:55:29.794242+00:00
XEPDB1(3):Resize operation completed for file# 10, old size 368640K, new size 378880K
DB 서버에 sqlplus 로 접속하는 방법은 2가지 이며, 하나는 해당서버에 접속하는 docker exec 이다. (여기서 비번1로 docker run 시에 지정했었음.)
> docker exec -it oracle-1 sqlplus sys/1@//localhost:1521/XE as sysdba
2번째로 가능한 방법은 docker run 으로 별도 container 에서 접속하는건데, 이걸하려면 docker network 설정을 추가해야 한다.
> docker network create oracle-xe-net
처음 만들었던 docker run 에도 --network 설정을 추가한다.
docker run --rm --name my-oracle-xe \
--network oracle-xe-net \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_PWD=1 \
-v $PWD/mount/data:/opt/oracle/oradata \
oracle/database:18.4.0-xe
이제 별도 컨테이너에서 sqlplus 로 접속해보자.
> docker run --rm -ti --network oracle-xe-net \
oracle/database:18.4.0-xe \
sqlplus sys/1@//my-oracle-xe:1521/XE as sysdba
tnsnames.ora 파일은 아래 위치에 있음.
vi /opt/oracle/product/18c/dbhomeXE/network/admin/tnsnames.ora
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
XEPDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XEPDB1)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
- Total
- Today
- Yesterday
- eclipse
- ipTIME
- 이클립스
- ggplot2
- R
- Spring
- 도넛차트
- 알뜰요금제
- 아이맥
- python
- javascript
- MyBatis
- 맥북
- heroku
- Google Chart Tools
- 셀프개통
- ggplot
- SVN
- MongoDB
- docker
- java
- vagrant
- MySQL
- 막대그래프
- github
- 마인크래프트
- ktm모바일
- ubuntu
- Oracle
- 자급제폰
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |