tnsping cannot identify the line feed inside tnsnames.ora - oracle

I installed oracle client WINDOWS.X64_193000_client_home in my computer. And I set up my tnsnames.ora file. When using tnsping command to test the connection, I find it is OK when I put all the value in just one line, no line feed.
Name1 =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = xxx)(SERVER = DEDICATED)))
But if I put the value in several lines with line feed, it throws out error.
Name1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = x.x.x.x)
(SERVER = DEDICATED)
)
)
Error as below
PS C:\Oracle\WINDOWS.X64_193000_client_home\network\admin> tnsping sap
TNS Ping Utility for 64-bit Windows: Version 19.0.0.0.0 - Production
on 03-MAY-2022 16:33:13
Copyright (c) 1997, 2019, Oracle. All rights reserved.
Used parameter files:
C:\Oracle\WINDOWS.X64_193000_client_home\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias Attempting to contact
(DESCRIPTION = TNS-12533: TNS:illegal ADDRESS parameters
How can make it to recognise the line feed?
Edit: Some anwsers are about the incorrect content of tnsnames.ora file. Yes, after I change the tns with some indent, it is working.
But I also installed Oracle SQL Developer in my computer. It is working fine to use the tns and can be connected with oracle server successfully.

Try this:
Name1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = x.x.x.x)
(SERVER = DEDICATED)
)
)
I found this Syntax Rules for Configuration Files:
Oracle Corporation recommends that you set up the files so that indentation reflects what keyword is the "parent" or "owner" of other keyword-value pairs. This format is not required, but it does make the files much easier to read and understand. This is the format that Network Manager generates.
Even if you do not choose to indent your files in this way, you must indent a wrapped line by at least one space, or it will be misread as a new parameter. The following layout is acceptable:
(ADDRESS=(COMMUNITY=tcpcom.world)(PROTOCOL=tcp)
(HOST=max.world)(PORT=1521))
The following layout is not acceptable:
(ADDRESS=(COMMUNITY=tcpcom.world)(PROTOCOL=tcp)
(HOST=max.world)(PORT=1521))
Further Syntax Rules for TNS Configuration Files
The following rules apply to the syntax of configuration files:
Any keyword in a configuration file that should be recognized as beginning a parameter that includes one or more keyword-value pairs must be in the far left column of a line. If it is indented by one or more spaces, it is interpreted as a continuation of the previous line.

Related

Can't connect to oracle database with Oracle SQL Developer

When I try to connect I get error:
I disabled firewall, started the OracleServiceXE, but still get error.
When I use command lsnrctl status, I get:
lsnrctl start:
My tnsnames.ora file looks like that:
# tnsnames.ora Network Configuration File: C:\app\Coi\product\18.0.0\dbhomeXE\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.8)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)

oracle second listener not work

I created two databases one called test and one that is called archivio. The SID is equals to name. I also created a listener for SID test that responds on port 1521 and one for the SID archivio that should answer on port 1522.
I have verified that the services are active
the first listener works properly. The second, reported to the archivio database, does not work. I perform the test using net manager. The error message is:
the listener is not currently aware of the service requested in connect descriptor
with oracle sql developer i can connect to db archivio if i use local instead of base type connection
Other info:
windows 7 ultimate oracle 12c
LISTNER.ORA
# listener.ora Network Configuration File: C:\Program Files (x86)\Common Files\Quest Shared\instantclient-basic-windows.x64-11.2.0.4.0\listener.ora
# Generated by Oracle configuration tools.
LISTENER1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = webgate1-PC)(PORT = 1522))
)
ADR_BASE_LISTENER1 = C:\app\cirom
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = webgate1-PC)(PORT = 1521))
)
ADR_BASE_LISTENER = C:\app\cirom
ADR_BASE_LISTENER1 = C:\app\cirom
TNSNAMES.ORA
# tnsnames.ora Network Configuration File: C:\Program Files (x86)\Common Files\Quest Shared\instantclient-basic-windows.x64-11.2.0.4.0\tnsnames.ora
# Generated by Oracle configuration tools.
ARCHIVIO =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = webgate1-pc)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = archivio)
)
)
LISTENER_TEST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LISTENER_ARCHIVIO =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = webgate1-pc)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)
In order to get an Oracle instance registered on a listener running on not default port (not TCP 1521) you have to configure the LOCAL_LISTENER parameter, for example:
(ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1522))
The command is:
alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1522))' scope=both;
Change hostname with you hostname.
Then restart you database or issue the command:
alter system register;
Giovanni

Two oracle databases on one IP

What I have:
1) Oracle 11R1 services on Local system
2) Oracle 12c services on other account
TNS listener run from oracle 11R1 (but also I've create one for 12c)
As a first solution I try
A12c =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1531))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = A12c.1.1.1)
)
)
B11R1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = B11R1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1531))
)
)
With this configuration I could connect to 11r1 (also on 1531 port !) but nt to 12c. When I setup two listener situation was same. When I run with 12c listener I could not connect to any databases.
Will be grateful for any suggestions.
Thank you

How can I write TNS strings in tnsnames.ora file when I have 2 Unix machines set up with the same DB instance name?

I have 2 servers X and Y. both the servers are set up with the Oracle DB instances with the name Z.
I need to have these inforamtions in the same tnsnames.ora file. How can I do this?
Something like this:
<DB_X> =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = <hostnameX>)(Port = <port>))
)
(CONNECT_DATA =
(SERVICE_NAME = <Z>)
)
)
<DB_Y> =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = <hostnameY>)(Port = <port>))
)
(CONNECT_DATA =
(SERVICE_NAME = <Z>)
)
)

Need to Add Oracle Listener for Second NIC

I am currently running Oracle 11g on a Windows 2012 Environment.
I recently added another NIC to allow for failover, however I am not sure as to what to do with my listener.ora file and my tnsnames.ora file. Could someone offer guidance? For reference, the current IP I am using is 192.168.0.52 and the IP of the second NIC that I would like to add has the IP of 192.168.0.53.
Below is my listener.ora file:
# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))
)
)
ADR_BASE_LISTENER = D:\app\Administrator
Below is my tnsnames.ora file:
# tnsnames.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(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 = 192.168.0.52)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Thanks for all your help!
Well, you can specify multiple ADDRESS entries in the listener.ora:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.53)(PORT = 1521))
)
)
And in tnsnames.ora:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.52)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.53)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
When I specify multiple addresses for listener, it listens on all interfaces listed. And when at least one address in tnsnames can be connected to -- it connects. I have 11g available for testing both on the client-side and on the server-side. I checked the documentation (Multiple Address Lists in tnsnames.ora) and it states that parameter (FAILOVER=on) can be specified in tnsnames.ora explicitly.

Resources