If there are any methods to find out the sessions from local machine in Oracle ?
I found that there is a 'PORT' field in v$session for V11.2.0, when we access oracle 11.2.0 on the local machine with sqlplus, the port field is 0, instead when we access oracle 11.2.0 from remote machine with sql developer, the PORT field is remote tcp port.
So we can identify the local sessions by the PORT field except the local connections via tcp with 127.0.0.1.
But another problem is that the oracle version before 11.2.0 don't have the v$session.PORT column.
Thanks
Use the MACHINE, TERMINAL, and PROGRAM columns.
MACHINE will match name of local host.
TERMINAL will be something like pts/1 or the Windows Machine name.
PROGRAM will be something like sqlplus#(TNS V1-V3)<--this is important because you'll also see the various internal stuff like (J001)(W001) etc. You can use a WHERE USERNAME IS NOT NULL to eliminate these unless you are looking to list all local connections.
Hope this is a good start.
Related
I have a Forms 6i application. It retrieves data from a remote location and if there is no network connectivity, an error is generated and users cannot work.
I need to ping the remote location and check if the connection is available and if it is not available, take data from a local table and display on the form.
Thanks.
Use HOST built-in. It lets you execute an operating system command (which PING is).
I just Installed Oracle Database 12c. At the end of the installation it gave me Information about my connection. SID, IP, etc. I restarted the computer run all these services (some of them already running):
OracleJobSchedulerORCL
OracleOraDB12Home1MTSRecoveryService
OracleOraDB12Home1TNSListener
OracleRemExecServiceV2
OracleServiceORCL
OracleVssWriterORCL
But I think I forgot the IP and port of my database since I tried to access the database using a webbrowser and it doesn't work (I tried https://10.10.10.10:5500/em). I don't know If the problem is really the IP:Port that I may have forgotten or if I forgot to run service. I am pretty sure the IP address look like https://10.10.x.x:xxxx/em but I don't I am not certain. Is there a way to recover the IP address and port of the database?
EDIT: I've installed it on Windows 8 x64 JP. with
In Environment Variable
with ORACLE_HOSTNAME = 10.10.10.10
ORACLE_UNQNAME = orcl
And in the host file (in System32/Drivers/etc/)
127.0.0.1 localhost
10.10.10.10 wopr.orcl wopr
Per documentation, format for accessing enterprise manager in your browser
http://hostname:portnumber/em
Once you sure that default port number is kept as default HTTP port number is 5500 then you can get your system hostname. Port numbers are recorded in $ORACLE_HOME/install/portlist.ini file.
If running windows then just run the command hostname which will give you the hostname of your machine. Then run like
http://My_hostname:5500/em
Or use the command ipconfig to see your IPV4 address and use that address
http://X.X.X.X:5500/em
Or you as well use localhost
http://localhost:5500/em
or 127.0.0.1 (loop back address) like
http://127.0.0.1:5500/em
See here for more information
Well, if you installed it on your local machine, you can always access it using localhost, so try https://localhost:5500/em.
The default port number for Enterprise Manager is indeed 5500.
Here is my use case:
We are using virtual machine. Couple of days ago I have created new Oracle database. I cloned this machine and it got different IP address.
Today I wanted to connect to the database using SQLPlus but I go connection timeout. I have tried tnsping command and here is the output of that command:
C:\Users\Administrator>tnsping clm
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 09-JAN-2
014 08:36:31
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTO
COL=TCP)(HOST=9.142.60.187)(PORT=1521)))
TNS-12535: TNS:operation timed out
What is weird, that the current database address is different than 9.142.60.187. sqlnet.ora also does not contain any interesting data:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
?
ADR_BASE = C:\app\Administrator\product\11.2.0\dbhome_1\log
How can I make my connection to sqlplus available?
What is interesting, I am able to connect to the database using jdbc driver and it works fine.
Your sqlnet.ora is configured to first try to use TNSNAMES (tnsnames.ora in your TNS_ADMIN directed folder as defined in registry, environment variable or taken from default location) to resolve clm to a path through your network mapping SQL*Net to TCP/IP and possibly others.
From your tnsping that seems not to resolve. Therefore, SQL*Net tries the second one: EZCONNECT. See Oracle docs on that one.
Probably you are using somewhere an EZCONNECT connection string like user/pwd#//9.142.60.187 without service name and port. Or my knowledge of EZCONNECT is too simple; somehow it seems to translate clm into //9.142.60.187. That might be explained by the answer to the following question: Do you have a hostname clm in DNS or hosts file mapping to 9.142.60.187?
I do not recommend using EZCONNECT, I always like to have tnsnames.ora hard coded, specifying everything needed. EZCONNECT can work nonetheless.
Can you include IP address of clone in your sample?
Can you include outcome of ping clm and nslookup clm in your sample?
Change the ip address in (HOST=9.142.60.187) to the current ip address of server. May be in the JDBC driver you are using host name instead of ip address and that's why it is working. You can also try giving host name in (HOST=9.142.60.187), e.g if host name is ora_server then change it to (HOST=ora_server)
Since tnsping clm is using EZConnect, your tnsnames.ora does not have an connection alias called CLM, but clm is being resolved as a host name to 9.142.60.187. It's using port 1521 by default as it has no instructions to use a specific port. The connection to that address, or at least that port, is then timing out - it might not exist, it might route somewhere unreachable, or it might be blocked by a firewall.
ping clm should show the same address, and will probably also time out. That host may exist in your hosts file, or is being resolved by DNS, possible with a default domain appended, which ping would also show. If it is the name of your old server, you might need to update your hosts file, which might magically make it start working.
If your database is actually called CLM then you can create an entry in your tnsnames.ora that points to the correct IP address for your listener, which your JDBC connection is already using. Or you can use the EZConnect format as your connect string; something like sqlplus user/password#//<your IP>:1521/<your service name>. You can use lsnrctl services to check the IP address, port and service name if you aren't sure.
If you're on the same host as the database then you don't need to do either; presumably you're currently trying sqlplus user/password#clm, but if ORACLE_SID is set you can just do sqlplus user/password and it will not trouble the listener.
I have seen a few related questions on SO, but none have helped me. I setup a MySQL database on an Ubuntu machine on EC2. I am trying to connect to it from within R, using e..g ,
con <- dbConnect(MySQL(), username = user, dbname = db, host = host, password = password)
where the username and password are those for the remote database, and the host is the ec2 address (something like ec2-54-456-161-6.us-west-2.compute.amazonaws.com [not a real one])
Any thoughts on how to do this?
To log in to the Ubuntu machine the database is installed on from the shell on my machine I have to use the key pem file. Does this key have to be provided to authenticate? If so, how?
Make sure the MySQL instance listens on the network, even if you're on the same machine. In /etc/mysql/my.cnf, change this:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
This should be in a number of MySQL tutorials and is not EC2 specific.
You want to make sure that you can connect to the DB from the server itself. Once that is taken care of, try the remote access. If a port ends up being blocked, you can also got the route of an ssh tunnel -- which again is described in a number of tutorials.
The problem in my case was that I just need to add a new rule to the security group to allow remote connections on port 3306. See below screenshot of the rule added (the bottom line)
That was all that was needed.
What steps do I need to take to change an IP address for Oracle 10g? I cannot connect to the database after going from a dhcp address to a static IP and a reboot.
If the server's IP address changed, these are the first things I would look at:
The TNSNAMES.ORA file on the client -- does it have the IP address hardcoded? If so, change it. Does it use the machine name? If so, does the machine name resolve to the correct IP address on your client machine?
The LISTENER.ORA file on the server -- does it explicitly specify the old IP address as its listening address?
More info please. Do you mean that you have changed the ip address of the host that the database is on and now you have to connect to it from a different macine, or are you having trouble starting the database after the ip change?
... and what error message do you receive?
Most obvious files to check are:
$ORACLE_HOME/network/admin/tnsnames.ora
$ORACLE_HOME/network/admin/listener.ora
Other than that we'd need more info...
I presume you mean the Oracle 10g DB and not the Oracle 10g Application Server?
Does the database start ok?
Is there anything in the database alert log?
Are the error(s) connecting from a client or the server?
What error message(s) do you get?
Can you ping the machine on it's new address (by both name + IP address) From both client + server?
Does a TNSPING work?
Can you connect using SQL*Plus on the server?
What other tool(s) have you tried connecting with?
Update after comment
Please can you post...
Your old ip address (if you know it)
Your new ip address
Your FQDN (e.g. machine.domain.com)
The output of "ipconfig/all" (or equivalent)
Your listener.ora file
The output of "$ORACLE_HOME/bin/lsnrctl start"
The output of "$ORACLE_HOME/bin/lsnrctl status"
Check that LOCAL_LISTENER is not defined (or defined correctly) in the database - it may not be registering correctly because of an incorrect entry here. Also try 'ALTER SYSTEM REGISTER' to attempt to register with the listener (rather than waiting up to 3 minutes for an auto-register). Examine the listener.log to see the instance registered (service_update * ) and 'lsnrctl status' to see if it is there.
Did you change the hostname in DNS? Can you ping the hostname from another machine?