banner
keney

keney

remain optimistic
twitter

Installing Oracle Container with Docker

Manually install various containers (services) using Docker

Image search method: https://hub.docker.com/

Install Oracle#

Reference 1: https://blog.csdn.net/javaboyweng/article/details/125486242

Reference 2: Docker-14: Docker Installation of Oracle 11g (Like)

Reference 3: [docker installation of Oracle database - Tencent Cloud Developer Community - Tencent Cloud (tencent.com)] (Like)

Image: https://hub.docker.com/r/akaiot/oracle_11g

Installation video tutorial: Reference

Here, we use a cloud server to install the Oracle container via Docker.

The server uses 2 cores and 4GB of RAM.

Operations#

Prior knowledge of common Docker commands is required.

Pull the image

docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

Start the container:

docker run -d -it -p 1521:1521 \
--name oracle \
--restart=always \
--mount source=oracle_vol,target=/home/oracle/app/oracle/oradata registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

--mount source=oracle_vol,

target=/home/oracle/app/oracle/oradata, the local directory on the server, can be customized, for example: /root/docker-data/oracle/oracledata

registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

Modify the file, first enter the container and execute the following operations:

docker exec -it oracle /bin/bash 
# Switch to root user 
su root

Then enter the password

# Password:
helowin 

Modify the /etc/profile file, configure ORACLE_HOME and ORACLE_SID in it, and then make it effective.
Enter:

vi /etc/profile
# Configuration content
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2 
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH

--restart means the container will automatically restart when Docker restarts.

--mount means to mount the path on the Host to the container.

export ORACLE_SID=helowin, ORACLE_SID is a custom SID, which will be used later during connection.

Then make the configuration file effective:

# Make the configuration file effective
source /etc/profile

Create a soft link

ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

Log in to sqlplus

# Switch back to oracle user
su oracle
# Start a client process
sqlplus /nolog
# Connection identity
connect / as sysdba
# Change the password for the system account
alter user system identified by password;
# Change the password for the sys account
alter user sys identified by password;
# Set the password to never expire:
alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;

Create a user (customize as needed)

# Create user
create user jiefei identified by username;
# Grant permissions to the user
grant connect,resource,dba to username;

Also modify the connection limit:

alter system set processes=1000 scope=spfile;

One more step, after modifying the above information, the database needs to be restarted;

conn /as sysdba

Shut down the database service:

shutdown immediate;

Start the database service:

startup open;

Exit the soft link:

exit

Tool Connection#

Using Navicat Premium 16 tool to connect to the Oracle database for testing.

Tool download: Reference here

Possible Issues#

When executing the password change, the error "database not open" may occur.

Solution:

Enter:

alter database mount;

Enter:

alter database open;

Then you can execute the command to change the database password.

After changing, enter:

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

Refresh the table

exit means to exit sql, soft link i

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.