In the previous post, we learned the installation of Vagrant and provisioning the Oracle 18c Database in Vagrant VM.
Now, in this post, we will show how to access Oracle 18c Database in Vagrant VM. First of all, we can check the status of VM.
D:\shared\vagrant-boxes-master\vagrant-boxes-master\OracleDatabase\18.3.0>vagrant global-status id name provider state directory ------------------------------------------------------------------------------------------------------------------------- c09dbcd oracle-18c-vagrant virtualbox running D:/shared/vagrant-boxes-master/vagrant-boxes-master/OracleDatabase/18.3.0
Next step uses vagrant ssh command to log in to VM and then sudo to oracle user.
D:\shared\vagrant-boxes-master\vagrant-boxes-master\OracleDatabase\18.3.0>vagrant ssh
Welcome to Oracle Linux Server release 7.5 (GNU/Linux 4.14.35-1818.0.9.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:
* http://yum.oracle.com/
[vagrant@oracle-18c-vagrant ~]$ sudo su - oracle
Last login: Fri Jul 27 14:51:44 UTC 2018
[oracle@oracle-18c-vagrant ~]$
Now check the pmon status and use sqlplus to connect to the Oracle Database.
[oracle@oracle-18c-vagrant ~]$ ps -ef|grep pmon
oracle 27894 1 0 15:52 ? 00:00:00 ora_pmon_ORCLCDB
oracle 28858 28813 0 16:02 pts/0 00:00:00 grep --color=auto pmon
[oracle@oracle-18c-vagrant ~]$ ps -ef|grep tns
root 21 2 0 15:24 ? 00:00:00 [netns]
oracle 24009 1 0 15:35 ? 00:00:00 /opt/oracle/product/18c/dbhome_1/bin/tnslsnr LISTENER -inherit
oracle 28862 28813 0 16:02 pts/0 00:00:00 grep --color=auto tns
[oracle@oracle-18c-vagrant ~]$ sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Fri Jul 27 16:02:09 2018 Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0
SQL> select name from v$database;
NAME
---------
ORCLCDB
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB1 READ WRITE NO
SQL>exit
Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0
[oracle@oracle-18c-vagrant ~]$
In this step, we can change the default passwords and connect via an EZConnect method.
[oracle@oracle-18c-vagrant ~]$ ls setPassword.sh [oracle@oracle-18c-vagrant ~]$ ./setPassword.sh oraclevagrant #New_Password The Oracle base remains unchanged with value /opt/oracle SQL*Plus: Release 18.0.0.0.0 - Production on Fri Jul 27 15:03:05 2018 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0 SQL> User altered. SQL> User altered. SQL> Session altered. SQL> User altered. SQL> Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0 [oracle@oracle-18c-vagrant ~]$ [oracle@oracle-18c-vagrant ~]$ sql system@//localhost:1521/ORCLCDB SQLcl: Release 17.3.0 Production on Fri Jul 27 15:02:11 2018 Copyright (c) 1982, 2018, Oracle. All rights reserved. Password? (**********?) ************* Last Successful login time: Fri Jul 27 2018 15:02:21 +00:00 Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0 SQL> exit Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0
After testing will be completed, now we will destroy Vagrant VM.
D:\shared\vagrant-boxes-master\vagrant-boxes-master\OracleDatabase\18.3.0>vagrant port
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.
22 (guest) => 2222 (host)
1521 (guest) => 1521 (host)
5500 (guest) => 5500 (host)
D:\shared\vagrant-boxes-master\vagrant-boxes-master\OracleDatabase\18.3.0>vagrant ssh-config
Host oracle-18c-vagrant
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile D:/shared/vagrant-boxes-master/vagrant-boxes-master/OracleDatabase/18.3.0/.vagrant/machines/oracle-18c-vagrant/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
D:\shared\vagrant-boxes-master\vagrant-boxes-master\OracleDatabase\18.3.0>vagrant halt
==> oracle-18c-vagrant: Attempting graceful shutdown of VM...
D:\shared\vagrant-boxes-master\vagrant-boxes-master\OracleDatabase\18.3.0>vagrant destroy
oracle-18c-vagrant: Are you sure you want to destroy the 'oracle-18c-vagrant' VM? [y/N] y
==> oracle-18c-vagrant: Destroying VM and associated drives...
D:\shared\vagrant-boxes-master\vagrant-boxes-master\OracleDatabase\18.3.0>
In the next Article, we will see how to install Vagrant VM on Linux
Stay tuned for More articles on Vagrant related to Oracle
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Telegram Channel: https://t.me/helporacle
Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/
Joel Perez’s LinkedIn: Joel Perez’s Profile
LinkedIn Group: Oracle Cloud DBAAS
Facebook Page: OracleHelp

interesting… but how connect outside?… example: sqldeveloper en OS host