ORA-01034: ORACLE not available on remote connection - oracle

When I try to connect to Oracle database from the remote host (I use oracle instant client), I get following errors:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3640
Additional information: 1108778635
Process ID: 0
Session ID: 0 Serial number: 0
However, ORACLE_HOME on the host machine is set correctly, as well as ORACLE_SID, and i can easily connect to the database from its host machine:
SQL*Plus: Release 12.1.0.2.0 Production on Wed Jul 10 09:20:09 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Enter user-name: system
Enter password:
Last Successful login time: Wed Jul 10 2019 09:13:57 +03:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
What can cause this sort of behavior?
UPD:
Status of the listener on the remote DB:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.71.2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 05-JUL-2019 08:56:16
Uptime 6 days 23 hr. 29 min. 47 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/12.1.0/dbhome_1/log/diag/tnslsnr/epyc-gbu2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.71.2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "AGRO.GBUBDD.RU" has 1 instance(s).
Instance "AGRO", status UNKNOWN, has 1 handler(s) for this service...
UPD2:
The command I use to connect to remote DB:
sqlplus /nolog
connect system/oracle#192.168.71.2:1521/agro.gbubdd.ru

This could happen due to 2 reasons.
1) Oracle database is not started correctly.
2) There is no space left and database is crashed / stopped working.
To correct, login to remote db and check if database is up or not and there is enough space for database to perform operations.
To check if database is open or not, on remote machine where db is installed, you can login with sql plus and run query to check status of database.

Having ORACLE_SID set in your environment is only relevant for local connections. The error is telling you that there is no database running with that SID on the machine you are running SQL*Plus on. It doesn't know about the remote DB.
To connect remotely you need to tell SQL*Plus how to reach the remote DB, which is usually either via a TNS entry or using 'easy connect' syntax.
You haven't included any details of the remote DB, but you would need to do something like:
sqlplus username#//database_host:listener_port/remote_service_name
Or start with sqlplus /nolog and then use the connect command, as shown in the documentation.
The port is usually 1521 but might be different, and the service name might be the same as the SID. If you run lsnrctl services or lsnrctl status on the DB server you should be able to see the valid service names, as well as the address and port the listener is using.

Related

Oracle Database error during REST services installation: PLS-00201: identifier 'ORDS.ENABLE_SCHEMA' must be declared

Installed on CentOS 8.
Tried both
Oracle Database Express Edition (XE)
Enterprise Edition
from here https://www.oracle.com/database/technologies/oracle-database-software-downloads.html
ords.war taken from https://www.oracle.com/database/technologies/appdev/rest-data-services-downloads.html
Installation went well
java -jar ords.war install
https://docs.oracle.com/cd/E56351_01/doc.30/e58123/rest.htm#GUID-4F666968-86CF-44EC-9784-1DFCE88F908F
On the step where I must execute PL/SQL procedure I am getting
[oracle#oracle-ee-8gb ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 28 11:08:59 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> EXEC ords.enable_schema;
BEGIN ords.enable_schema; END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'ORDS.ENABLE_SCHEMA' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Of course, first I tried with a newly created user - exactly for SODA purposes
CREATE USER JSONDB IDENTIFIED BY MyNewPassword;
GRANT CONNECT, RESOURCE TO JSONDB;
GRANT UNLIMITED TABLESPACE TO JSONDB;
GRANT CREATE SESSION TO JSONDB;
and logged as
sqlplus JSONDB/MyNewPassword#localhost/ORCLCDB
Also tried to do the same on official Docker images https://github.com/oracle/docker-images/tree/main/OracleDatabase - same issue.
Output when I activate REST with docker
# docker run --name ords --network dbnet -p 8888:8888 -e ORACLE_HOST=oracledb -e ORACLE_PORT=1521 -e ORACLE_SERVICE=ORCLPDB1 -e ORACLE_PWD=*** -e ORDS_PWD=*** -e CONTEXT_ROOT=ords -v /root/ords-config-data:/opt/oracle/ords/config/ords oracle/restdataservices:21.2.0
Requires to login with administrator privileges to verify Oracle REST Data Services schema.
Connecting to database user: SYS AS SYSDBA url: jdbc:oracle:thin:#//oracledb:1521/ORCLPDB1
Retrieving information.
Enter a number to select a feature to enable:
[1] SQL Developer Web (Enables all features)
[2] REST Enabled SQL
[3] Database API
[4] REST Enabled SQL and Database API
[5] None
Choose [1]:
2021-07-28T14:17:01.072Z INFO HTTP and HTTP/2 cleartext listening on host: localhost port: 8888
2021-07-28T14:17:01.173Z INFO The document root is serving static resources located in: /opt/oracle/ords/doc_root
2021-07-28T14:17:02.540Z INFO No pools configured yet
2021-07-28T14:17:04.115Z INFO Oracle REST Data Services initialized
Oracle REST Data Services version : 21.2.0.r1741826
Oracle REST Data Services server info: jetty/9.4.42.v20210604
Of course, it gives 404 because I can't make it to enable REST for the schema
# curl -i -X PUT http://localhost:8888/ords/jsondb/soda/latest/mycoll
HTTP/1.1 404 Not Found
Content-Type: application/problem+json
Content-Length: 336
{
"code": "NotFound",
"title": "Not Found",
"message": "The request could not be mapped to any database. Check the request URL is correct, and that URL to database mappings have been correctly configured",
"type": "tag:oracle.com,2020:error/NotFound",
"instance": "tag:oracle.com,2020:ecid/au4ymHSYbdm27PDCJ9KjsA"
}
Docker setup:
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f26a03a15512 oracle/restdataservices:21.2.0 "/bin/sh -c $ORDS_HO…" 4 minutes ago Up 4 minutes 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp ords
6928780180b4 oracle-ee:latest "/bin/sh -c 'exec $O…" 51 minutes ago Up 51 minutes (healthy) 0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:5500->5500/tcp, :::5500->5500/tcp oracledb
Of course, I tried to install JDK locally and installing manually, not only using https://github.com/oracle/docker-images/tree/main/OracleRestDataServices
There's no option to even activate REST using SQL Developer
# java -jar ords.war install advanced
Specify the database connection type to use.
Enter number for [1] Basic [2] TNS [3] Custom URL [1]:1
Enter the name of the database server [localhost]:
Enter the database listen port [1521]:
Enter 1 to specify the database service name, or 2 to specify the database SID [1]:
Enter the database service name:ORCLPDB1
Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:
Enter the database password for ORDS_PUBLIC_USER:
Confirm password:
Requires to login with administrator privileges to verify Oracle REST Data Services schema.
Enter the administrator username:SYS AS SYSDBA
Enter the database password for SYS AS SYSDBA:
Confirm password:
Connecting to database user: SYS AS SYSDBA url: jdbc:oracle:thin:#//localhost:1521/ORCLPDB1
Retrieving information.
Enter the default tablespace for ORDS_METADATA [SYSAUX]:
Enter the temporary tablespace for ORDS_METADATA [TEMP]:
Enter the default tablespace for ORDS_PUBLIC_USER [SYSAUX]:
Enter the temporary tablespace for ORDS_PUBLIC_USER [TEMP]:
Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.
If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]:2
Enter a number to select a feature to enable:
[1] SQL Developer Web (Enables all features)
[2] REST Enabled SQL
[3] Database API
[4] REST Enabled SQL and Database API
[5] None
Choose [1]:
2021-07-28T20:16:57.913Z INFO reloaded pools: []
Installing Oracle REST Data Services version 21.2.0.r1741826
... Log file written to /root/ords_install_core_2021-07-28_221658_00061.log
Warning: Nashorn engine is planned to be removed from a future JDK release
... Verified database prerequisites
... Created Oracle REST Data Services proxy user
... Created Oracle REST Data Services schema
... Granted privileges to Oracle REST Data Services
... Created Oracle REST Data Services database objects
... Log file written to /root/ords_install_datamodel_2021-07-28_221715_00056.log
... Log file written to /root/ords_install_apex_2021-07-28_221716_00329.log
Completed installation for Oracle REST Data Services version 21.2.0.r1741826. Elapsed time: 00:00:19.493
Enter 1 if you wish to start in standalone mode or 2 to exit [1]:2
advanced here is mandatory - then instead of selecting SID you must choose Service name and set pluggable database (PDB) - in case of Oracle DB XE it's XEPDB1, for Enterprise Edition - ORCLPDB1
that's how user should be created
$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 28 20:06:06 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> ALTER SESSION SET CONTAINER=ORCLPDB1;
Session altered.
SQL> CREATE USER testuser1 IDENTIFIED BY MyNewPassword DEFAULT TABLESPACE users QUOTA UNLIMITED ON users;
User created.
SQL> GRANT CREATE SESSION, CREATE TABLE, CREATE PROCEDURE TO testuser1;
Grant succeeded.
SQL> GRANT CONNECT, RESOURCE TO testuser1;
Grant succeeded.
SQL> GRANT SODA_APP TO testuser1;
Grant succeeded.
SQL> quit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
that's how rest should be enabled for the schema
$ sqlplus /nolog
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 28 20:21:19 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
SQL> CONN testuser1/MyNewPassword#ORCLPDB1
Connected.
SQL> EXEC ords.enable_schema;
PL/SQL procedure successfully completed.
SQL> COMMIT;
Commit complete.
alternatively, you can setup SQL Developer in the way of setting Service name instead of SID - Rest Services menu item will become available.

