How to run two oracle instances in oracle 10g - oracle

My Oracle have two instances(2 sid). From that, I can connect to one(A) instance via toad using service name. But another instance(B) is not connecting.
When I am trying to connect that instance, It is showing error like
ORA-01034: ORACLE not available
I have noticed, my ORACLE_SID is pointing to A instance. I wanted two (A&B) instances available.
Please suggest what are the changes required. Actually Oracle installed in Linux.

Can you check your tnsname.ora file has two instance like below..
A =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = A)
)
)
B =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = B)
)
)

Suggested steps to try and tackle the problem -
1. Perform the test Balakumar Subramanian suggested to make sure your tnsnames is configured probably.
2. step 1 doesn't fix the problem, try connecting to the database from within the server by connecting as the user used to install oracle (usually oracle), setting the environment variable ORACLE_SID as the sid of instance B and connecting with the "sqlplus / as sysdba" command.
This should allow you to connect even if the instance is down, and then you can mount and open it from within sqlplus.
3. If connecting as sysdba also fails, than you should check if a service dedicated to instance B exist. If not, you're instance is not installed probably and should probably start from the top and re-install it.
Best of luck.

Related

How to open oracle ORA file on DataGrip 2022 on windows 11?

I have an .ora file that I want to open on DataGrip 2022.1.2 installed on windows 11.
I installed Oracle 21c XE, and went with (Connect to Oracle with OCI).
Everything worked okay to the point of creating the tnsnames.ora file. But, I didn't understand the alias and the address I need to fill in, in order to open the .ora file.
What do I do next to open this file?
Edit:
In what folder do i paste the ora file? What do i write in HOST? What do I write in Service Name?
tnsnames.ora is just a text file. You can create or open it with any text editor. As in the example tnsnames.ora file in your link, the content should look something like this (replace example values with your hostname or IP address, port, service_name, etc.):
MyTNSAlias =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db.my.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = my_service.my.domain.com)
)
)
The "alias" is the label MyTNSAlias on the left of the equals sign. It can be almost anything, but must be unique within the file and is not case sensitive.
The "address" is everything to the right of the equals sign:
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db.my.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = my_service.my.domain.com)
)
)
From the link you included:
In the directory that you created on Step 1, create the network directory. Inside the network directory, create the admin directory.
The overall path should look as follows:
~/Oracle/instantclient_19_8/network/admin.
In the admin directory, create the tnsnames.ora file with the following structure:...
tnsnames.ora files can generally be found in the $ORACLE_HOME/network/admin directory. If Oracle 19c XE is installed, then there's probably already a tnsnames.ora file in that directory tree. If you're using Oracle Instant Client, then you'd need to copy the tnsnames.ora to that ORACLE_HOME directory tree.
For Oracle 21c XE connection, see the documentation: https://docs.oracle.com/en/database/oracle/oracle-database/21/xeinl/connecting-oracle-database-xeinl.html
HOST is the DNS resolvable hostname or IP address of your database server (wherever you installed the database). You can check the database listener to see what address it is using with the lsnrctl status command, and list system IP addresses with the ipconfig (Windows) or ifconfig (Linux) commands. If it is on the same machine you want to connect from, you can also say localhost or 127.0.0.1 in your connection address. The default PORT for Oracle is always 1521. The default SERVICE_NAME is XE for the container database (CDB) and XEPDB1 for the pluggable database. For example:
xepdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xepdb1)
)
)
The DataGrid doc page "Step 3. Configuring ORA files" told you to put the tnsnames.ora into ~/Oracle/instantclient_19_8/network/admin.
The part ~/Oracle/instantclient_19_8 is called the Oracle Home, roughly means the installation location of the Oracle software. The default location of of tnsnames.ora is %ORACLE_HOME%\network\admin on Windows, and it should be something like C:\app\oracle\product\21.1.0\xe (according to convention of older XE release). The Oracle software installer should configure the environment variable %ORACLE_HOME% for you.
The DataGrid doc page also includes a sample TNS entry:
MyTNSAlias =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db.my.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = my_service.my.domain.com)
)
)
You can put HOST = localhost or the actual hostname or the IP address. For XE, use SERVICE_NAME = xe.

how do i set up oracle instant client on ubuntu 18.04?

