I want to install Oracle Database 12c on my Windows 10 PC and use it with Linux commands on the provided bash. Can I do this? If so, then how?
2 Answers
I use Ubuntu on Windows 10 all the time for local Windows installations. Just set up environmental variables. Here is the example for my 11gR2 database environment file. (If it’s just one installation, you can add to .bash_profile
.)
#!/bin/bash
export ORACLE_SID=ora
export ORACLE_HOME=/mnt/c/ora/product/11.2.0/db_1
export PATH=$ORACLE_HOME/BIN:$PATH
alias sqlplus='rlwrap sqlplus.exe /nolog'
alias s='rlwrap sqlplus.exe / as sysdba'
alias lsnrctl='lsnrctl.exe'
alias oradim='oradim.exe'
alias rman='rman.exe'
alias adrci='adrci.exe'
I have successfully done this with WSL 2 and Oracle XE 11g.
In the Windows Firewall allow incoming requests through Oracle's default port 1521.
In Bash get the IP Address of the WSL network adapter:
grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'
- Test the communication with Oracle using
telnet
:
telnet ip.from.step.2 1521
Follow this tutorial to install Oracle Instant Client for Linux (same version as the Oracle DB)
Connect with the Oracle server using
sqlplus
:
sqlplus user/password@//ip.from.step.2:1521/db_name
Update: Instead of opening the port in the Firewall you can add a rule to allow connections to C:\oraclexe\app\oracle\product\11.2.0\server\BIN\tnslsnr.exe
.