Tnsping, "Used parameter files" is empty - oracle

I am using Ruby API oci8 to connect to a remote Oracle DB, got ORA 12514.
My operating system is linux, the weird thing is when I do:
tnsping <hostname:port>
I get:
TNS Ping Utility for Linux: Version 10.2.0.2.0 Production on 22-JUL-2017 14:46:28
Copyright (c) 1997, 2005 Oracle Corporation. All rights reserved.
Used parameter files:
Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION = (CONNECTDATA = (SERVICE_NAME= my-orasvr.db)) (ADDRESS= (PROTOCOL =TCP)(HOST = 10.15.222.44)(PORT = 1521)))
OK (0 msec)
The "Used parameter files" is empty, not sure whether it does matter.
Don't have any clue, any help is appreciate~!!

Related

ORA-12154: Can't Connect to Default Oracle XE 21c Database on Windows 10

I've had it. I just can't get this to work. I installed Oracle XE 21c on my Windows 10 desktop. The installation went ok, once I ran the Setup file as an administrator. I basically chose all the defaults.
So now it is running, and there was a default database XE create for me. But I get this when attempting to connect as SYSTEM using SQLPlus:
SQL*Plus: Release 21.0.0.0.0 - Production on Mon Nov 1 19:08:25 2021
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter user-name: SYSTEM
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
I looked and there is no tnsnames.ora or listern.ora file, so I attempted to create them, though I am not sure they are correct.
C:\app\sysde\product\21c\dbhomeXE\network\admin\listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
C:\app\sysde\product\21c\dbhomeXE\network\admin\tnsnames.ora
LISTENER = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
XE = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
I then stopped the listener as follows lsnrctl stop
which yielded this:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 61: Unknown error
The listener OracleOraDB21Home1TNSListener is no longer running in services.msc. When trying to restart it I get this...
Error 2: The system cannot find the file specified.
My environment variables are:
ORACLE_HOME=C:\app\sysde\product\21c\dbhomeXE\
TNS_ADMIN=C:\app\sysde\product\21c\dbhomeXE\network\admin
I know there are numerous "Can't connect to Oracle" posts. I've tried bits and pieces of them, but none are really suited to my situation and the parts I've tried simply haven't helped. Any suggestions you have to allow me to use the default XE database and connect to it through a GUI such as SQL Developer would be tremendously helpful.
As per the docs, from 21c onwards the default software installation is the read only home layout, which has been available since 18c
https://docs.oracle.com/en/database/oracle/oracle-database/21/nfcon/read-only-oracle-home-default-366970591.html
So by default the sqlnet configuration files are not going to be under ORACLE_HOME/network/admin.
C:\oracle\product\21c\dbhomeXE\network\admin>dir
Volume in drive C is System
Volume Serial Number is EEB1-910D
Directory of C:\oracle\product\21c\dbhomeXE\network\admin
13/10/2021 10:53 AM <DIR> .
13/10/2021 10:53 AM <DIR> ..
13/10/2021 10:51 AM <DIR> sample
13/10/2021 10:52 AM 263 sqlnet.ora.rooh
1 File(s) 263 bytes
3 Dir(s) 78,346,031,104 bytes free
C:\oracle\product\21c\dbhomeXE\network\admin>cd ..\..\..\homes\OraDB21Home1\network\admin
C:\oracle\product\21c\homes\OraDB21Home1\network\admin>dir
Volume in drive C is System
Volume Serial Number is EEB1-910D
Directory of C:\oracle\product\21c\homes\OraDB21Home1\network\admin
13/10/2021 10:54 AM <DIR> .
13/10/2021 10:54 AM <DIR> ..
13/10/2021 10:53 AM 656 listener.ora
13/10/2021 10:53 AM 465 sqlnet.ora
13/10/2021 10:53 AM 263 sqlnet21101310AM5351.bak
13/10/2021 02:51 PM 852 tnsnames.ora
4 File(s) 2,236 bytes
2 Dir(s) 78,345,871,360 bytes free
You don't need to set ORACLE_HOME or TNS_ADMIN. You just need to edit the files in the 'homes' area and you'll be good to go.
A complete top to bottom install video is available here from the Windows team
https://youtu.be/DYleroLay5E
OracleXE21 default path for tnsnames.ora and sqlnet.ora has been changed in Express Edition 21c. The new path will be like this: C:\oracle\product\21c\homes\OraDB21Home1\network\admin
and there where you will find tnsnames.ora and sqlnet.ora.

Oracle database service could not be connected on ubuntu , ORA-27101: shared memory realm does not exist

I got a linux server with ubuntu 16.04 and successfully installed oracle 11gR2 on it. After system boot , I could use the following code startup oracle and do a simple query:
db#dbpc:~$ sudo lsnrctl start
db#dbpc:~$ sqlplus /nolog
SQL> conn / as sysdba
SQL> startup
SQL> select * from scott.dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
However I could not login via IP , for example if I use the following command:(after start the hole services)
db#dbpc:~$ sqlplus scott/123456#192.168.1.100:1521/orcl
It will shows:
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 31 12:58:42 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
Here's my setting files:
db#dbpc:/home/rogear/tools/oracle11g/product/11.2.0/dbhome_1/network/admin$ cat listener.ora
# listener.ora Network Configuration File: /home/rogear/tools/oracle11g/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 = 192.168.1.100)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /home/rogear/tools/oracle11g
db#dbpc:/home/rogear/tools/oracle11g/product/11.2.0/dbhome_1/network/admin$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /home/rogear/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
What's wrong?
The first thing that is wrong is that Oracle is not certified nor was ever designed for Ubuntu. Ubuntu is from an entirely different branch of the linux family. Getting oracle to work at all on it is a hack, and beyond that, nothing is guaranteed.
Also note that your connection string (sqlplus scott/123456#192.168.1.100:1521/orcl) never uses your tnsnames.ora. To use your tnsnames.ora, your connection string would be:
sqlplus scott/123456#orcl
where 'orcl' is the name of the entry in tnsnames.
Third we don't know the name of the database instance. I'd want to see the output of
ls -l | grep pmon
Fourth, Oracle 11 is old and out of support, even on supported operating systems.
If you are stuck with an Ubuntu machine (the very fact of using Ubuntu tells me this is a personal pc that you are using for self-study or schoold) your best bet would be to install Oracle VirtualBox, then use that to create a VM running a recent version of Oracle Linux, and install a recent version of Orcle on that. I have an article on that, which is a bit dated now, at https://edstevensdba.wordpress.com/category/personal-test-systems/

How do I setup an ODBC connection to Oracle using FireDAC?

I can succesfully connect to Oracle through the native drivers, but cannot get an ODBC connection to work. The Oracle 11g client software is installed on my Windows 7 64 bit machine, as well as the 32-bit ODBC drivers downloaded from
Instant Client Downloads for Microsoft Windows 32-bit.
Let me first describe the succesful connections:
TNSNames.ORA contains data for an Oracle 10 installation:
# TNSNAMES.ORA Network Configuration File: C:\oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
VS2003-2005-10.TimeTellBV.nl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = VS2003-2005-10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = Orclvs10)
)
)
I set up my TFDConnection with
DriverName := S_FD_OraId;
Params.Database := 'VS2003-2005-10';
Alternatively, I can bypass TNSNAMES.ORA by specifying directly:
DriverName := S_FD_OraId;
Params.Database := '(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = VS2012-2012.timetellbv.nl)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl12.timetellbv.nl) ))';
(As you can see, this is another Oracle server not in TNSNAMES.ORA)
Now the failing attempts through ODBC
Two 32-bit Oracle ODBC drivers are installed:
Microsoft ODBC for Oracle version 6.01.7601.19135 - I think this came with the Win7 OS
Oracle in instantclient_11_2 version 11.02.00.04 - I installed this manually from the source mentioned at the top (running as admin as suggested in the Oracle Instant Client ODBC Release Notes).
I have set up two System DSNs through these drivers but neither work.
The version 6 ODBC driver, giving it the TSNAMES.ORA entry name for 'Server':
and the version 11 Oracle driver idem:
For that second one I added another entry to TNSNAMES.ORA, since that dialog obviously suggested I had to go through that file:
VS2012-2012.TimetellBV.nl =
(DESCRIPTION=
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = VS2012-2012)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl12.timetellbv.nl)
)
)
I set up my TFDConnection with
DriverName := S_FD_ODBCId;
Params.Add('DataSource=' + lODBCName); // The ODBC DSN Name
Params.Database := lDataSection.Values[INISTRING_DATABASENAME];
Both this code and the test button in de 32-bit ODBC admin fail with error:
Unable to connect
SQLState IM003
The specified driver could not be loaded due to system error 127: cannot find procedure<br />
(Oracle in instantclient_11_2; D:\app\jan\product\11.2.0\client_1\SQORA32.dll)
That folder is where my Oracle client software is installed, it contains SQORA32.DLL (and others) and is in my system path.
I have tried all kinds of variations including/excluding domain name, database name, etc, without success.
How do I properly set up an ODBC connection to connect to Oracle, to be used in a Delphi-Tokyo 32 bit app through FireDAC?
What also did not help:
Reinstalling the Visual Studio 2013 32-bit redistributable
Copy sqora32.dll to the Windows SysWOW64 folder
Setting ORACLE_HOME environment variable to d:\app\jan\product\11.2.0\client_1\
Setting TNS_ADMIN environment variable to d:\app\jan\product\11.2.0\client_1\
Renaming sqora32.dll to SQORA32.dll
Replaced c:\windows\syswow64\mfc42.dll dated 11 March 2011 with a newer one from the Oracle home folder, dated 27 April 2011
I don't know what was wrong. I found a client installer executable (i.e. that's different from the "instant client", which has no installer, and whose reinstallation did not help either), cleaned up my VM from all Oracle stuff, ran the installer with 'administrator' selection (=all available software in the package) and that finally works. ODBC was installed as well.
The only things that need to be set for the TFDCOnnection are:
DriverName := S_FD_ODBCId;
Params.Add('DataSource=' + lODBCName);
with lODBCName being the ODBC System DSN name.
(I intended to leave this as a comment for 10K users and then delete the question, but that's not possible since I put a bounty on it earlier today. Well, maybe it serves anyone else).
I have already encountered similar issue.
I can use SQLPLUS or JDBC to connect to Oracle database, but when I try to define an ODBC connection or a .Net Linq connection, that don't work.
I have then modified my TNSNAMES.ora file and replaced SERVER-NAME by SID and suddently ODBC connection has been possible.

Oracle Database 11g Express: Data Pump Export

I want to invoke the expdp (Data Pump Export) command, but I got an error:
C:\oraclexe\app\oracle\admin\XE\dpdump>expdp test/test#DEVICES CONTENT=METADATA_ONLY FILE=FLEET.DMP
Export: Release 11.2.0.2.0 - Production on Vie Sep 22 12:46:30 2017
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
UDE-12154: operation generated ORACLE error 12154
ORA-12154: TNS:could not resolve the connect identifier specified
and here the file tsnames.ora :
DEVICES =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 212.137.78.211)(PORT = 1521))
(CONNECT_DATA =
(SID = DEVICES)
)
)
and
C:\oraclexe\app\oracle\admin\XE\dpdump>tnsping DEVICES
TNS Ping Utility for 64-bit Windows: Version 11.2.0.2.0 - Production on 22-SEP-2017 16:00:17
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\sqlnet.ora
TNS-03505: Failed to resolve name
http://docs.oracle.com/cd/E11882_01/network.112/e41945/admintools.htm#NETAG272 please see this post, thear write corectly, but I thinking you write wrong database name
First try what #kfinity suggested, it is good advice. If that doesn't add clarity, try:
sqlplus test/test#device
That will probably not connect in your case. I am on Windows, you will need to do similar if you are on UNIX:
set ORACLE_SID=DEVICE
sqlplus test/test
If this connects, retry your IMPD command. If it doesn't, check out the SQLNET configuration file at %oracle_home%\network\admin\sqlnet.ora.
If it has an entry similar to
NAMES.DEFAULT_DOMAIN = WORLD
you need to add .WORLD to your command, as in
expdp test/test#DEVICES.WORLD CONTENT=METADATA_ONLY FILE=FLEET.DMP

