ERROR: ORA-12545: Connect failed because target host or object does not exist - oracle

I followed this steps to install Oracle 19.6.0 for Ubuntu 18.04:
https://medium.com/#TechExpertise/installing-oracle-sql-developer-on-ubuntu-16-04-lts-bfa4af959deb
Then for some reason I was not able to open sqlplus, so I followed this steps as solution:
https://gist.github.com/tcnksm/7316877
And now I want to log in sqlplus by typing sqlplus / as sysdba, but I am getting:
ERROR: ORA-12545: Connect failed because target host or object does
not exist
So I think I have to make the appropriate settings in listener.ora and tnsnames.ora,
but I am missing this files.

SQL Developer and SQL*Plus are client only tools that connect to a database that must be running somewhere: either on the same host or on another host.
If this database exists you should have its connect string to connect to it with SQL Developer or SQL*Plus
If this database does not exist, you must first create it: there are several ways to do this in addition to install Oracle Database (server - not client) and to create a database:
install Oracle XE 18c on Oracle Linux or Windows: installation will install database software and create a database at the same time (easier for non database specialist)
use a pre-installed VM such as: https://www.oracle.com/database/technologies/databaseappdev-vm.html.

Related

Oracle XE 18c, on every connect attempt, Oracle listener OracleOraDB18Home1TNSListener stops, and I am unable to connect to any connection

For the purpose of learning, I have installed Oracle 18c XE v18.4.0.0 and Oracle SQL Developer v21.4.2. I have no previous experience with Oracle database.
Command LSNRCTL stat seems to show correct results:
LSNRCTL stat output
I am trying to connect to XEPDB1 Plugin database by using sqlplus command:
sqlplus system/oracle#192.168.1.102:1521/XEPDB1
(192.168.1.102 is my local IP)
but everytime I tried so, service OracleOraDB18Home1TNSListener (and listener also) stops.
Then I start it again manually and try again to connect to XEPDB1 but the same thing happen again.
Respond to connection command after few minutes is: ERROR: ORA-12537: TNS:connection closed.
Files listener.ora and tnsnames.ora are not modified after fresh installation of Oracle 18c XE.
Much appreciate if anybody can help me.

Connect to Oracle 19C Cloud from sqlplus

I am not able to connect to my Oracle 19C Cloud DB, I have downloaded the wallet and placed it in a secured place in my machine(windows).
I have installed Oracle 19C Client in my machine,
and updated tnsnames.ora(network/admin) with connection strings from wallet zip,
Not sure how whether I have missed any config like Environment variables
Getting below error from sqlplus
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Note: I am able to connect to Cloud from Sql developer using the wallet file.
And I have Oracle 18c XE running in my machine.
Any help will be appreciated, thanks in advance.
Your problem seems to be related with the issue that you have an Oracle XE database version installed in your own laptop.
When you run sqlplus or any other OCI tool to connect to Oracle, no matter whether the database is a remote host or in the cloud, sqlplus evaluates the TNS_ADMIN environment variable to identify where your sqlnet and tnsnames files are located. If there is no variable, it uses the default values of your main Oracle registry entries, that for sure point to your XE version, as it was installed before.
When you get ORA-12154: TNS:could not resolve the connect identifier specified , your session is not finding any information regarding the target in your configuration files, probably because the session is evaluating the files in your XE installation
Try to do the following
Copy the wallet files provided by your Oracle Cloud to a location different to your XE installation.
Export the TNS_ADMIN variable in your sqlplus cmd session to this new path
Run sqlplus using wallet
Example ( I believe you did points 1 and 2 )
Install Oracle Client software on your computer. Use either the full
Oracle Database Client 11.2.0.4 (or higher) or the Oracle Instant
Client 12.1.0.2 (or higher). The Instant Client contains the minimal
software needed to make an Oracle Call Interface connection. The
Instant Client 12.1.0.2 (or higher) is sufficient for most
applications.
Download client credentials and store the file in a secure folder on
your client computer. See Download Client Credentials (Wallets).
Unzip/uncompress the credentials file into a secure folder on your client computer.
Edit the sqlnet.ora file in the folder where you unzip the
credentials file, replacing "?/network/admin" with the name of the
folder containing the client credentials.
Example
WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/my_new_path")))
SSL_SERVER_DN_MATCH=yes
cmd> set tns_admin = my_new_path
cmd> sqlplus /#yourtnsentry
I don't know whether your cloud database is using a Public IP address or not, or if you want to use SSH tunneling to connect to the database. Take a look here, because then you might want to use SQLcl ( Sql Developer Command Line )
https://docs.cloud.oracle.com/en-us/iaas/Content/Database/Tasks/connectingDB.htm

Oracle 11g XE - Can't login and database is down

Just installed Oracle 11g XE (Windows), but can't connect in SQL Developer or run any command in CLI.
When try to connect in CLI using SYS or SYSTEM with password defined during the install, get the following error:
ORA-12638: credential retrieval failed
When I tray to connect via SQL Developer (tried via SID and Service Name, hostname=localhost, port=1521, SID=xe), get this error:
Status : Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in
connect descriptor
Already tried change SQLNET.AUTHENTICATION_SERVICES = (NTS) to (NONE) in sqlnet.ora file. When I do this, get the following error when try to connect with the SYS or SYSTEM user and password:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Already tried every solution in Google results, like reinstall, stop and start services... Mostly ask for first connect in CLI to make some changes, but even this I can't accomplish.
Any suggestions on how connect to the database?
Found the solution:
I was installing in my company Windows user domain.
First uninstall any instance of Oracle XE 11g.
Switch to a local administrator Windows user and install Oracle XE 11g.
Sign off and back to company Windows user.
Edit the file C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\sqlnet.ora (or equivalent to your installation path). Change SQLNET.AUTHENTICATION_SERVICES = (TNS) to SQLNET.AUTHENTICATION_SERVICES = (NONE).
This change will allow you connect to database from you company Windows user.
As seen here: Error ORA-12638 in Oracle Database 11g
Try the following: Open command window, cd to Oracle bin directory, enter sqlplus /nolog. If you get a prompt enter connect / as sysdba. If you get connected then you can try "startup".
- -
Did you try to start the Oracle RDBMS service via Services (services.msc)?
Do you use an spfile? Check the registry for ORA_SID_NAME_PFILE that is different from default location of $ORACLE_HOME/dbs. Also check the default location. Use only the default location or the registry entry removing either the registry entry or the file in the default location depending on which you want to use.

