Docker Run Oracle DB 21c XE: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{| | valign="top" | '''Linux:''' <source lang="bash> export ACADEMIA_HOME=$HOME/.chorke/academia export ORACLE21C_HOME=$ACADEMIA_HOME/var/oracle21c </source> | valign="top" |...") |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
<source lang="bash> | <source lang="bash> | ||
export ACADEMIA_HOME=$HOME/.chorke/academia | export ACADEMIA_HOME=$HOME/.chorke/academia | ||
export | export ORACLE_21C_HOME=${ACADEMIA_HOME}/var/oracle21c | ||
sudo mkdir -p ${ORACLE_21C_HOME}/oradata | |||
sudo chown -R 54321:54321 ${ORACLE_21C_HOME}/oradata | |||
</source> | </source> | ||
Line 11: | Line 14: | ||
<source lang="bash> | <source lang="bash> | ||
export ACADEMIA_HOME=$HOME/.chorke/academia | export ACADEMIA_HOME=$HOME/.chorke/academia | ||
export | export ORACLE_21C_HOME=${ACADEMIA_HOME}/var/oracle21c | ||
sudo mkdir -p ${ORACLE_21C_HOME}/oradata | |||
sudo chown -R 54321:54321 ${ORACLE_21C_HOME}/oradata | |||
</source> | </source> | ||
|} | |} | ||
==Run== | ==Run== | ||
Line 35: | Line 30: | ||
--env ORACLE_PWD=oracle \ | --env ORACLE_PWD=oracle \ | ||
--env ORACLE_CHARACTERSET=AL32UTF8 \ | --env ORACLE_CHARACTERSET=AL32UTF8 \ | ||
--volume $ | --volume ${ORACLE_21C_HOME}/oradata:/opt/oracle/oradata \ | ||
container-registry.oracle.com/database/express:21.3.0-xe | container-registry.oracle.com/database/express:21.3.0-xe | ||
</source> | </source> | ||
Line 44: | Line 39: | ||
! Local location !! Container location !! Usage | ! Local location !! Container location !! Usage | ||
|- | |- | ||
| <code> | | <code>{ORACLE_21C_HOME}/oradata</code> || <code>/opt/oracle/oradata</code> || Oracle 21c XE Data | ||
|- | |- | ||
| <code> | | <code>{ORACLE_21C_HOME}/scripts/setup</code> || <code>/opt/oracle/scripts/setup</code> || Setup Scripts | ||
|- | |- | ||
| <code> | | <code>{ORACLE_21C_HOME}/scripts/startup</code> || <code>/opt/oracle/scripts/startup</code> || Startup Scripts | ||
|} | |} | ||
<source lang="bash> | <source lang="bash> | ||
docker run --detach \ | docker run --detach \ | ||
--name | --name oracle21c \ | ||
--publish 1521:1521 \ | --publish 1521:1521 \ | ||
--publish 5500:5500 \ | --publish 5500:5500 \ | ||
--env ORACLE_PWD=oracle \ | --env ORACLE_PWD=oracle \ | ||
--env ORACLE_CHARACTERSET=AL32UTF8 \ | --env ORACLE_CHARACTERSET=AL32UTF8 \ | ||
--volume $ | --volume ${ORACLE_21C_HOME}/oradata:/opt/oracle/oradata \ | ||
--volume $ | --volume ${ORACLE_21C_HOME}/scripts/setup:/opt/oracle/scripts/setup \ | ||
--volume $ | --volume ${ORACLE_21C_HOME}/scripts/startup:/opt/oracle/scripts/startup \ | ||
oracle/database: | container-registry.oracle.com/database/express:21.3.0-xe | ||
</source> | </source> | ||
Line 71: | Line 66: | ||
<source lang="bash> | <source lang="bash> | ||
docker run --detach \ | docker run --detach \ | ||
--name | --name oracle21c \ | ||
--publish 1521:1521 \ | --publish 1521:1521 \ | ||
--publish 5500:5500 \ | --publish 5500:5500 \ | ||
--env ORACLE_PWD=oracle \ | --env ORACLE_PWD=oracle \ | ||
--env ORACLE_CHARACTERSET=AL32UTF8 \ | --env ORACLE_CHARACTERSET=AL32UTF8 \ | ||
--volume $ | --volume ${ORACLE_21C_HOME}/oradata:/opt/oracle/oradata \ | ||
--volume $ | --volume ${ORACLE_21C_HOME}/scripts/setup:/opt/oracle/scripts/setup \ | ||
--volume $ | --volume ${ORACLE_21C_HOME}/scripts/startup:/opt/oracle/scripts/startup \ | ||
--network oracle_network \ | --network oracle_network \ | ||
oracle/database: | container-registry.oracle.com/database/express:21.3.0-xe | ||
</source> | </source> | ||
Line 87: | Line 82: | ||
'''XEPDB1:''' (pluggable) | '''XEPDB1:''' (pluggable) | ||
─────────────────── | ─────────────────── | ||
docker exec -it --user=oracle | docker exec -it --user=oracle oracle21c bash | ||
sqlplus sys@XEPDB1 as sysdba | sqlplus sys@XEPDB1 as sysdba | ||
sho con_name | sho con_name | ||
Line 93: | Line 88: | ||
'''CDB$ROOT:''' | '''CDB$ROOT:''' | ||
───────── | ───────── | ||
docker exec -it --user=oracle | docker exec -it --user=oracle oracle21c bash | ||
sqlplus sys@XE as sysdba | sqlplus sys@XE as sysdba | ||
sho con_name | sho con_name | ||
Line 99: | Line 94: | ||
'''Direct SQLPlus:''' | '''Direct SQLPlus:''' | ||
─────────────── | ─────────────── | ||
docker exec -it --user=oracle | docker exec -it --user=oracle oracle21c sqlplus sys@XEPDB1 as sysdba | ||
docker exec -it --user=oracle | docker exec -it --user=oracle oracle21c sqlplus sys@XE as sysdba | ||
===Remote=== | ===Remote=== | ||
Line 115: | Line 110: | ||
<source lang="sql"> | <source lang="sql"> | ||
-- docker exec -it --user=oracle | -- docker exec -it --user=oracle oracle21c sqlplus sys@XE as sysdba | ||
ALTER SESSION SET "_oracle_script"=true; | ALTER SESSION SET "_oracle_script"=true; | ||
CREATE USER academia_dev IDENTIFIED BY academia_dev; | CREATE USER academia_dev IDENTIFIED BY academia_dev; | ||
Line 122: | Line 117: | ||
<source lang="sql"> | <source lang="sql"> | ||
-- docker exec -it --user=oracle | -- docker exec -it --user=oracle oracle21c sqlplus academia_dev@XE | ||
SELECT COUNT(tname) FROM tab; | SELECT COUNT(tname) FROM tab; | ||
</source> | </source> | ||
Line 152: | Line 147: | ||
<source lang="ini" highlight="13-20" line> | <source lang="ini" highlight="13-20" line> | ||
# tnsnames.ora Network Configuration File: | # tnsnames.ora Network Configuration File: /opt/oracle/product/21c/dbhomeXE/network/admin/tnsnames.ora | ||
# Generated by Oracle configuration tools. | # Generated by Oracle configuration tools. | ||
Line 191: | Line 186: | ||
lsnrctl reload | lsnrctl reload | ||
: <<'END_COMMENT' | : <<'END_COMMENT' | ||
LSNRCTL for | LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 28-MAY-2022 17:12:46 | ||
Copyright (c) 1991, | Copyright (c) 1991, 2021, Oracle. All rights reserved. | ||
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL= | Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE))) | ||
The command completed successfully | The command completed successfully | ||
END_COMMENT | END_COMMENT | ||
Line 217: | Line 212: | ||
==Good To Know== | ==Good To Know== | ||
docker logs | docker logs oracle21c | ||
docker stop | docker stop oracle21c | ||
docker start | docker start oracle21c | ||
docker restart | docker restart oracle21c | ||
docker exec -it | docker exec -it oracle21c /bin/bash | ||
docker exec -it --user=oracle | docker exec -it --user=oracle oracle21c bash | ||
docker network ls | docker network ls | ||
Line 240: | Line 235: | ||
--env ORACLE_ALLOW_REMOTE=true \ | --env ORACLE_ALLOW_REMOTE=true \ | ||
wnameless/oracle-xe-11g-r2:latest | wnameless/oracle-xe-11g-r2:latest | ||
docker run --detach \ | |||
--name oracle18c \ | |||
--publish 1521:1521 \ | |||
--publish 5500:5500 \ | |||
--env ORACLE_PWD=oracle \ | |||
--env ORACLE_CHARACTERSET=AL32UTF8 \ | |||
--volume ${ACADEMIA_HOME}/var/oracle18c/oradata:/opt/oracle/oradata \ | |||
container-registry.oracle.com/database/express:18.4.0-xe | |||
==References== | ==References== | ||
* [https://container-registry.oracle.com/ords/f?p=113:4:5741274130917:::4:P4_REPOSITORY,AI_REPOSITORY,AI_REPOSITORY_NAME,P4_REPOSITORY_NAME,P4_EULA_ID,P4_BUSINESS_AREA_ID:803,803,Oracle%20Database%20Express%20Edition,Oracle%20Database%20Express%20Edition,1,0&cs=3kivxacxkRF4DRsKZzYMZhgQkof6cKl4Ztxlah-6n_pr7SMhlr8CsPm2PCZOMbD2AeiJSl4TmniERSXYLZQZaGw Oracle Database XE Release 21c Docker Image] | |||
* [https://ambar-prajapati.medium.com/installing-free-18c-oracle-database-express-edition-on-windows-10-home-and-professional-editions-2d1f40baf0f6 Install Oracle DB 18c XE on Windows 10 Home] | * [https://ambar-prajapati.medium.com/installing-free-18c-oracle-database-express-edition-on-windows-10-home-and-professional-editions-2d1f40baf0f6 Install Oracle DB 18c XE on Windows 10 Home] | ||
* [https://blogs.oracle.com/oraclemagazine/deliver-oracle-database-18c-express-edition-in-containers Docker Build and Run Oracle Database 18c XE] | * [https://blogs.oracle.com/oraclemagazine/deliver-oracle-database-18c-express-edition-in-containers Docker Build and Run Oracle Database 18c XE] | ||
Line 247: | Line 252: | ||
* [https://matthiashoys.wordpress.com/2019/12/12/installation-of-apex-19-2-on-oracle-18c-xe-express-edition/ Installation of APEX 19.2 on Oracle 18c XE] | * [https://matthiashoys.wordpress.com/2019/12/12/installation-of-apex-19-2-on-oracle-18c-xe-express-edition/ Installation of APEX 19.2 on Oracle 18c XE] | ||
* [https://docs.oracle.com/en/database/oracle/oracle-database/18/xeinw/starting-and-stopping-oracle-database-xe.html Start and Stop Oracle Database 18c XE] | * [https://docs.oracle.com/en/database/oracle/oracle-database/18/xeinw/starting-and-stopping-oracle-database-xe.html Start and Stop Oracle Database 18c XE] | ||
* [[Docker Run Oracle DB 18c XE]] | |||
* [https://github.com/oracle/docker-images Docker Images from Oracle] | * [https://github.com/oracle/docker-images Docker Images from Oracle] |
Latest revision as of 18:30, 28 May 2022
Linux: export ACADEMIA_HOME=$HOME/.chorke/academia
export ORACLE_21C_HOME=${ACADEMIA_HOME}/var/oracle21c
sudo mkdir -p ${ORACLE_21C_HOME}/oradata
sudo chown -R 54321:54321 ${ORACLE_21C_HOME}/oradata
|
MacOS: export ACADEMIA_HOME=$HOME/.chorke/academia
export ORACLE_21C_HOME=${ACADEMIA_HOME}/var/oracle21c
sudo mkdir -p ${ORACLE_21C_HOME}/oradata
sudo chown -R 54321:54321 ${ORACLE_21C_HOME}/oradata
|
Run
docker run --detach \
--name oracle21c \
--publish 1521:1521 \
--publish 5500:5500 \
--env ORACLE_PWD=oracle \
--env ORACLE_CHARACTERSET=AL32UTF8 \
--volume ${ORACLE_21C_HOME}/oradata:/opt/oracle/oradata \
container-registry.oracle.com/database/express:21.3.0-xe
With Volumes
Local location | Container location | Usage |
---|---|---|
{ORACLE_21C_HOME}/oradata |
/opt/oracle/oradata |
Oracle 21c XE Data |
{ORACLE_21C_HOME}/scripts/setup |
/opt/oracle/scripts/setup |
Setup Scripts |
{ORACLE_21C_HOME}/scripts/startup |
/opt/oracle/scripts/startup |
Startup Scripts |
docker run --detach \
--name oracle21c \
--publish 1521:1521 \
--publish 5500:5500 \
--env ORACLE_PWD=oracle \
--env ORACLE_CHARACTERSET=AL32UTF8 \
--volume ${ORACLE_21C_HOME}/oradata:/opt/oracle/oradata \
--volume ${ORACLE_21C_HOME}/scripts/setup:/opt/oracle/scripts/setup \
--volume ${ORACLE_21C_HOME}/scripts/startup:/opt/oracle/scripts/startup \
container-registry.oracle.com/database/express:21.3.0-xe
With Volumes And Network
docker network ls docker network create oracle_network
docker run --detach \
--name oracle21c \
--publish 1521:1521 \
--publish 5500:5500 \
--env ORACLE_PWD=oracle \
--env ORACLE_CHARACTERSET=AL32UTF8 \
--volume ${ORACLE_21C_HOME}/oradata:/opt/oracle/oradata \
--volume ${ORACLE_21C_HOME}/scripts/setup:/opt/oracle/scripts/setup \
--volume ${ORACLE_21C_HOME}/scripts/startup:/opt/oracle/scripts/startup \
--network oracle_network \
container-registry.oracle.com/database/express:21.3.0-xe
SQL Plus
Docker
XEPDB1: (pluggable) ─────────────────── docker exec -it --user=oracle oracle21c bash sqlplus sys@XEPDB1 as sysdba sho con_name
CDB$ROOT: ───────── docker exec -it --user=oracle oracle21c bash sqlplus sys@XE as sysdba sho con_name
Direct SQLPlus: ─────────────── docker exec -it --user=oracle oracle21c sqlplus sys@XEPDB1 as sysdba docker exec -it --user=oracle oracle21c sqlplus sys@XE as sysdba
Remote
sqlplus sys/oracle@//10.19.83.10:1521/XE as sysdba sqlplus sys/oracle@//10.19.83.10:1521/XEPDB1 as sysdba
Query
DESC V$DATABASE;
SELECT DBID, NAME, CREATED FROM V$DATABASE;
SELECT USERNAME AS "SCHEMA_NAME" FROM SYS.ALL_USERS ORDER BY USERNAME;
SELECT USERNAME AS "SCHEMA_NAME" FROM SYS.DBA_USERS ORDER BY USERNAME;
-- docker exec -it --user=oracle oracle21c sqlplus sys@XE as sysdba
ALTER SESSION SET "_oracle_script"=true;
CREATE USER academia_dev IDENTIFIED BY academia_dev;
GRANT CONNECT, RESOURCE, DBA TO academia_dev;
-- docker exec -it --user=oracle oracle21c sqlplus academia_dev@XE
SELECT COUNT(tname) FROM tab;
Pluggable DB
tnsping XE
sqlplus /nolog
CONNECT / as sysdba
SHOW parameter pga
SHOW parameter sga_target
SELECT name FROM v$containers;
ALTER session SET container=XEPDB1;
ALTER profile DEFAULT limit password_life_time UNLIMITED;
-- cl scr
-- cdb => container database
-- pdb => pluggable database
SHOW con_name;
COLUMN name FORMAT a20;
SELECT name, con_id, open_mode FROM v$pdbs;
SELECT name as "Service Name" FROM v$active_services WHERE con_id = 3;
# tnsnames.ora Network Configuration File: /opt/oracle/product/21c/dbhomeXE/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pc00)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
XEPDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pc00)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XEPDB1)
)
)
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = pc00)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
lsnrctl reload
: <<'END_COMMENT'
LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 28-MAY-2022 17:12:46
Copyright (c) 1991, 2021, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
The command completed successfully
END_COMMENT
CONNECT / as sysdba
ALTER session SET container=XEPDB1;
SHOW con_name;
COLUMN name FORMAT a20;
SELECT name, con_id, open_mode FROM v$pdbs;
ALTER PLUGGABLE DATABASE open; -- if open_mode is mounted
SELECT name, con_id, open_mode FROM v$pdbs; -- check again
ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK; -- unlock user
-- CONNECT hr/hr@//iis0.dev.shahed.biz:1521/xepdb1
CONNECT hr/hr@XEPDB1
SHOW USER
Good To Know
docker logs oracle21c docker stop oracle21c docker start oracle21c docker restart oracle21c docker exec -it oracle21c /bin/bash docker exec -it --user=oracle oracle21c bash
docker network ls docker network create oracle_network
docker-machine create --driver virtualbox default docker-machine start default docker-machine stop default docker-machine ip default docker-machine ls
docker run --detach \ --name oracle11g \ --publish 1521:1521 \ --publish 8090:8080 \ --env ORACLE_ENABLE_XDB=true \ --env ORACLE_ALLOW_REMOTE=true \ wnameless/oracle-xe-11g-r2:latest
docker run --detach \ --name oracle18c \ --publish 1521:1521 \ --publish 5500:5500 \ --env ORACLE_PWD=oracle \ --env ORACLE_CHARACTERSET=AL32UTF8 \ --volume ${ACADEMIA_HOME}/var/oracle18c/oradata:/opt/oracle/oradata \ container-registry.oracle.com/database/express:18.4.0-xe
References
- Oracle Database XE Release 21c Docker Image
- Install Oracle DB 18c XE on Windows 10 Home
- Docker Build and Run Oracle Database 18c XE
- ORA-65096: invalid common user or role name
- Installation of APEX 19.2 on Oracle 18c XE
- Start and Stop Oracle Database 18c XE
- Docker Run Oracle DB 18c XE
- Docker Images from Oracle