Para verificar os diversos comandos em docker CLICK AQUI
O Oracle Database Server 12c R2 é um servidor de banco de dados relacional líder do setor. A Imagem do Docker do Banco de Dados Oracle contém o Oracle Database Server 12.2.0.1 Enterprise Edition em execução no Oracle Linux 7. Essa imagem contém um banco de dados padrão em uma configuração de vários locatários com um pdb.
Usando esta imagem
Aceitando os termos de serviço
No site store.docker.com, aceite os Termos de Serviço do Oracle Database Enterprise Edition.
Faça o login na Docker Store
Faça o login na Docker Store com suas credenciais
$ docker login
Starting an Oracle Database Server instance
Iniciar uma instância do servidor de banco de dados Oracle é tão simples quanto executar
$ docker run -d -it --name <oracle-db> store/oracle/database-enterprise:12.2.0.1
onde <oracle-db> é o nome do contêiner e 12.2.0.1 é a tag de imagem do Docker. O servidor de banco de dados está pronto para uso quando o campo STATUS mostra (saudável) na saída do docker ps.
Connecting to the Database Server Container
A senha padrão para se conectar ao banco de dados com sys
user is Oradoc_db1
.
Connecting from within the container
o servidor de banco de dados pode ser conectado executando SQL*Plus,
$ docker exec -it <oracle-db> bash -c "source /home/oracle/.bashrc; sqlplus /nolog"
Connecting from outside the container
The database server exposes port 1521 for Oracle client connections over SQLNet protocol and port 5500 for Oracle XML DB. SQLPlus or any JDBC client can be used to connect to the database server from outside the container.
To connect from outside the container start the container with -P
or -p
option as,
$ docker run -d -it --name <oracle-db> -P store/oracle/database-enterprise:12.2.0.1
option -P
indicates the ports are allocated by Docker. The mapped port can be discovered by executing
$ docker port <oracle-db>
1521/tcp -> 0.0.0.0:<mapped>
Using this <mapped>
and <ip-address>
create tnsnames.ora
in the directory pointed to by environment variable TNS_ADMIN
.
ORCLCDB=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<ip-address>)(PORT=<mapped>))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCLCDB.localdomain)))
ORCLPDB1=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<ip-address> of host)(PORT=<mapped>))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCLPDB1.localdomain)))
To connect from outside the container using SQL*Plus,
$ sqlplus sys/Oradoc_db1@ORCLCDB as sysdba
Custom Configurations
The Oracle database server container also provides custom configuration parameters for starting up the container. All the custom configuration parameters are optional. The following list of custom configuration parameters can be provided in the ENV file (ora.conf
).
DB_SID
This parameter changes the ORACLE_SID
of the database. The default value is set to ORCLCDB
.
DB_PDB
This parameter modifies the name of the PDB. The default value is set to ORCLPDB1
.
DB_MEMORY
This parameter sets the memory requirement for the Oracle server. This value determines the amount of memory to be allocated for SGA and PGA. The default value is set to 2GB.
DB_DOMAIN
This parameter sets the domain to be used for database server. The default value is localdomain
.
To start an Oracle database server with custom configuration parameters
$ docker run -d -it --name <oracle-db> -P --env-file ora.conf store/oracle/database-enterprise:12.2.0.1
Ensure custom values for DB_SID
, DB_PDB
and DB_DOMAIN
are updated in the tnsnames.ora.
Caveats
This Docker image has the following restrictions.
- Supports a single instance database.
- Dataguard is not supported.
- Database options and patching are not supported.
Changing default password for SYS user
The Oracle database server is started with a default password Oradoc_db1
. The password used during the container creation is not secure and should be changed. To change the password connect to the database with SQL*Plus and execute
alter user sys identified by <new-password>;
Resource Requirements
The minimum requirements for the container is 8GB of disk space and 2GB of memory.
Database Logs
The database alert log can be viewed with
$ docker logs <oracle-db>
where is the name of the container
Reusing existing database
This Oracle database server image uses Docker data volumes to store data files, redo logs, audit logs, alert logs and trace files. The data volume is mounted inside the container at /ORCL
. To start a database with a data volume using docker run
command,
$ docker run -d -it --name <oracle-db> -v OracleDBData:/ORCL store/oracle/database-enterprise:12.2.0.1
OracleDBData
is the data volume that is created by Docker and mounted inside the container at /ORCL
. The persisted data files can be reused with another container by reusing the OracleDBData
data volume.
Using host system directory for data volume
Para usar um diretório no sistema host para o volume de dados,
$ docker run -d -it --name <oracle-db> -v /data/OracleDBData:/ORCL store/oracle/database-enterprise:12.2.0.1
where /data/OracleDBData
is a directory in the host system.
Oracle Database Server 12.2.0.1 Enterprise Edition Slim Variant
The Slim Variant (12.2.0.1-slim
tag) of EE has reduced disk space (4GB) requirements and a quicker container startup. This image does not support the following features - Analytics, Oracle R, Oracle Label Security, Oracle Text, Oracle Application Express and Oracle DataVault. To use the slim variant
$ docker run -d -it --name <oracle-db> store/oracle/database-enterprise:12.2.0.1-slim
where <oracle-db>
is the name of the container and 12.2.0.1-slim
is the Docker image tag.
Social