Friday, October 6, 2023

Install Oracle 23c free using docker in Amazon Linux 2023

 

Install docker package and enable it

[ec2-user@ip-10-1-1-152 ~]$ cat /etc/amazon-linux-release
Amazon Linux release 2023 (Amazon Linux)
sudo yum install docker -y
sudo systemctl enable docker
sudo systemctl start docker

Pull Oracle 23c free version docker image

sudo docker pull container-registry.oracle.com/database/free:latest
[ec2-user@ip-10-1-1-152 ~]$ sudo docker pull container-registry.oracle.com/database/free:latest
latest: Pulling from database/free
089fdfcd47b7: Pull complete
43c899d88edc: Pull complete
47aa6f1886a1: Pull complete
f8d07bb55995: Pull complete
c31c8c658c1e: Pull complete
b7d28faa08b4: Pull complete
1d0d5c628f6f: Pull complete
db82a695dad3: Pull complete
25a185515793: Pull complete
Digest: sha256:5ac0efa9896962f6e0e91c54e23c03ae8f140cf6ed43ca09ef4354268a942882
Status: Downloaded newer image for container-registry.oracle.com/database/free:latest
container-registry.oracle.com/database/free:latest

Check the downloaded docker images

sudo docker images
[ec2-user@ip-10-1-1-152 ~]$ sudo docker images
REPOSITORY                                    TAG       IMAGE ID       CREATED       SIZE
container-registry.oracle.com/database/free   latest    39cabc8e6db0   4 weeks ago   9.16GB

Run the docker images

sudo docker run -d -it --name 23cfree -p 1521:1521 -p 5500:5500 -p 8080:8080 -p 8443:8443 -e ORACLE_PWD=Welcome123 container-registry.oracle.com/database/free:latest
[ec2-user@ip-10-1-1-152 ~]$ sudo docker run -d -it --name 23cfree -p 1521:1521 -p 5500:5500 -p 8080:8080 -p 8443:8443 -e ORACLE_PWD=Welcome123 container-registry.oracle.com/database/free:latest
ff618602d4402b6dbf92fd2c69612027c885937a176b9b160a8a9e93018bd519
[ec2-user@ip-10-1-1-152 ~]$ sudo docker logs 23cfree
Starting Oracle Net Listener.
Oracle Net Listener started.
Starting Oracle Database instance FREE.
Oracle Database instance FREE started.

The Oracle base remains unchanged with value /opt/oracle

SQL*Plus: Release 23.0.0.0.0 - Production on Fri Oct 6 12:31:14 2023
Version 23.3.0.23.09

Copyright (c) 1982, 2023, Oracle.  All rights reserved.


Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09

SQL>
User altered.

SQL>
User altered.

SQL>
Session altered.

SQL>
User altered.

SQL> Disconnected from Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09
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:
Dumping current patch information
===========================================================
No patches have been applied
===========================================================
2023-10-06T12:31:12.630086+00:00
FREEPDB1(3):Opening pdb with Resource Manager plan: DEFAULT_PLAN
Completed: Pluggable database FREEPDB1 opened read write
Completed: ALTER DATABASE OPEN
2023-10-06T12:31:15.404495+00:00
FREEPDB1(3):TABLE AUDSYS.AUD$UNIFIED: ADDED INTERVAL PARTITION SYS_P342 (3385) VALUES LESS THAN (TIMESTAMP' 2023-10-07 00:00:00')
[ec2-user@ip-10-1-1-152 ~]$

Login to running docker

sudo docker  exec -it 23cfree /bin/bash
[ec2-user@ip-10-1-1-152 ~]$ sudo docker  exec -it 23cfree /bin/bash
bash-4.4$ adrci

ADRCI: Release 23.0.0.0.0 - Production on Fri Oct 6 12:45:05 2023

Copyright (c) 1982, 2023, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/opt/oracle"
adrci> set home FREE
adrci> show alert -tail -f

Login to the database remotely

  • Password is the one specified during during "docker run" command.
  • Server name:
    • FREE: CDB Name (Container)
    • FREEPDB1: PDB Name
  • Users created:
    • sys (login as sysdba)
    • system
    • pdbadmin
sql system/Welcome123@3.216.132.117:1521/FREEPDB1
[oracle@ol ~]$ sql system/Welcome123@3.216.132.117:1521/FREEPDB1


SQLcl: Release 22.4 Production on Fri Oct 06 20:41:31 2023

Copyright (c) 1982, 2023, Oracle.  All rights reserved.


	New version: 23.2.0 available to download

Last Successful login time: Fri Oct 06 2023 20:43:09 +08:00

Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09


SQL> select host_name from v$instance;

HOST_NAME
_______________
ff618602d440

SQL> select banner from v$version;

BANNER
_________________________________________________________________________________
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Subsequent stop/start Docker

sudo docker stop 23cfree
sudo docker start 23cfree

Currently docker requires sudo to run it, to run as default ec2-user, you can add it to docker group.

sudo usermod -a -G docker ec2-user
ec2-user@ip-10-1-1-152 ~]$ sudo usermod -a -G docker ec2-user

[ec2-user@ip-10-1-1-152 ~]$ id -a ec2-user
uid=1000(ec2-user) gid=1000(ec2-user) groups=1000(ec2-user),4(adm),10(wheel),190(systemd-journal),992(docker)

[ec2-user@ip-10-1-1-152 ~]$ exit
logout

[root@ip-10-1-1-152 ~]# su - ec2-user
Last login: Fri Oct  6 12:24:26 UTC 2023 on pts/0

[ec2-user@ip-10-1-1-152 ~]$ docker ps
CONTAINER ID   IMAGE                                                COMMAND                  CREATED          STATUS                PORTS                                                                      NAMES
ff618602d440   container-registry.oracle.com/database/free:latest   "/bin/bash -c $ORACL…"   32 minutes ago   Up 2 minutes (healthy)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:5500->5500/tcp, :::5500->5500/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp   23cfree

No comments:

Post a Comment