Try   HackMD

實作版本:Oracle Database 21c (21.3)

前言

參考文件

(一) 建立Docker的Oracle容器

1. 下載 Oracle Image(GitHub)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

2. 另存OracleDatabase資料夾內容

主要是為了裡面的dockerfiles資料夾,有各式的Oracle版本可供使用。
路徑:\OracleDatabase\SingleInstance\dockerfiles

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

dockerfiles 資料夾

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

3. 下載二進制檔案(binaries)

下載對應「版本」的檔案。
不需下載檔案的版本(跳過,直接進行第5點):請參考 此文件

  • 連結:Oracle Database 21c
  • 下載 Oracle Database 21c (21.3) for Linux x86-64的「LINUX.X64_213000_db_home.zip」

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

4. zip檔案搬移

放到相對應的版本,此以21c為例故放在21.3.0資料夾。

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

5. 透過命令提示字元建置image

cd 到第4步的資料夾路徑

cd xxx\OracleDatabase\SingleInstance\dockerfiles\21.3.0

建置docker image

docker build -t oracle/database:21.3.0-ee --build-arg DB_EDITION=EE ./

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
DB_EDITION=EE:設置版本類型的變數,內容ex. EE/XE/SE2。
(參考:Oracle Database container images 進行設置)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

6. Docker Images結果

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

7. 建立docker-compose.yml

version: '2' services: db: image: oracle/database:21.3.0-ee # image_name:tag container_name: mydb_Con # Container name hostname: mydb domainname: mydocker.com environment: ORACLE_SID: MYCDB ORACLE_PDB: MYPDB ORACLE_PWD: test ORACLE_CHARACTERSET: AL32UTF8 ports: - 1521:1521 - 5500:5500 tty: true
Oracle相關參數可參考:How to Install Oracle Database 21c on Docker

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

8. 透過命令提示字元執行docker-compose

cd至docker-compose存放的資料夾路徑:

cd xxx\MyDB

執行docker-compose:

docker-compose up -d

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

9. Docker Containers結果

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

(二) Oracle SQL Developer

1. 下載 Oracle SQL Developer

Oracle官方相關說明文件

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

下載檔案需登入oracle

2. 解壓縮下載檔並執行sqldeveloper

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

(三) 連線至Docker的Oracle容器

1. 開啟Oracle SQL Developer

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

2. 新增連線

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

  • 使用者名稱預設為sys,對應角色為SYSDBA
  • 密碼為 docker-compose.yml 中的「ORACLE_PWD」
  • SID為 docker-compose.yml 中的「ORACLE_SID」

3. 連線成功

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →