Database connection through one of the scan ip is failing - oracle

Oracle Database connection through one of the scan ip is failing.
nslookup of scanhost name returns 3 IPs
Able to ping all 3 IPs
Able to telnet to each of the 3 IP and DB port separately
But if i make a connection to DB using individual scan ips using jdbc , only 2 are connecting to Database.
what would be problem.?
I am not a DBA and i have access only to SQL developer and read access.
It is a 2 node RAC database

Related

Create DB link to oracle cloud database which installed in private network

I have public IP, the Oracle cloud DB installed in private IP. through the public IP we can establish ssh tunnel to private IP and forward localhost port to access Oracle cloud DB.
My task is to create DB link from my localhost oracle DB to cloud Oracle DB. So I can access Oracle cloud DB schema from my localhost oracle DB.
I using Putty to establish SSH & localhost port forward and I can access Oracle Cloud DB using SQL developer/Toad. So public/private IP and SSH details are correct.
In this case, how to create DB link?
You already have forwarded connections coming to localhost port X to the target private IP in AWS (let it be RDS:1521). So your config is localhost:X -> RDS:1521. You also need schema name (myusername) and its password (mypassword).
CREATE DATABASE LINK mylink
CONNECT TO myusername IDENTIFIED BY mypassword
USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=X))
(CONNECT_DATA=(SERVER=dedicated)
(SERVICE_NAME=myrdsservicename)))';
Oracle's 12c syntax for creating db links can be found here.
Instead of using RAW connection parameters (as above) you my prefer to create an entry in tnsnames.ora for the connection string above and use the symbolic name for the localhost forwarded connection.

Get IP address of oracle client users

I need a query to get all IP's of client users that have already a session to the database, I have an Oracle Database server in my work (hospital), some times the database stop working and can't execute any query that done by Oracle modules of the system which is the interface of the users, so to solve it we have to kill all sessions that connected to the database and make all users to restart sessions, my question is there any way to get the ip address with any information of the session like the consumption of the session?
I need a query to get all IP's of client users that have already a session to the database
You could use SYS_CONTEXT. It would return the following host and IP address information for the current session:
TERMINAL - An operating system identifier for the current session. This is often the client machine name.
HOST - The host name of the client machine.
IP_ADDRESS - The IP address of the client machine.
SERVER_HOST - The host name of the server running the database instance.
Have a look at this article by Tim Hall.
For example,
SQL> SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') FROM dual;
SYS_CONTEXT('USERENV','IP_ADDRESS')
----------------------------------------------------------
127.0.0.1
SQL>
For me the IP is localhost, so I get 127.0.0.1
Edit From discussions in the comments below, to get the list of the IP address of all the users from v$session, you could use MACHINE they are connected from.
SELECT utl_inaddr.get_host_address(t.machine), t.* FROM v$session t;
Have a look with this query:
SELECT username, status, osuser, process, machine, terminal, logon_time,
lockwait, blocking_session_status, blocking_instance, blocking_session,
UTL_INADDR.GET_HOST_ADDRESS(REGEXP_REPLACE(machine, '^.+\\')) AS client_ip
FROM v$session;

JDBC connection string for clustered environment

I have 2 nodes sql server 2012 installed and clustered and configured Always On feature with Synchronized option.
Clustername: Cluster1
node 1 name: db1
node 2 name: db2
SQL Availability group name: AVG1 has 2 IP address( 10.X.30.7 and 10.X.31.7)
N0w i need to connect to the database from the application( using tomcat 7). Could you please let me know the jdbc syntax how to connect to the database ?
What would be the SQL server name i have to mention in my application?
And Could you please share JDBC connection example string with the above data?
Let me know for more details
So, if you have created an availability group listener, then that is the server name that you have to reference as this is the name that the windows cluster keeps online as a resource so that the servername never changes no matter what replica the availability group is running on.
The connection string also depends on what port you set the listener up on too, but I'm going to assume that you are using a default instance, your listener is called AG-Listener and it is running on port 1433:
jdbc:sqlserver://AG-Listener:1433;databaseName=YourDB;user=MyUserName;password=*****;
You can find many more examples of JDBC connection strings here:
Building the Connection URL

Oracle Connection String for RAC Environment?

I have got an ORACLE RAC Environment access .The details are
Database Name: orcl
Service Name: orcl
IP Address: 192.168.1.1 and 192.168.1.2
SQL> host srvctl status database -d orcl
Instance orcl1 is running on node orclnode1
Instance orcl2 is running on node orclnode2
My concern is my connection, which is being established using
(DESCRIPTION=(ADDRESS=
(PROTOCOL=TCP)(HOST=192.168.1.1) (PORT=1521)
)(CONNECT_DATA=(SID=orcl1)))
But the provider wants it to be connected via the orcl service name .
I don`t have any other info related to this. Am I connecting correctly or I need hostname or IP address for orcl service name.
Your connection string is referencing one instance on one server/node. You should be using the common service name instead, and identifying all the servers it is available on.
The equivalent for you would be something like this (line breaks just for clarity here):
(DESCRIPTION=(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521))
)(CONNECT_DATA=(SERVICE_NAME=orcl)))
As long as it is resolvable, it shouldn't matter whether you use the DNS names or the IP addresses for the HOST parameters.
You may also need the LOAD_BALANCE or FAILOVER parameters; see the docs.

how to connect to oracle rac in asp.net

We just set up the Oracle RAC environment today and we use the single oracle database instance before.
Now we have four nodes in the RAC whose physical IPs are :
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
Also the there are four virtual IPs:
192.168.1.11
192.168.1.22
192.168.1.33
192.168.1.44
And we can connect 192.168.1.1 to use the oracle EM Database Console.
Now I do not know how to set the connection string in my web.config of the asp.net application.
Since when we use the single instance we just set the string like this:
provider=MSDAORA;data source=ORCL;user id=xx;password=xx
The "ORCL" here is the local net service name which can be found in the tnsnames.ora(the machine on which the IIS work).
Any idea?
UPDATE:
I use the oledb api.
You didn't make mention of SCAN address, so, I assume you're not on 11gR2.
Since your OLE data source makes reference to the ORCL connection identifier, that's where you'll want to configure your RAC load balancing and failover, in the tnsnames.ora definition of 'ORCL'.
Something like this ought to do it:
ORCL=
(DESCRIPTION=
(LOAD_BALANCE=ON)
(FAILOVER=ON)
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.11)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.22)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.33)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.44)(PORT=1521))
)
(CONNECT_DATA=(FAILOVER_MODE=(TYPE=SELECT)
(METHOD=BASIC)
)
(SERVICE_NAME=ORCL)
)
)
Hope that helps.

Resources