Oracle Database service running but cannot connect - oracle

I am having the following trouble. I have created three different database schemas in my laptop, each has a different service.
I activate and deactivate the service that I want to use each time. But I have been facing a problem after I created the third schema.
Task Manager - Services
When I activate the OracleServiceIANBG I am able to connect properly through SQL developer in that instance. When I deactivate it and activate one of the other two instances, the corresponding connections in the SQL developer that I have created are giving me the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
SQL Developer snapshot
Can someone explain why this is happening and how I can troubleshoot it?

On your cmd line check lsnrctl and see what services are running.
>lsnrctl status
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 13-NOV-2018 14:15:59
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Start Date 13-NOV-2018 14:15:36
Uptime 0 days 0 hr. 0 min. 23 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/18c/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/c132613c345e/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "64a52f53a7683286e053cda9e80aed76" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "758e766d38d80b9de053020011acb4c6" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
If the expected services are not listed, they can be registered with an alter system register command.
sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Tue Nov 13 14:17:28 2018
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
SQL> alter system register;
System altered.
SQL>

just enter the ./sqlplus command.
it should prompt for username:
username: "sys as sysdba" use this entire phrase
password: {password during installation}
then it should connect
but if you want to connect to the instance: like oraclxdba
you should use an external SQL management tool right? then you can just specify the SID you want to connect to with the same username and password

Related

Can't log into Oracle DB 19c on command line - SQL Developer is fine

