I have implemented the datagaurd in Oracle database for high
availability with two servers and configured the jdbc settings to
connect Jboss application server to always connect primary database
instance.
If I use the following string:
<connection-url>
jdbc:oracle:thin:#(DESCRIPTION=(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=<ip1>)(PORT=<port>))(ADDRESS=(PROTOCOL=TCP)(HOST=<ip2>)(PORT=<port>)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME
= MYDB)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))</connection-url>
When i perform a switch-over/filover the ip1 is down and ip2 is up. If I specify ip2 first in my list then I get a connection (just like I'd expect if I just tried to connect to ip2). However when I put ip1 first I get the same error as if I tried to connect directly to
java.util.concurrent.ExecutionException: java.lang.RuntimeException:
java.sql.SQLException: ORA-01033: ORACLE initialization or shutdown
in progress
Recommended connection URL for a Data Guard with RAC is as shown below. Can you make sure that you are using the correct connection URL ?
jdbc:oracle:thin:#(DESCRIPTION = (FAILOVER=on)
(CONNECT_TIMEOUT= 15) (RETRY_COUNT=20) (RETRY_DELAY=3)
(ADDRESS_LIST =
(LOAD_BALANCE=on)
(ADDRESS = (PROTOCOL = TCP) (HOST=primary-scan) (PORT=1521)))
(ADDRESS_LIST =
(LOAD_BALANCE=on)
(ADDRESS = (PROTOCOL = TCP) (HOST=secondary-scan) (PORT=1521)))
(CONNECT_DATA= (SERVICE_NAME = gold-cloud-service-name)))
Related
Im gonna do a datasource Tomcat 9.0.63 to connect to my Oracle DB.
Actually we use dataguard (2 db, a main one and a backup one)
In the configuration of server.xml file , in order to set the connection, i wonder in the parameter "URL" if i can use the following syntax:
jdbc:oracle:thin:#(DESCRIPTION = (ADDRESS_LIST =(LOAD_BALANCE=off)(FAILOVER=ON) (ADDRESS = (PROTOCOL = TCP)(HOST = HOSTNAMEMAINDB)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = HOSTNAMEBACKUPDB)(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = SERVICENAME) (FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)(RETRIES = 120)(DELAY = 5))))
The questio would be if the datasource tomcat would support this syntax
Thank you very much
Ive tried with non Dataguard configuration and that work, i wonder if that would work with this configuration
Yes, it should be a string that is correctly formed. The long form connection string will work.
Another way is to move the entire connection string to a file named tnsnames.ora with a Name-value pair and then use a TNS Alias in the connection URL and TNS_ADMIN pointing to the location of the tnsnames.ora file (jdbc:oracle:thin:#orcldbtest_medium?TNS_ADMIN=/Users/test/). Refer to JDBC developer guide for more details.
Trying to configure a dblink I damaged the oracle listener in a SUSE with db Oracle, I undone the changes made in the files listener.ora and tnsnames.ora but it did not work, then I rebooted the computer and used lsnrctl status
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.250) (PORT = 1521)))
TNS-12541: TNS: no listener
TNS-12560: TNS: protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521)))
TNS-12541: TNS: no listener
TNS-12560: TNS: protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
I understand that if I left everything as it was, LISTENER should have started automatically and without problems.
Now I used $ ORACLE_HOME / bin / lsnrctl start LISTENER
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 07-JAN-2019 20:35:42
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11gR2/db/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/srvbdlnx/listener/alert/log.xml
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.3.250) (PORT = 1521)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1521)))
The listener supports no services
The command completed successfully
Then I restarted LISTENER and apparently is listening:
Listening Endpoints Summary ...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.3.250) (PORT = 1521)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1521)))
Services Summary ...
Service "app" has 1 instance (s).
Instance "app", status READY, has 1 handler (s) for this service ...
Service "appXDB" has 1 instance (s).
Instance "app", status READY, has 1 handler (s) for this service ...
The command completed successfully
But when I try to log in remotely in the application it does not work:
ORA-12537:TNS:connection closed
Modify the local_listener parameter in the db but it did not work.
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.250)(PORT=1521))';
The database is running because I can log in with the SYSTEM user in sqlplus in console.
my listener.ora file:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.250) (PORT = 1521))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
tnsnames.ora
APP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.250) (PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = app)
)
)
Is there something missing in the files that I modified?
What changes could have occurred due to the modifications I made to those files?
What other commands can I use to see more errors?
I am new, thanks in advance.
For some reason, when I modified these files, they changed the permissions of the /var/tmp/.oracle directory, this was discovered because the user Oracle user could not stop the listener.
# chown -R oracle:oinstall .oracle
# chmod -R 01777 .oracle
I am having issue with the new TNS connection. I have added the below code in to the tnsnames.ora file. I can verify the connection using the SQL Oracle developer, it is perfect.
c0xlxx =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxxxxxx)(PORT=xxxxxxxxx))
)
(CONNECT_DATA =
(SERVICE_NAME = xxxxxxx )
)
)
I did the sameway in the BizTalk application dev environment, it is working perfectly.But when I use in the BizTalk application in test environment using WCF-Custom adapter for OracleDBBinding with URI oracledb://c0xlxx/ it is throwing error
The adapter failed to transmit message going to send port "WcfSendPort_LTMDBBindingtoAX_View_VW_JOB_DEPT_Custom" with URL "oracledb://c0xlxx/". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.ConnectionException: ORA-12154: TNS:could not resolve the connect identifier specified ---> Oracle.DataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified Help me out.
Have some diferent properties to conection strings on TNS, you must need to seek the correct for your situation Example:
xxxxxx =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xxxx)
(SID = xxxx)
)
)
Can you send a properties who you entered to connect in SQL Oracle developer. Are you sure if you connect over TNS protocol in SQL Oracle developer
Try tnsping on windows cmd, command tnsping servername yours is c0xlxx. This command look like a ping, but its for oracle db server ping
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.
I'm trying to connect my local Oracle 11g database using server explorer in Visual Studio 2010. I tried to setup everything as per instruction, but I'm still getting an ORA-12504 error.
Here is the error:
Here is my tnsnames.ora contents:
# tnsnames.ora Network Configuration File: C:\app\rsahi\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
VENUS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SPRPRG020)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = VENUS)
)
)
LISTENER_VENUS =
(ADDRESS = (PROTOCOL = TCP)(HOST = SPRPRG020)(PORT = 1521))
listener.ora file contents,
# listener.ora Network Configuration File: C:\app\rsahi\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = SPRPRG020)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\app\rsahi
Try this, in Visual Studio's Server Explorer Data Connection panel:
Data source name: SPRPRG020/VENUS
i.e. the Data source name format is SERVER_NAME_OR_IP/DATABASE_NAME
In the "Connection Properties" -> "Advanced" set in the "Data Source" field the information in format HOST/SERVICE_NAME. E.g. 127.0.0.1/TEST
Without having much knowledge in connecting ODP.NET with an Oracle DB, I suggest you start using SERVICE_NAME (e.g: VENUS) in your connection parameters.
Oracle states that:
From 11g onwards, the feature of using the hostname provided in the /etc/hosts file, as the alias / service name has been changed. As a result, the user will have to provide the service name while connecting OR configure the target listener with a default service name.
One way to bypass the SERVICE_NAME client side requirement is to force the Listener always sending you on the same SERVICE by telling it to do so in the tnsnames.ora
DEFAULT_SERVICE_LISTENER = VENUS
But I do not suggest you do that as it's quite restricting.
I have experienced the same problem when I was trying to create LinkedServer with Oracle 11g. My oracle instance name was: PC-2.my.xgen and my listener name was "NB". The last parameter of first statement is actually the concatenation of Oracle server instance and listener name.
So I have write down the following statements in SQL server.
--add a linked server into SQL server
--last parameter contains OracleInstance / Listener Name of desired database
EXEC sp_addlinkedserver 'OracleLinkedServer4', 'Oracle', 'MSDAORA', 'PC-2.my.xgen/nb'
--add login information into linked server
EXEC sp_addlinkedsrvlogin 'OracleLinkedServer4', false, Null, 'system', '123456'
In Oracle database "NB" I have a table named : CRD_CIL_NOTIFICATION_TYPE. So I have written down the following statement to get the records.
select * from OracleLinkedServer4..SYSTEM.CRD_CIL_NOTIFICATION_TYPE
In the "Connection Properties" -> "Advanced" set in the "Data Source" field the information in format HOST:PORT/SERVICE_NAME. E.g. 10.xxx.xxx.xxx:1521/SIDNAME