Deploy an Oracle database
Oracle Database is a powerful and highly reliable relational database management system (RDBMS) that manages and processes enterprise data. This topic shows you how to deploy an Oracle database on an ECS instance.
Deploy an Oracle database with Docker
Before you deploy an Oracle database by using Docker, your ECS instance must meet the following requirements:
-
A public IP address is automatically assigned to the ECS instance. Alternatively, an elastic IP address (EIP) is associated with the ECS instance. For instructions on how to enable public bandwidth, see Enable public bandwidth.
-
In the security group of the ECS instance, a security group rule must be in place to allow inbound traffic on port 22.
-
At least 9 GB of disk space is available.
Run the following commands as the root user.
-
Pull the Oracle image.
docker pull container-registry.oracle.com/database/free:latest -
Start the Oracle container and configure it to restart automatically.
docker run -d --name oracle --restart always \ -p 1521:1521 \ container-registry.oracle.com/database/free:latestParameters:
-
-d: Runs the container in the background.
-
--name: Specifies a name for the container.
-
--restart always: Configures the container to restart automatically.
-
-p: Maps a container port to a host port. The default database port for Oracle is 1521.
-
container-registry.oracle.com/database/free:latest: Specifies the image and its tag.
-
-
Check the container status.
docker psIf the container is running as expected, the output is similar to the following:
[root@iZxxx ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 20dcxxx container-registry.oracle.com/database/free:latest "/bin/bash -c $ORACL…" 2 hours ago Up 2 hours (healthy) 0.0.0.0:1521->1521/tcp, :::1521->1521/tcp oracle -
Set the password.
Replace
<YOUR_PASSWORD>with the password that you want to set.docker exec -it oracle ./setPassword.sh <YOUR_PASSWORD> -
Use SQL*Plus to connect to the database.
docker exec -it oracle sqlplus sys@localhost:1521/FREE as sysdbaIf output similar to the following appears, the connection is successful.
[root@ixxxgZ ~]# docker exec -it oracle sqlplus sys@localhost:1521/FREE as sysdba SQL*Plus: Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems on Fri Dec 20 05:30:20 2024 Version 23.5.0.24.07 Copyright (c) 1982, 2024, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.5.0.24.07 SQL>
Remote connection
In the instance's security group, add an inbound rule to allow traffic on port 1521. For more information, see Add a security group rule.
-
Go to the Oracle SQL Developer page, download the required version, and install it.
-
After the installation is complete, connect to the Oracle database using the following settings.
Open Oracle SQL Developer and create a database connection. In the Name field, enter a name for the connection, such as
oracle-auto. For Username, entersys. From the Role drop-down list, select SYSDBA, and then enter your password. For Connection Type, select Basic. In the Hostname field, enter the public IP address of your instance. For Port, enter1521. Select SID and enterFREE.
References
-
For a managed database service that offers high availability, reliability, security, and scalability, consider Alibaba Cloud ApsaraDB RDS. This stable, reliable, and elastic relational database service supports MySQL, SQL Server, PostgreSQL, and MariaDB engines and provides features for disaster recovery, backup, restoration, and migration.
-
You can use Data Transmission Service (DTS) to seamlessly migrate a self-managed database to Alibaba Cloud. For detailed instructions, see Database Migration Solutions and Migrate from a self-managed Oracle database to an ApsaraDB RDS for MySQL instance.