I research a little bit more taking into account your answer and this is what we should consider:
1. Configure Windows Server Firewall:
Go to Control Panel
-> System and Security
-> Windows Firewall
-> Advanced settings
. Then create a new inbound rule with the follow features:
Rule type: Port
Protocol: TCP
Port number: 1521
(unless you have specified a different one at your Oracle database)
Action: Allow the connection
Profile: Domain + Private + Public
(or the one that applies to your case)
Name: Oracle DB
(or any name you want)
Once you have finished, create an outbound rule with the same features specified for the inbound rule.
2. Configure Google Compute Engine Network Firewall: At Google Compute Engine (GCE) console go to Networking
-> Firewall rules
. Then click on New firewall rule
, and configure it:
Name: oracle-db
(or any name you want)
Network: default
(or the one where you have deployed your virtual machine. Verify it form VM instances dashboard)
Source filter: Allow from any source (0.0.0.0/0)
(WARN: you should select IP ranges if you just want to enable a host or a set of hosts. Then specify your domain or IP address)
Allowed protocols and ports: tcp:1521
(or the one that applies to your case - the same that you have defined for your Windows Firewall rules)
Finally, click on Create.
3. Configure Oracle Net Listener: By default Oracle database does not accept remote connections. It just accepts localhost requests. Therefore, at your Oracle database server open a CMD as administrator. We will stop the database net listener while executing:
lsnrctl STOP
Now, go to the Oracle installation path ORACLE_PATH (usually: ORACLE_PATH
= C:\app\<user_name>
). Then navigate to: ORACLE_PATH\product\11.2.0\dbhome_1\NETWORK\ADMIN
. There you will find two important files: listener.ora
and tnsnames.ora
. Open listener.ora
and change all LOCALHOST ocurrences by your server hostname (WARN: no the IP address, instead the server HOSTNAME).
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = <server_hostname>)(PORT = 1521))
)
)
Save your changes. Then, open the tnsnames.ora
file. And do the same for your services:
YOUR_SERVICE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <server_hostname>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = your_service_name)
)
)
LISTENER_YOUR_SERVICE =
(ADDRESS = (PROTOCOL = TCP)(HOST = <server_hostname>)(PORT = 1521))
Save your changes. Finally, we should restart the net listener. So go to the CMD as an administrator and execute the following command:
lsnrctl START
Open your browser and type: http://localhost:1158/em. Your database and listener should be running. Now you can connect from remote hosts.
For more information, please refer to: http://docs.oracle.com/cd/B28359_01/network.111/b28316/listenercfg.htm