TNS listener does not currently know of SID given in connect descriptor

Hi,
I have installed Oracle 11g on my laptop for practicing Oracle.
I've connected to the HR account. It has been connected for 3 days, but after that I was getting this error when I tried to connect through SQL Developer:
TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
Make sure that
Your DB is started up ;
$ sqlplus / as sysdba
SQL> startup
ORACLE_SID parameter is set to a path value;
on Windows, look-up by :
C:\Users\pc> echo %ORACLE_SID%
mydb
on Unix, look-up by :
$ echo $ORACLE_SID
mydb
and Listener is running :
$ lsnrctl status
LSNRCTL for Linux : Version 12.1.0.2.0 - Production on 03-JUN-2018 09:31:07
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 30-MAR-2018 22:29:45
Uptime 53 days 11 hr. 1 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/12.1.0.2/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/mydb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.15.81)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mycompany.com)(PORT=5505))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=mycompany.com)(PORT=5506))
(Security=(my_wallet_directory=/u01/app/oracle/product/12.1.0.2/dbhome_1/admin/mydb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Instance "mydb", status READY, has 1 handler(s) for this service...
The command completed successfully
You should try the following ways and one of them may work for you.
Way-1: In windows: use this video: restart services OracleOraDB19Home1TNSListener then OracleServiceORCL.
Way-2: connect with system user password to sql plus as shown as:
Enter user-name: system/ as sysdba
Enter password: your_password
SQL> shutdown
SQL> startup nomount
SQL> alter system set db_recovery_file_dest_size=4G scope=both;
SQL> alter database mount;
SQL> alter database open;
And now check your problem fixed? If no set below code then check again.
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=127.0.0.1) (PORT=1521)))';
This work for me.

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor while connecting as JDBC remote client