I can't log into Oracle 19c DB on the command line. This is the error I get:
PS C:\Windows\system32> sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 19 16:35:55 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12560: TNS:protocol adapter error
Enter user-name:
If I check the status of the listener it looks like it's running to me (unless I'm mistaken):
PS C:\Windows\system32> lsnrctl status LISTENER1
LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 19-NOV-2021 16:37:29
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DESKTOP-0T5DL1G)(PORT=1555)))
STATUS of the LISTENER
------------------------
Alias LISTENER1
Version TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date 19-NOV-2021 16:07:28
Uptime 0 days 0 hr. 30 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File D:\Oracle_1\instantclient\network\admin\listener.ora
Listener Log File D:\Oracle_1\app09\oracle\base\diag\tnslsnr\DESKTOP-0T5DL1G\listener1\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DESKTOP-0T5DL1G)(PORT=1555)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1555ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DESKTOP-0T5DL1G)(PORT=5500))(Security=(my_wallet_directory=D:\ORACLE_1\APP09\ORACLE\BASE\admin\aws\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "52448234712340b69f274bcc790ecfe0.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
Service "5f0fbe5bc87148669145f9e2458c91b2.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "aws.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
Service "pdb1.company.com" has 1 instance(s).
Instance "aws", status READY, has 2 handler(s) for this service...
The command completed successfully
Yet, I can log in with SQL Developer and run queries:
If I try to start the service it says that it's already been started:
PS C:\Users\bluet> net start OracleServiceAWS
The requested service has already been started.
More help is available by typing NET HELPMSG 2182.
I'm really curious as to why I can't log in on the command line and in Oracle SQL developer it's fine! I'd like to correct this so I can log in again on the command line.
Looks like you have to specify the container you're connecting to. For example:
sqlplus sys/its_password#pdb as sysdba
----
this is your pluggable database

Startup nomount - oracle 10 centos linux

i got problem with starting up instance oracle 10.2.0.1 on Centos OS
im login on root
su - oracle
export $ORACLE_HOME
export $ORACLE_SID
login on sqlplus / as sysdba
{SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 13 08:09:23 2019
Connected to an idle instance.}
startup nomount
and have ORA
ORA-00600: internal error code, arguments: [keltnfy-ldmInit], [46], [1], [], [], [], [], []
i have created initXE.ora
lstrctl status:
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 13-MAY-2019 08:04:40
Uptime 0 days 0 hr. 15 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
Listener Log File /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.29)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
Instance "XE", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
initXE.ora:
DB_NAME=XE
DB_BLOCK_SIZE=8192
CONTROL_FILES=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/dbs/control1.ora
UNDO_TABLESPACE=undotbs
UNDO_MANAGEMENT=AUTO
SGA_TARGET=500M
PGA_AGGREGATE_TARGET=100M
LOG_BUFFER=5242880
DB_RECOVERY_FILE_DEST=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/dbs
DB_RECOVERY_FILE_DEST_SIZE=2G
ADR_BASE=/wysheid/diag
ora-600 errors are internal errors. They usually tell you that you should contact the Oracle support (if you have an MOS account). On MOS you could lookup the error arguments, but this lookup not always returns a result. Without MOS access the situation could get less comfortable, since Oracle 10.2.0.1 is far beyond support.
But in the given case, you could be lucky, since http://amit7oracledba.blogspot.com/2013/07/ora-00600-internal-error-code-arguments.html claims that the error results from a mismatch in naming resolution and could be fixed with a change in /etc/hosts.

Cannot connect to oracle pluggable database

Iinstalled oracle in my Windows 10 64 bit pc and I started doing verification steps mentioned in the tutorial which's given in the oracle website which can be found in the link below.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/Windows_DB_Install_OBE/Installing_Oracle_Db12c_Windows.html
When I try to connect to my pluggable database using this command
C:\Users\Chathura>sqlplus sys/Oracle_1#orclpdb as sysdba;
it gives me following message
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 30 19:34:25 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
But when I try to connect to container database it connects successfully.
This is how I created pluggable database.
I read articles regarding this tried adding TNS_ADMIN system variable too, but non of those worked.
What I am doing wrong here?
You have to use the service name for your pluggable, you can't use the SID..that's only going to work for the container.
So find out the service name
[oracle#vbgeneric ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 30-JAN-2018 10:05:02
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 25-JAN-2018 12:14:50
Uptime 4 days 21 hr. 50 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service orcl12c
Listener Parameter File /u01/app/oracle/product/12.2/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/vbgeneric/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vbgeneric)(PORT=8081))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "49b6c41a4c152576e0530100007feda7" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "4bb765ec28ff1109e0530100007f49e5" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "app_con" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "orcl12c" has 2 instance(s).
Instance "orcl12c", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl12c", status READY, has 1 handler(s) for this service...
Service "orcl12cXDB" has 1 instance(s).
Instance "orcl12c", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle#vbgeneric ~]$
Then connect, use #servicename vs #SID
in my case that's #orcl
Or connect to your container, then switch over to your PDB
oracle#vbgeneric oracle]$ sqlplus sys/oracle#orcl12c as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 30 10:09:28 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> ALTER SESSION SET container = orcl;
Session altered.
SQL>
Tim talks about this here.
connect to your database ( pluggable database) and make thing configuration
`
startup mount;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
`
and also that
`
update sys.props$ set VALUE$='WE8MSWIN1252' where NAME='NLS_CHARACTERSET';
commit;
shutdown immediate;
startup;
`
after that just check your tnsnames.ora`enter code here`
WINDOWS 10:
Don't know if this is exactly your problem, but I got one very similar. After creating new users to PDB, I couldn't connect to Database. Here is what I did (don't know if you need all of this, but it worked for me).
Try this options on SQL Dev Connection:
connection
On $ORACLE_HOME/network/admin add:
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
On network/admin/sqlnet.ora file add:
SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8

how to create TNS connection with SID "orcl" in apex listener

I almost finished to install the experimental Oracle Apex Listener. But during final installing step i got a problem: TNS name with SID with name "orcl" does not exist and it wasn't in the file "tnsnames.ora" among the others TNS names.
For beginning i tried to input SID characteristics for name "orcl" in the "tnsnames.ora" over notepad++ manually , but it's not helped (link to picture is below):
ORA-12505
2. Later i tried to input the data for SID "orcl" and open access to this over command prompt:
C:\oraclexe\app\oracle\product\11.2.0\server\apex>sqlplus sys as sysdba
Enter password:
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)
PORT=1521))' scope = both;
System altered.
SQL> alter system register;
System altered.
C:\oraclexe\app\oracle\product\11.2.0\server\apex>lsnrctl stat
LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 29-JUN-2016 21:28
:13
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Produ
ction
Start Date 29-JUN-2016 20:37:36
Uptime 0 days 0 hr. 50 min. 37 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\oraclexe\app\oracle\product\11.2.0\server\network\a
dmin\listener.ora
Listener Log File C:\oraclexe\app\oracle\diag\tnslsnr\MrPloomipuu\listen
er\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MrPloomipuu)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MrPloomipuu)(PORT=8025))(Presentatio
n=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", 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...
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully
And all the same can't create SID with name 'orcl' and install TNS connecton with apex listener over that SID. What me to do here ?

How to obtain the list of Oracle's SIDs

I have the host, port, user id and password but missing SID for connecting to Oracle DBMS. How can I find the list of SIDs on that server?
A better way is, if you have access to the host machine and the Oracle install is to use the command: lsnrctl status. This works on both Unix, Linux, and Windows machines. The status command will show you all the listeners (and their associated SIDs).
C:\>lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 15-JUN-2009 16:16:34
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 13-JUN-2009 12:04:14
Uptime 2 days 4 hr. 12 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\oracle\XE\app\oracle\product\10.2.0\server\network\admin\listener.ora
Listener Log File C:\oracle\XE\app\oracle\product\10.2.0\server\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC_FOR_XEipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ThinkpadT61)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", 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...
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "XE_XPT" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully
In the above example you can connect to the XE database using the Conect Strings XEXDB, XE_XPT or XE.
The short answer is that you need access to the host OS:
For Unix, ps -ef | grep pmon will show you one or more processes with names like ora_pmon_xxxx, and xxxx is the instance name.
In Windows I guess there is a similar signature in the task list.
In practice, this information is usually given to you by whoever administers the database when your connecting account is created.
The question comes down to : which ORACLE_SID's or services are supported by the listener that is running on host X port Y. Depending on how secure this listener is configured you can see this using the lsnrctl command from a client that has lsnrctl installed. To be able to do this you do need an oracle server installation on that client. When you have that you can issue
lsnrctl
set current_listener (description=(address=(host=X)(port=Y)(protocol=tcp)))
status
The default setting of the 10g listener fill cause the following result:
TNS-01189: The listener could not authenticate the user
This is because from 10g oracle default has
Security ON: Local OS Authentication
meaning that only the local OS user that started the listener can issue lsnrctl commands to the listener. The listener will refuse to answer any other user.
Another option to consider is the file /etc/oratab on Unix or its equivilent on Windows, which I think is a registry hive.
The oratab should list all SIDs on a host, whether currently running or not.
There is an nmap script that maybe could help, oracle-sid-brute:
http://nmap.org/nsedoc/scripts/oracle-sid-brute.html
It was installed with nmap on my system.
nmap --script oracle-sid-brute -p 1521-1560 [host]
This would only help if the SID can be matched in a list. The default list is here:
http://www.red-database-security.com/scripts/sid.txt

Resources