How to obtain the list of Oracle's SIDs - oracle

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

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.

Oracle Database service running but cannot connect

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

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 ?

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