Installing Oracle DB 12c on a virtual machine for testing and developing purposes has it advantages. The installation is quite invasive and when it’s done in a virtualbox, it does no harm to your host system at work, which is btw. Windows and a total mess itself. If you follow the installation instructions and restarted the virtual machine I notice few things that didn’t work by trying to access the database from a SQL client.
First of all, the Oracle DB instance is not automatically started. IMHO it is good, since I don’t frequently use Oracle DB. If used, it allocates a lot of resources of my notebook.
The Oracle user needs some environment variables set, to work properly. I named the file
TMPDIR=$TMP; export TMPDIR ORACLE_BASE=/var/opt/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1; export ORACLE_HOME ORACLE_SID=saa; export ORACLE_SID PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
You can source this file for instance within your
[vinh@localhost ~]$ cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs source ~/oracle_schrott PATH=$PATH:$HOME/.local/bin:$HOME/bin export PATH
If you have the proper settings you have the command
dbstart available. The proper call is however this:
vinh@localhost ~]$ dbstart $ORACLE_HOME
Now you can connect to the Oracle DB system
[vinh@localhost ~]$ sqlplus / as sysdba SQL*Plus: Release 184.108.40.206.0 Production on Thu Dec 29 17:46:26 2016 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to an idle instance.
Idle instance. Yes you need to startup.
SQL> startup ORACLE instance started. Total System Global Area 2432696320 bytes Fixed Size 2927288 bytes Variable Size 654312776 bytes Database Buffers 1761607680 bytes Redo Buffers 13848576 bytes Database mounted. Database opened. SQL> select current_date from dual; CURRENT_D --------- 29-DEC-16
If you can startup, you can also shutdown.
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
If you add the natting rule to virtualbox for the db port 1521, you will notice a connection problem. CentOS needs to be configured for that. First, check!
[root@localhost ~]# firewall-cmd --get-active-zones public interfaces: enp0s3
Add Oracle ports
[root@localhost ~]# firewall-cmd --zone=public --add-port=1521/tcp --add-port=5500/tcp --add-port=5520/tcp --add-port=3938/tcp --permanent success [root@localhost ~]# firewall-cmd --reload success [root@localhost ~]# firewall-cmd --list-ports 1521/tcp 5520/tcp 3938/tcp 5500/tcp
After that you can use the DB from the Windows host.