Este post também está disponível em:
English

O Vagrant é uma excelente ferramenta para provisionar ambientes para rápidos testes. Com apenas alguns comandos você consegue colocar uma máquina virtual e um banco de dados Oracle.
As versões que possuem boxes oficial são:
11.2.0.2
12.1.0.2
12.2.0.1
18.3.0
18.4.0-XE
19.3.0
21.3.0-XE
21.3.0
23.3.0-Free
23.7.0-Free
PlaintextO teste que farei é com a versão 12.2.0.1, por isso vou acessar o diretório dessa versão:
$ cd /vms/Vagrant/vagrant-boxes/OracleDatabase/12.2.0.1
BashE copiar os binários do banco de dados 12.2.0.1 para dentro desse diretório.
$ cp /vms/OneDrive/BINARIOS/ORACLE/Oracle_12c_122/linuxx64_12201_database.zip .
BashFeito isso, só executar o comando abaixo, para iniciar uma máquina virtual com o Oracle Database 12.2.0.1 iniciado e pronto para uso.
$ vagrant up
BashPara acessar a máquina virtual.
vagrant ssh
BashA senha do usuário SYS , SYSTEM e PDBADMIN é informado pouco antes da conclusão do comando “vagrant up”
oracle-12201-vagrant: ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: aQMhKivSfVU=1
BashPara terminar todo o processo, precisa ter um pouquinho de paciência, que é demorado.
Após terminar alguns comandos:
henrique@laboratorio:/vms/Vagrant/vagrant-boxes/OracleDatabase/12.2.0.1$ vagrant ssh
Last login: Tue Mar 23 20:54:09 2021 from 10.0.2.2
Welcome to Oracle Linux Server release 7.9 (GNU/Linux 5.4.17-2036.102.0.2.el7uek.x86_64)
The Oracle Linux End-User License Agreement can be viewed here:
* /usr/share/eula/eula.en_US
For additional packages, updates, documentation and community help, see:
* https://yum.oracle.com/
[vagrant@oracle-12201-vagrant ~]$ sudo su -
Last login: Tue Mar 23 20:55:19 -03 2021 on pts/0
[root@oracle-12201-vagrant ~]# ps -ef |grep pmon
oracle 5968 1 0 20:30 ? 00:00:00 ora_pmon_ORCLCDB
root 8053 8032 0 20:55 pts/0 00:00:00 grep --color=auto pmon
[root@oracle-12201-vagrant ~]# su - oracle
Last login: Tue Mar 23 20:30:31 -03 2021
Last failed login: Tue Mar 23 20:55:12 -03 2021 on pts/0
There was 1 failed login attempt since the last successful login.
[oracle@oracle-12201-vagrant ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Mar 23 20:55:43 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
E para desligar a box.
$ vagrant halt
==> oracle-12201-vagrant: Attempting graceful shutdown of VM...
Todos os comandos disponíveis do Vagrant, vou destacar os mais usados.
henrique@laboratorio:~$ vagrant
Usage: vagrant [options] <command> [<args>]
-h, --help Print this help.
Common commands:
autocomplete manages autocomplete installation on host
box manages boxes: installation, removal, etc.
cloud manages everything related to Vagrant Cloud
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrantfile
login
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
port displays information about guest port mappings
powershell connects to machine via powershell remoting
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
snapshot manages snapshots: saving, restoring, etc.
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
upload upload to machine via communicator
validate validates the Vagrantfile
version prints current and latest Vagrant version
winrm executes commands on a machine via WinRM
winrm-config outputs WinRM configuration to connect to the machine
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
--[no-]color Enable or disable color output
--machine-readable Enable machine readable output
-v, --version Display Vagrant version
--debug Enable debug output
--timestamp Enable timestamps on log output
--debug-timestamp Enable debug output with timestamps
--no-tty Enable non-interactive output
Plaintext