I have gone through all the suggestions given by many of you for this query. But unfortunately none of them has fixed my issue.
Problem:- I have installed Oracle12c into a our remote machine(Host1) and by default ORCL database has created and running. After that by using Database configuration Assistant I have created new database "YILIDB". I can connect to these databases from Host1 through sqldeveloper tool. But when I'm trying to access the above databases from another machine (Host2) I can't connect to it. First I tried by using JDBC code to connect to that data base. I got the below Exception.
Code:-
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:172.26.8.188:1521:YILIDB", "WM6",
"WM6");
Error:-
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:825)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:755)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:38)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:599)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at ConnectionTest.main(ConnectionTest.java:39)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:324)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:287)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1963)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:564)
... 6 more
And when I'm trying to connect from Host2 sqldeveloper to Host1 database I got below error which means basically I can't connect to remote database neither with JDBC code nor using sqldeveloper.
Error while I'm trying to connect from sqldeveloper:-
Status: Test-failed: IO error the network adapter could not establish the connection
And In the remote database machine I have verified services. Both ORCL and YILIDB services are running. I see only one listener in services up and running.
Can someone please provide me the solution for this.
Find the status of >lsnrctl status below
C:\Users\Administrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 12.1.0.1.0 - Production on 25-OCT-2016 14:14:41
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.1.0.1.0 - Production
Start Date 25-OCT-2016 14:04:56
Uptime 0 days 0 hr. 9 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service YILIDB
Listener Parameter File C:\app\Administrator\product\12.1.0\dbhome_1\network\admin\listener.ora
Listener Log File C:\app\Administrator\diag\tnslsnr\SMYB2SW12-Yili\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.28.8.199)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
The problem has been fixed by changing the jdbc url with #.
Previously:
jdbc:oracle:thin:123.45.6.78:1521:YILIDB
Now:
jdbc:oracle:thin:#123.45.6.78:1521:YILIDB

404 not found error is being displayed after entering the credentials in Oracle Enterprise manager in Enterprise Manager

OS: Red Hat Linux.
Oracle: 10g
After entering the credentials in the Oracle Enterprise manager, the following error is displayed 404 Not Found
And after checking the listener status, the following result is shown:
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 13-DEC-2013 11:32:21
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 13-DEC-2013 11:32:12
Uptime 0 days 0 hr. 0 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
How to resolve this problem so as to run Oracle Enterprise manager?

ORA-12514 after rebooting server

I am using Oracle 10g R2.
Recently, after rebooting the server, I started having a problem where I couldn't connect to the instance. I am only connecting locally on the server itself.
Oddly enough, the issue corrects itself if I start the Database Administration Assistant, and select my instance to supposedly change its settings.
Does anybody have a clue on the roots of this problem?
#akaDruid: I am testing my connection simply by trying to start SQLPlus on the server.
#Matthew: It's Windows
EDIT: I don't think I read your question properly: The listener should not affect connections on the local machine, so you can probably ignore the rest of the answer, unless it gives you a hint! How were you testing your connection? Was ORA-12514 the only error?
(I'm assuming you're on Windows here)
I guess the listener is not starting automatically when you reboot the server, and it's getting starting in oracle administration assistant - I don't use that tool unfortunately so couldn't say.
Next time you reboot, before starting oracle administration assistant, open a command prompt and type lsnrctl status. If the listener has not yet started you will get something like this:
C:\Documents and Settings\user>lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 27-OCT-2008 14:00:21
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC01)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
32-bit Windows Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server.domain.co.uk)
(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
32-bit Windows Error: 61: Unknown error
C:\Documents and Settings\user>lsnrctl status
if it is running, you will get something like this:
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 27-OCT-2008 14:03
:33
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC01)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 27-OCT-2008 14:03:27
Uptime 0 days 0 hr. 0 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
Listener Log File C:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC01ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server.domain.co.uk)(PORT=1521))
)
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "ORCL1" has 1 instance(s).
Instance "ORCL1", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
C:\Documents and Settings\user>
If the listener is not starting, check that service is set to automatic. If it is, check the listener.ora makes sense, see what output you get from lsnrctl start, etc.
Hope that helps, or at least sends you down the right path
You haven't specified if this is windows or unix?
I've seen similar issues on unix when ORACLE_HOME was defined slightly differently on the account which starts up oracle, and on connecting accounts, one account had ORACLE_HOME=/usr/oracle , the other had ORACLE_HOME=/usr/oracle/ , the trailing slash messed things up.
How exactly are you staring up the server, do you have a script to do it, or are you connecting internally and issuing "startup"
again, if this is windows, I have no idea :)
I had the same error. Going to http://localhost:1158/em showed the listener was up, but the database instance was down.
Click the "Startup" button next to the instance to bring it back online (I think)
Another possible explanation:
http://www.orafaq.com/forum/t/66224/2/

Resources