so I'm trying to monitor oracle database by ODBC on zabbix, but my zabbix server is ubuntu 18.04 and I really confused because oracle is using rpm.
i do this step by step to configure oracle instant client:
https://sudonull.com/post/110401-Monitoring-Oracle-Database-through-ODBC-in-Zabbix
but while im trying to install sqlplus I got confused because of tnsnames.ora,
on tutorial he said to create a connection to the database with the name TESTDB for example, it's look like this:
TESTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oratestdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testdb)
)
)
so I made it exactly look like above, I do config /etc/hosts too but it got this error "TNS NO LISTENER" while trying to connect sqlplus.
I try to start lsnrctl but apparently it doesn't have lsnrctl.service
my question is,
is it "TESTDB" something that i just made up or it should be the name of database on oracle database?
when you finally try login in "sqlplus example/example#example" is it using user and password from oracle database that you have?
is it "TESTDB" something that i just made up or it should be the name
of database on oracle database?
Taking your own example
TESTDB = -- you can give any name of your wish here
(DESCRIPTION =
(ADDRESS = -- following 3 fields are details of DB server
(PROTOCOL = TCP)
(HOST = oratestdb)
(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testdb) -- This is the service name of the DB on given server
)
)
when you finally try login in "sqlplus example/example#example" is it
using user and password from oracle database that you have?
Yes this is the password of oracle DB user
sqlplus scott/tiger#TESTDB

Need Help To Resolve ORA-12154

I installed Oracle 12cR2.
Everything is fine.
Connected as SYS, Successful.
Now, what I did is changed my Container DB i.e. CDB$ROOT to ORCLPDB (Using Alter Session). And Created a User Called demo with password. Granted necessary permissions. Successful.
In that same session, I tried to connect to demo User, but unable to connect to it.
Error Shows as Follow:
ORA-12154: TNS:could not resolve the connect identifier specified.
How can I resolve this issue?
(Note: The user is in PDB)
tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SID = orcl)
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
you are trying to connect to Demo/Password#ORCLPDB
there is no alias ORCLPDB in your tnsnames.ora, so Oracle complains that it can't find it
therefore:
connect to Demo/Password#ORCL (as you have ORCL in tnsnames.ora), or
modify the file and
add the new database alias (ORCLPDB) if it is a different database, or
add yet another alias for the same database, e.g. ORCL, ORCLPDB = ...

Two Oracle TNS Listener

When I want to connect to my database in SQLDeveloper i get a TNS listener error message.
When I stop the OracleOraClient11g_home1_32bitTNSListener in my Services and retry to connect it works fine. Then the OracleXETnsListener is running.
How can I avoid stopping the one listener that the other can start?
I've two listener.ora files where Port 1521 is configured. So I assume it has to do with the ports?
On any operating system, you are not allowed to have 2 processes listening on the same port (in this case 1521) on the same network inteface (I'm going to assume you have only 1 network interface). Otherwise how would the operating system know which process to hand the port connection over to!
As Alex has mentioned you do not need to run multiple listeners. Disable one of the services and edit the listener.ora which points to the correct service - by default this is under the oracle_home/network/admin directory but if you have changed the TNS_ADMIN variable value on the system it will be there. You can add another listener for the SID/Service Name if you wish, but in the case of Windows it will automatically pick up all the Instances running on the system.
Just in case you really do want to run 2 listeners (you would only need to do this if you have a very old RDBMS version for example) you can edit one of the listener.ora files and change the port to say 1522. An example is below:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ROBS)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
You then change the tnsnames.ora for the connect to point to that port like this:
SCN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ROBS)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SCN)
)
)
Or with SQLDeveloper you can change the port directly on the IDE with the TNS direct option if that's how you have it configured.

not able to starting OracleXNTNSListener in windows environment

I have installed oracleXE in my local meachine.
I have changed the services of Oracle level Automatic to Manual.
Know when i start the Oracle Services all are getting started except the OracleXNTNSListener service.
It saying some times below mentioned 1 error or 2 error
1>Windows could not start OracleXETNSListner service on Local Computer.
Error 1067:The process terminated unexpectedly.
OR
2>The OracleXNTNSListener service on Local Computer startred and then stopped.Some services stop automatically if they are not in use by other services or programs.
After some trials the listener got started.
What I did is for this, I have edited the listener.ora file.
In this line intialy HOST = hostname was there, I changed that to localhost ip i.e 127.0.0.1
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
I know its a very old thread but, changing 127.0.0.1 to localhost in both listener.ora and tnsnames.ora helped me.
My listener.ora file was like this
(ADDRESS = (PROTOCOL = TCP)(HOST = my_computer_name)(PORT = 1521))
I changed to
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
and then it worked.
I face this problem, because I have installed Oracle 12c previous, then I try to install Oracle 11g express.
Check this registry key to ensure ORACLE_HOME is configured for the service:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORACLE_HOME
If that doesn't exist, check here:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_XE\ORACLE_HOME
Also make sure this other key isn't pointing to your old client registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORACLE_HOME_KEY
or
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_XE\ORACLE_HOME_KEY
Check if the system variable ORACLE_HOME is set to C:\oraclexe\app\oracle\product\11.2.0\server (or similar).
this might be caused because you changed your PC-NAME. Make sure in "listener.ora" file HOST = PC-NAME (eg: admin-PC).

Resources