Able to access Oracle database by localhost not by IP address - oracle

I have installed Oracle 11g and for test purpose I have connected to the database using an editor( called DBeaver).
When host name is provided a localhost ,it connects .But when host name is provided as the IP of the system ,the editor fails to connect and displays following message.
IO Error: The Network Adapter could not establish the connection
The Network Adapter could not establish the connection
java.net.ConnectException: Connection refused: connect
I have tried changing the listener.ora from
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
to
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.0.3)(PORT = 1521))
)
)
Here I have replaced localhost with IP i.e. 10.140.0.3.
But so far unable to connect it .
Can anybody share some experience on this ?

Your listener.ora entry is incorrect .It should be like the following.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.0.3)(PORT = 1521))
)
)
To avoid mistakes related to manual edit, use Net manager and add the address from there .
Check the following screenshots to make the listener.ora file related changes .
Open Oracle Net Manager
Add IP address to the Listener
Once the changes are done, do not forget to save it from Oracle Net Manager !

you can install Oracle Database on a computer that has a IP addresses.
IP address is associated with a host name; you can set up aliases for the host name.
By default, Oracle Universal Installer uses the ORACLE_HOSTNAME environment variable setting to find the host name.
To set the ORACLE_HOSTNAME environment variable:
Display System in the Windows Control Panel.
In the System Properties dialog box, click Advanced.
In the Advanced tab, click Environment Variables.
In the Environment Variables dialog box, under System Variables, click New.
In the New System Variable dialog box, enter the following information:
Variable name: ORACLE_HOSTNAME
Variable value: The host name of the computer to use.
Click OK, then in the Environment Variables dialog box, click OK.
Click OK in the Environment Variables dialog box, then in the System Properties dialog box, click OK.
Ref: https://docs.oracle.com/cd/E11882_01/install.112/e47798/reqs.htm#NTDBI2710

Related

Access an Oracle instance on AWS EC2 remotely

I have a AWS EC2 instance on which I installed an Oracle DB: 11g.
All works fine if I access the DB from within the instance
sqlplus user/pwd#localhost/SERVICE
On the other hand if I change the "localhost" with the machine IP it does not allow access, even from within the machine.
The error is:
ERROR:
ORA-12170: TNS:Connect timeout occurred
I have already:
Allowed access to port 1521 on the machine's firewall
Added a rule for port 1521 from any IP on the AWS security group
By the way on the machine there is also a Tomcat server on a different port and by doing these two steps I can access that one fine from a browser on my laptop. So I believe that the networing is fine and it is the Oracle instance that is blocking the access. Any clues how to fix it?
You need to modify your listener.ora file that in my system is under:
app/{User}/product/{dbversion}/dbhome_{someid}/network/admin.
I added the line (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))).
After the modification my listener.ora looks like this. The other lines were there before and I left them there.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)
After the modificaiton you have to restart the service
lsnrctl stop
lsnrctl start

Unable to connect user from SQL Developer to AWS RDS

I tried to connect to an AWS RDS that I created. I used SQL Developer to add the connection. I used the default SYSTEM user of Oracle. I have configured my tnsnames and listener files by adding the following entries.
LISTENER
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
)
TNSNAMES
FINAL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 'final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com')(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = final)
)
)
LISTENER_FINAL =
(ADDRESS = (PROTOCOL = TCP)(HOST = final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com)(PORT = 1521))
As you can see from this screenshot
AWS RDS Description Screenshot
the hostname is 'final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com', and the port number is 1521. Also, the SID here is 'final'. These have been added correctly by my above TNSNAMES and LISTENER entries.
However when I attempt to connect, I get the following
Error on SQL Developer
Status Failure -Test failed: IO Error: The Network Adapter could not establish the connection.
What could be the source of the error?
Make sure that your SID in SQL Developer is your database name on AWS and that you are using the correct username. In your screenshot, you have it as SYSTEM but the default username on AWS is admin. Go to the Configuration page in AWS and verify the highlighted portions in the screenshot below:
Assuming your DB Name in your Configuration page above is indeed "final", you should be selecting the SID option instead of Service name in SQL Developer, and inputting "final" as demonstrated in the snippet below.

SQLPLUS / AS SYSDBA failed to login ORA-12560