"ORA-12154:TNS:could not resolve the connect identifier specified" on Mac in SQL Developer

Connecting through Oracle SQL Developer(version 18.2.0.183) using wallet files(cwallet.sso and ewallet.p12) we are getting the following error “ORA-12154:TNS:could not resolve the connect identifier specified “when we test the connection via Advanced connection type in SQL Developer. We are using “jdbc:oracle:oci:/#NAME”. We are able to connect using SQLPLUS using “sqlplus /#NAME”. This is on a Mac(High Sierra) with the Instant Client Version 12.2.0.1.0.
https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
We have the TNSNAMES.ora and SQLNET.ora files configured and the wallet is set and working fine with SQLPLUS.
Is there anything we should look at to troubleshoot this further? Or any workarounds you might suggest?
Thanks,
Tom
Same advice I gave on the OTN forums -
make sure SQL Developer is reading the TNSNAMES file you think it is.
show tns
connect hr/oracle#orcl -- execute in a sqlworksheet with F5
TNS Lookup locations
--------------------
1. USER Home dir
C:\Users\jdsmith
Location used:
-------------
C:\Users\jdsmith
Available TNS Entries
---------------------
LISTENER_ORCL12C
ORCL
ORCL12C
Connected.
Connection created by CONNECT script command disconnected
If that fails, try EZCONNECT syntax
connect hr/oracle#server:port/SID
Also, there is a TNS connection type you can use. If OCI is enabled in preferences, your connection will be 'thick' and use sqlnet and tnsnames ora files.

How to connect to newly installed Oracle XE instance?

I have installed Oracle XE on Win7 x64 machine. Installation completed successfully without problem, or perhaps installer didn't tell about them. But after installation I can't connect to database; its web interface is not working. I have looked through list of open ports, and there is no 8080 port as was noted during installation. Also I can't connect via SQLPlus.
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-12638: Credential retrieval failed
Somewhere in the web it was told to edit sqlnet.ora file, I have changed it in the following way:
# SQLNET.AUTHENTICATION_SERVICES = (NTS)
SQLNET.AUTHENTICATION_SERVICES = (NONE)
and now I get next error
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
What do I need to change so that I can connect to it?
I figured out the issue.
I was using domain login to install Oracle XE. If you are using domain login to install Oracle XE then the database creation will fail (though you may not get any error messages on that regard).
Solution:
Install Oracle using a local admin user.
Change SQLNET.AUTHENTICATION_SERVICES to (NONE) in sqlnet.ora.
Now login with your domain user to use oracle XE.
Check the Oracle services are started
Did you set your ORACLE_SID environment variable to the name of the instance you're connecting to?
Make sure oracle service is started.
did to ran netca after installation? - if not you can ran it from cmd
You can't connect using system if the instacne is down only as sysdba (user sys)
Make sure your ORACLE_HOME,ORACLE_SID,PATH environment variables are ok
If everything was ok then you can try to start/connect to the instance manually
Sample:
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>sqlplus "sys as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 11 16:21:42
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 360710608 bytes
Database Buffers 167772160 bytes
Redo Buffers 5804032 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL>select status from v$instance;
As Rejeev Divakaran said, installing oracle XE with local windows user, and switching back to domain user account, started db, able to connect.
Config
Office Laptop
Windows 7 64 Bit
Oracle 11g XE
Can you connect this way from the command line:
sqlplus / as sysdba
if so at the SQL prompt enter
SQL>startup
If the command returns ok then try to connect with a username and password.
This error message usually occurs when the database could not be started. The windows service may be running, but still Oracle might not be able to spawn server threads and hand out client connections.
Have a Look into app\oracle\admin\xe\bdump\alert_xe.log for any error messages during the last start of the Oracle service.
Just in case someone is as "lucky" as me: I recently couldn't install Oracle with a local user (as suggested here before) because the target machine (Win2k8 x64) was also the Domain Controller of that network.
All users were in domain - no local users available :(
Here are the steps I performed:
Installed Oracle XE in my local machine (that works fine). Made a backup (using the built-in backup.bat);
Transferred the fast_recovery_area folder to my target machine;
Installed the Oracle XE in the target machine normally;
Edited the %ORA_HOME%\network\admin\sqlnet.ora file and performed this well-known edit:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
Edited the %ORA_HOME%\bin\restore.bat file:
Replaced every entry rman target / (...) by rman target sys/MySysDbaPass (...)
Replaced every entry (...) connect / as sysdba^; by (...) connect sys/MySysDbaPass as sysdba^;
Runned restore.bat - when prompted, pointed to the fast_recovery_area I've transferred before.
Done! (pheew!)
Sorry for answering this YEARS old question, but I managed to make it work...
Make sqlnet.ora change.
Run StopDB.bat
Run MakeDB.bat
This will create a demo database, reset the password to 'oracle', and will also allow you to connect without error.

Resources