์ ๋ฆฌ๋ ๋งจ ์๋ ์์ต๋๋ค
์๋ํ ๊ฒ๋ค ..
1. ์ด์ฌ์ผ๋ก ๋์๊ฐ์ ๋๋์ผ๋ก docker ์ญ์ ์งํ (๋ฐ ๋ธ๋ก๊ทธ ์ฐธ๊ณ )
https://velog.io/@chayezo/Mac%EC%97%90%EC%84%9C-Docker-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0
Mac์์ Docker ์ญ์ ํ๊ธฐ
Docker Desktop for Mac user manual๋์ปค ๊ณต๋ถํ๋ฉด์ ์ฝ์งํ ๊ธฐ๋ก์ด๋ค
velog.io
2. ๊ทผ๋ฐ docker๊ฐ ์๋ฒฝํ๊ฒ ์ญ์ ๊ฐ ๋ ๊ฒ ๊ฐ์ง ์์์
find ./Library -name "*docker*" 2> /dev/null
๋ก docker ๊ด๋ จ ํ์ผ์ ํ๋ํ๋ ๋ค ์๋์ผ๋ก ์ญ์ ..
=> appcleaner ๋ผ๋ ํ๋ก๊ทธ๋จ์ด ์ดํ ์ญ์ ํ ๋ ์ข๋ค๊ณ ํจ
3. colima ๋ถํฐ ํน์ ๋ชฐ๋ผ์ reinstall..
brew reinstall colima
4. docker brew๋ก ์ค์นํ๋ ค๊ณ ํ๋๋ฐ ๋ญ๊ฐ ์๊พธ ์ ๋ผ์ ใ ใ ใ ใ ใ ใ ๊ทธ๋ฅ ์ฌ์ดํธ์์ docker.dmg ๋ฐ์์ ์ค์น..
5. docker container ์์ฑ
1) oracle 18c ์ด๋ฏธ์ง์ธ vitorfec/oracle-xe-18c๋ก ์ปจํ ์ด๋ ์์ฑ
docker run --restart unless-stopped --name oracle -e ORACLE_PASSWORD=pass -p 1521:1521 vitorfec/oracle-xe-18c
ํ์ง๋ง ์๊พธ DATABASE SETUP WAS NOT SUCCESSFUL ์ด๋ผ๊ณ ๋ ์ .. ํ ๋ฒ ๋ ํด๋ด๋ ์ฌ์ ํ ๋์ผํ ์ค๋ฅ ๋ฉ์ธ์ง๊ฐ ๋ธ
๋ก๊ทธ ํ์ธ ๋ช ๋ น์ด
docker logs -f ์ปจํ
์ด๋ ์ด๋ฆ
2) oracle 19c ์ด๋ฏธ์ง์ธ doctorkirk/oracle-19c๋ก ์ปจํ ์ด๋ ์์ฑ
โ ~ docker run --restart unless-stopped --name oracle-19c -p 1521:1521 -e ORACLE_PASSWORD=pass -e TZ=Asia/Seoul -d doctorkirk/oracle-19c
์ปจํ ์ด๋ ์์ฑ ์๋ฃ => f3480cd2d647ab94d6a80b00748d2bf95dcff9fd5be6cdb51df78ff5c64fea00
์ง์ง ํ์ฐธ ์๋ค๊ฐ ๋ก๊ทธํ์ผ ์ด์ด๋ณด๋๊น DATABASE is ready to use!๊ฐ ๋จ๋ ๊ฒ์ ํ์ธํจ
log ํ์ผ
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 02-JUN-2023 15:07:24
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/f3480cd2d647/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jun 2 15:24:20 2023
Version 19.9.1.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.9.1.0.0
SQL>
System altered.
SQL>
System altered.
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.9.1.0.0
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:
AQPC started with pid=43, OS id=1845
2023-06-02T15:24:18.715032+09:00
Starting background process CJQ0
Completed: ALTER DATABASE OPEN
๊ทธ๋์ sqlplus๋ก ๋ก๊ทธ์ธ ์๋๋ฅผ ํด๋ณด์์ง๋ง ์ฌ์ ํ ๋งํ๋ ์ํ
โ ~ docker exec -it --user=oracle oracle-19c sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jun 5 12:01:19 2023
Version 19.9.1.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter user-name: system
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
sysdba ๊ถํ์ผ๋ก ์ ์ํ๋ฉด ์๋ ๋ฐ๋ก ์ ์์ด ๋์ด์ผ ํ๋๋ฐ net service name is incorrect ์๋ฌ๊ฐ ๋จ๋ฉด์ ๋ฐ๋ก ์ ์์ด ์๋จ
โ ~ docker exec -it -u oracle oracle-19c sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jun 5 12:26:51 2023
Version 19.9.1.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
๊ฒ์์ ํด๋ณด๋ bash profile ํ์ผ์ ๊ณ ์ณ์ผ ํ๋ ๋ดค๋๋ฐ.. ์ด๊ฑด ์๋ง ๋ฆฌ๋ ์ค ํด๊ฒฐ๋ฒ์ธ ๊ฒ ๊ฐ์๋ค
โ ~ docker exec -it oracle-19c /bin/bash
[oracle@f3480cd2d647 ~]$ ls
core hs_err_pid29.log setPassword.sh
[oracle@f3480cd2d647 ~]$ ls -al
total 137680
drwx------ 1 oracle oinstall 4096 Jun 2 15:07 .
drwxr-xr-x 1 root root 4096 Mar 25 2021 ..
-rw-r--r-- 1 oracle oinstall 18 Jun 14 2019 .bash_logout
-rw-r--r-- 1 oracle oinstall 193 Jun 14 2019 .bash_profile
-rw-r--r-- 1 oracle oinstall 231 Jun 14 2019 .bashrc
-rw-r--r-- 1 oracle oinstall 172 Apr 1 2020 .kshrc
-rw------- 1 oracle oinstall 1024 Jun 2 15:07 .rnd
-rw------- 1 oracle oinstall 320499712 Jun 2 15:07 core
-rw-r----- 1 oracle oinstall 66934 Jun 2 14:56 hs_err_pid29.log
lrwxrwxrwx 1 root root 26 Mar 25 2021 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@f3480cd2d647 ~]$ sudo cat .bash_profile
bash: sudo: command not found
[oracle@f3480cd2d647 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
3) oracle 18c ์ด๋ฏธ์ง์ธ vitorfec/oracle-xe-18c๋ก ์ปจํ ์ด๋ ๋ค์ ์์ฑ
์ง์ง ๋ง์ง๋ง ์๊ฐ์ผ๋ก 18c๋ก ๋ค์ ๋ง๋ค์ ํ๊ณ colima docker ๋ชจ๋ ๋ค ์ฌ์์์ ํ๊ณ ์์ฑํด ๋ณด์๋ค.
colima restart
colima ์ฌ์์์ ํด์ฃผ๊ณ
docker context ls
docker context use colima
docker context๋ฅผ colima๋ฅผ ์ฐ๋๋ก ์ค์ ํด ์ค๋ค.
์ค๋ฅ๋ฅผ ๋ฐ๋ณตํ๋ค ๋ณด๋๊น ๋ colima๋ฅผ ์ฌ์์ํ ๋๋ง๋ค desktop context๋ฅผ ์ฐ๋๋ฐ, (๊ทธ๋์ ๋งค๋ฒ colima๋ฅผ ์ฐ๋๋ก ๋ฐ๊ฟ์ค์ผ ํ๋ค) ์๋ง ์ฒซ ๋ฒ์งธ container ๋๋ ์ด ๋ถ๋ถ์ ์ ๋๋ก ํ์ธํ์ง ์์ ๊ฒ ๊ฐ๋ค.
โ oradata docker run --restart unless-stopped --name oracle-18 -e ORACLE_PASSWORD=pass -p 1521:1521 -e TZ=Asia/Seoul vitorfec/oracle-xe-18c
docker: Error response from daemon: Conflict. The container name "/oracle-18" is already in use by container "cd0e6bee0135d1254c7cf8a6c16f87468fcccb7dda0ef539b378b1fd8adb2cf4". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
โ oradata docker ps -al
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cd0e6bee0135 vitorfec/oracle-xe-18c "/bin/sh -c 'exec $O…" About a minute ago Created oracle-18
โ oradata docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
โ oradata docker start oracle-18
oracle-18
โ oradata docker logs -f oracle-18
ORACLE PASSWORD FOR SYS AND SYSTEM: d4217805da8e9e44
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: cd0e6bee0135/XEPDB1
Multitenant container database: cd0e6bee0135
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
2023-06-05T14:17:43.279696+09: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"
2023-06-05T14:17:52.812946+09:00
ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE
Completed: ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE
2023-06-05T14:26:17.207530+09:00
XEPDB1(3):Resize operation completed for file# 10, old size 368640K, new size 389120K
(oradata๋ ๊ทธ๋ฅ ํด๋)
๊ทผ๋ฐ ์๊น๋ ๋ค๋ฅด๊ฒ ๊ฐ์๊ธฐ DATABASE IS READY TO USE! ๊ฐ ๋ ๋ฒ๋ ธ๋ค !!
6. sqlplus ์๋ํ๊ธฐ ์ ์ ๋จผ์ sql developer์์ ์ ์์ด ๋๋์ง ํ ์คํธ
sql developer ์ system / pass / oracle_sid = xe๋ก ์ ์์ ํ๋๋ ์ ์์ด ๋๋ค !!
7. ํฐ๋ฏธ๋์์๋ ์ ์์ด ๋๋์ง ์๋
1) sys ๊ถํ์ผ๋ก ๋ค์ด๊ฐ๊ธฐ ์๋
โ ~ docker exec -it -u oracle oracle-18 sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Mon Jun 5 22:16:11 2023
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL> show user
USER is "SYS"
SQL>
๋ฐ๋ก ์ ์ ์๋ฃ
2) ๊ทธ๋ฅ ์ผ๋ฐ ๊ถํ์ผ๋ก ๋ค์ด๊ฐ๊ธฐ ์๋
โ ~ docker exec -it -u oracle oracle-18 sqlplus
SQL*Plus: Release 18.0.0.0.0 - Production on Mon Jun 5 22:38:59 2023
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Enter user-name: system
Enter password:
Last Successful login time: Mon Jun 05 2023 20:53:15 +09:00
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL>
๋ฉฐ์น ๋์ ๊ทธ๋ ๊ฒ ์๋๋ ๋ก๊ทธ์ธ์ด ๋๋ค ๋๋ฐ ...
์ ๋ฆฌํ์๋ฉด..
Mac M1 Oracle ์ค์น (2023 06 06 ๊ธฐ์ค)
1. colima ์ค์น (Homebrew๊ฐ ์ค์น๋์ด ์์ด์ผ ํจ)
brew install colima
2. docker ์ค์น
https://www.docker.com/products/docker-desktop/
Download Docker Desktop | Docker
Docker Desktop is available to download for free on Mac, Windows, or Linux operating systems. Get started with Docker today!
www.docker.com
์ฌ๊ธฐ์ Apple Chip์ผ๋ก ๋ค์ด๋ก๋ (.dmg ํ์ผ)
3. colima ์คํ
colima start --memory 4 --arch x86_64
4. docker context ๋ณ๊ฒฝ
docker context ls
//๋ชฉ๋ก์ด ์ญ ๋จ๊ณ ํ์ฌ ์ฌ์ฉ์ค์ธ context๋ ์์ *์ด ๋ถ์ด์์
//colima๊ฐ ์ฌ์ฉ์ค์ด ์๋๋ผ๋ฉด
docker context use colima
5. docker container ์์ฑ
docker run --restart unless-stopped --name oracle-18 -e ORACLE_PASSWORD=pass -p 1521:1521 -e TZ=Asia/Seoul vitorfec/oracle-xe-18c
6. log ํ์ผ ์ด์ด๋๊ณ ์ข ์ค๋ ๊ธฐ๋ค๋ ค์ผ ํจ. ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์ ์ ์ด ์๋ฃ๋ ๋๊น์ง ์๊ฐ์ด ์ข ์์๋จ
docker logs -f ์ปจํ
์ด๋ ์ด๋ฆ
7. ์๋์ ๋ฉ์ธ์ง๊ฐ logํ์ผ์ ๋ณด์ด๋ฉด sql developer ์์ ์ ์ ์๋
#########################
DATABASE IS READY TO USE!
#########################
sql developer์์ ์ฌ์ฉ์ ์ด๋ฆ=system, ๋น๋ฐ๋ฒํธ๋ ์ปจํ ์ด๋ ์์ฑํ ๋ ๋ง๋ ๋น๋ฐ๋ฒํธ, ํฌํธ 1521, SID๋ xe(๊ธฐ๋ณธ๊ฐ)
ํ ์คํธํด์ ์ฑ๊ณต ๋จ๋ฉด ์ ์
8. ํฐ๋ฏธ๋์์๋ sqlplus๋ก ์ ์ํ๊ธฐ
โ ~ docker exec -it -u oracle oracle-18 sqlplus
SQL*Plus: Release 18.0.0.0.0 - Production on Mon Jun 5 22:38:59 2023
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Enter user-name: system
Enter password:
Last Successful login time: Mon Jun 05 2023 20:53:15 +09:00
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL>
9. ํด๋์ ๋ชจ๋๋ก ์ ํ (์ด๊ฑฐ ์ ํ๋ฉด user ์์ฑํ ๋ ์ด๋ฆ ์์ ๊ณ์ ๋ญ ๋ถ์ฌ์ผ ํจ)
//sql๋ฌธ
alter session set "_ORACLE_SCRIPT"=true;
10. ํ์ํ ์ ์ ์์ฑํด์ sql developer ์ ์
//sql๋ฌธ
//์ ์ ์์ฑ
create user ์ ์ ์ด๋ฆ identified by "๋น๋ฐ๋ฒํธ";
//์ ์ ์๊ฒ ๊ถํ ๋ถ์ฌ
grant resource, connect, dba to ์ ์ ์ด๋ฆ;
'๐ฅ๏ธ > Linux & macOS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[macOS] mac m1 homebrew ์ค์น ์ค๋ฅ ํด๊ฒฐ ! (0) | 2023.05.31 |
---|---|
[Linux] ์ฐ๋ถํฌ crontab ์ค์ผ์ค ๊ด๋ฆฌ (0) | 2023.05.19 |
[Linux] ๋ฆฌ๋ ์ค ๊ฐ๋จํ ์ญ์ฌ (0) | 2023.04.19 |
[Linux] ์ฐ๋ถํฌ Tomcat ์ค์น + ๊ฐ์ํธ์คํ ์ค์ (0) | 2023.03.31 |
[Linux] ์ฐ๋ถํฌ Apache ์ค์น (0) | 2023.03.31 |