I am getting
ERROR:
ORA-12560: TNS:protocol adapter error
adapter error when attempt to login as SYSDBA. I did some research and find that firstly in Windows services there weren't any of the OracleJobSchedulerdb12gr1; OracleServicedb12gr1 .. e.t.c.
So I did add them and start:
C:\Windows\system32>oradim -new -sid db12gr1
So I start a listener as well:
C:\Windows\system32>lsnrctl start
And after that when I check the status I get:
C:\Windows\system32>lsnrctl status
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "XE" has 1 instance(s).
Instance "XE", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
Not sure if the UNKNOWN is the problem I dropped every other SID_LIST_LISTENER from listener.ora and the LISTENER looks like this (in listener.ora) :
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
Also I have set my ORACLE_HOME to env vars correctly and added to Path the bin folder so I can access sqlplus. Defining ORACLE_SID (set ORACLE_SID=localhost) does not made any difference before I try to log as sysdba. Also I was able to start the services and start listener only from command prompt opened as administrator of course where still I can't sqlplus / as sysdba.
tnsnames.ora:
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
I am really out of ideas. Anyone aware what might cost this ?
PS: OS: Windows 10 ; Oracle : 12c
You have to set your ORACLE_SID environement variable to the right value:
set ORACLE_SID=db12gr1
and make sure your instance service is correctly started.
lets do this:
1. Open Oracle Net Configuration Assistant
2. Select radio button option at Local Net Service Name Configuration, then click Next
3. Select radio button option at Reconfigure, then click next
4. Select net service name you want to reconfigure, either ORACLR_CONNECTION_DATA or ORCL, then click Next
5. input your Service Name, if your service name of installed oracle as ORCL, then write ORCL to the field, then click Next
6. select the protocol you want to use, for example, select TCP, then click Next
7. input hostname where your oracle database engine (service) installed, for example, installed on your desktop or notebook,
then fill as localhost, and fill your port number (select option Use the Standar port number of 1521) or if use other port, fill the port number
Then click next.
8. select Yes perform test,
if necessary, change user logon
then click next
9. if no configure another net service name, select No and then click next
10. Click Finish
you should download, extract and install the ODTwithODAC183.zip and BuildTools_Full.exe if you want use to connect on .net framework from MS Visual Studio

Connecting to Oracle database installed on one pc to the java application from another machine

I've installed Oracle 12c (desktop class) on my machine, and I can use it via sql developer on the same machine. Now how can I use the same database from another machine (for java application) in the LAN? I tried using the jdbc thin driver as follows: jdbc:oracle:thin:#10.0.11.69:1521:orcl where 10.0.11.69 is my ip address where Oracle is installed. Do i need to install any server where oracle is installed(10.0.11.69) to connect to my db from another machine?
I'm trying this from past 3 days and referred to many questions of the same model but none solved my issue.
My tnsnames.ora description is as follows:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Thanks in advance.
You need to connect to PDB if it is a Oracle 12c installation. You can add the following entry in tnsnames.ora:
pdborcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
After setting this, the listener needs to be restarted.
lsnrctl stop
lsnrctl start
Then the connect string will be something like this:
jdbc:oracle:thin:#//10.0.11.69:1521/pdborcl
Note the connect string above uses service name instead of SID, because in 12C we need to use service name instead of SID to connect to PDB. Check this post for more details.
Java application will not use tnsnames.ora by it's own. You have to call:
System.setProperty("oracle.net.tns_admin", "..path to tnsnames.ora");
To tell the driver where to search for it.
Also note, that some tnsnames.ora constructs are not supported by thin driver. For examples the "include" directive.
Thanks for the following link, Configuring the connection between client and server Oracle 10g
after researching for a long time I found that I need to add my LAN address(10.0.11.69) in the listener.ora file which solves my problem.
so my listener.ora will looks like this now:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.11.69)(PORT = 1521))
)
)
)

ODBC connection to oracle time-out

I'm new here so I introduce myself, my name is Ettore Giallaurito and my job is in the IT services in Italy.
My question:
I'm trying to connect to an Oracle DB instance through an odbc (System DNS) connections under XP but I get an error ORA1254 TNS:could not resolvethe connect identifier specified.
I'm using oracle instant client 11.2 and I've my tnsnames properly configured, since I can get connected with DBVisualizer using the TNS method.
To be honest I do get connected in this case, but I need to insert the full connect string:
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = repsit01.sit.sor)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = REPSIT01))
)
since it doesn't get me in if I use just the SID, in my case REPSIT01 as showed below.
My tns entry is as follow:
REPSIT01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = REPSIT01))
)
Any help would be much apprecciated.
Thanks in advance Ettore.
Try setting the environment variable TNS_ADMIN to the directory where your tnsnames.ora file resides.

Resources