r/SQL • u/Last-Bonus6548 • 19d ago
Oracle How to connect Oracle Database 19c from host machine to VirtualBox guest machine ?
Hi everyone, i want to access the oracle database on my guest machine (on VirtualBox) using my host machine (both machines are on windows 11) , i have already set up oracle client on my host machine but i couldn’t figure out how to connect it to the database on my guest machine , i also wasn’t able to find any YouTube tutorials explaining it , i would appreciate it if someone could redirect me to sources about this topic or explain to me how it’s done , thank you!
(I have to do this for school)
5
Upvotes
1
u/TheMagarity 19d ago
This is a question for r/virtualbox
2
u/BinaryRockStar 19d ago edited 19d ago
VM software has network settings that generally allow you to assign a VM to
You probably want the last one. If Oracle is anything like SQL Server then there will be an extra configuration step after installing the DB where you need to enable network access to it. This is for security reasons, the DB should become accessible precisely when the admin deems it's ready, not the instant you install it.
These days VMs are a bit out of fashion. If the DB has a docker image use that instead. It's like a VM (on Windows and Mac it really is a VM, invisible though) but without the extra resources of running a whole other operating system.
2
u/FallElectronic3774 18d ago
Set the VM adapter to Bridged (or keep NAT and add a 1521 port-forward). In the guest,
ipconfiggives the IPv4; confirm the listener is up withlsnrctl statusand that Windows Firewall allows TCP 1521. From the host:Test-NetConnection <guest-ip> -Port 1521, thensqlplus user/pass@//<guest-ip>:1521/<service>— use the service name shown bylsnrctl status(often ORCLPDB1 or XEPDB1). If the listener is only bound to 127.0.0.1, set its HOST to the guest IP or 0.0.0.0 in listener.ora and restart it; with NAT port-forward, connect to 127.0.0.1:1521 instead.1
u/Plus_Dragonfruit_204 17d ago
These, are my notes from doing it. Haven't set one up in a while, but these still seem to be valid.
In the VM, in the network settings, set
Attached totoBridged AdapterPromiscuous ModetoAllow AllRestart the VM, the IP address will change.
Assuming that you had your listener set up correctly, you should only need to go into the listener.ora file and change the IP address that it is listening on and restart the listener.