How to install tnsping?

How do I have to install tnsping?
I tried to install oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm and I'm able to use some client commands but nog tnsping.
Oracle Instance Client does not include tsnping application. You must run "Oracle Universal Installer" and enable the option for it.
I don't' remember exactly which option you have to set, either it was "Oracle Database Utilities" or "Oracle Net"
Also see McTnsping [link broken] "a Windows stand-alone program which requires no Oracle client". It's portable and doesn't need to be installed.
Usage 1: McTnsping.exe { <tns entry> | <host>:<port> } [<count>]
<tns entry> the net service name in the tnsnames.ora file.
<host>:<port> server name or IP and port (mandatory)
<count> number of times to check target, default is 1.
If whoever will reach the place like me... This is what worked for me:
Instant client Version 12.2.0.1 + sqlplus + tnsping (copied from another server of the same version)
Directory structure and env (as in bash profile):
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=${ORACLE_BASE}/instant_client122
export PATH=$ORACLE_HOME:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME #since all binaries are in $ORACLE_HOME - no bin or lib are present
export TNS_ADMIN=$ORACLE_HOME/network/admin
copy from another server to target:
'tnsping' to $ORACLE_HOME
'$ORACLE_HOME/network/mesg/tnsus.msb' to $ORACLE_HOME/network/mesg
Then put proper values to $TNS_ADMIN/tnsnames.ora and load env variables. After this it should be able to perform 'tnsping' and show proper message as a response.
Here's what I did to copy tnsping over to another machine. In my case, the oracle client is installed at C:\Oracle\product\12.1.0\client_1.
This assumes there's already an Instant Client or similar installed on the destination machine; and that the oracle path and registry keys are set.
(1) Copy tnsping.exe from the source to the destination machine, into client_1\bin.
(2) Copy the following files from client_1\bin to client_1\bin:
oraasmclnt12.dll
oracell12.dll
oraclient12.dll
oraclsce12.dll
oracommon12.dll
oracore12.dll
orageneric12.dll
orahasgen12.dll
oraldapclnt12.dll
oran12.dll
orancds12.dll
orancrypt12.dll
oranhost12.dll
oranl12.dll
oranldap12.dll
oranls12.dll
oranro12.dll
orantcp12.dll
orantns12.dll
oraocr12.dll
oraocrb12.dll
oraocrutl12.dll
oraplp12.dll
orapls12.dll
ORASLAX12.DLL
orasnls12.dll
oraunls12.dll
orauts.dll
oravsn12.dll
oraxml12.dll
orazt12.dll
oraztkg12.dll
This should be about 84.6 MB.
(3) In the client_1 on the destination machine, make a backup of the following files:
oci.dll
orannzsbb12.dll
oraons.dll
orasql12.dll
orawsec12.dll
Now on the source machine, find those files in client_1\bin and copy them to client_1\ (no bin) on the destination machine, overwriting the existing files. (Note: oci.dll is ~330 kb smaller, orasql12.dll is ~300 kb smaller. I'm not sure what's lost, hence the backup).
(4) On the destination machine, create the directory mesg in client_1\Network. Now copy the following file from the source to the destination:
client_1\Network\mesg\tnsus.msb
(5) Open up regedit. Create the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient12Home1_32bit
(From another machine, it looks like the x64 version is named HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient12Home1, but the tnsping program I'm using says it's 64 bit, so ...)
Under the key, create a string named ORACLE_HOME with the value C:\Oracle\product\12.1.0\client_1.
You should be done now ($$$ = redacted):
C:\Users\$$$>tnsping $$$
TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 - Production on 03-APR-2
019 08:47:37
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:\Oracle\product\12.1.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = $$$)(PORT = $$$))) (CONNECT_DATA = (SERVICE_NAME = $$$
$$$) (SERVER = DEDICATED)))
OK (30 msec)
Troubleshooting
Here's the process I followed, sharing for when these steps invariably fail to work on a later version.
First off, I just copied the tnsping.exe over.
I didn't haphazardly pick the above dlls, as far as I can tell everyone is required. I ran the exe, and it would popup an error, I would copy the dll over and try again:
After a few dlls, you'll run into a different kind of error:
If that happens, fire up process monitor and put a filter in for the ProcessName to contain tnsping and try to run the program again. You should see something like the following. The main thing to notice is that it tries to load (in this example) orawsec12.dll, which succeeds, but then it continues to try to load the dll looking in different paths, and then at the end it triggers werfault and the program ends. I guess it realizes there's some kind of version mismatch and keeps looking for the right version.
The missing registry key will show up like the following in process monitor (operation RegOpenKey, result NAME NOT FOUND):
If the tnsus.msb file is missing, you should see something like the following in process monitor (operation CreateFile, result NAME NOT FOUND):

Resources