Not able to login by SSO in oracle database when i set TNS_ADMIN parameter - oracle

I have my single sign on activated on oracle database D1 and other oracle database D2 which has password login method. I don't want to use oracle home Tnsnames.ora file. I created my own tnsnames.ora and added the both the databases.
I set TNS_ADMIN as path under which I give path of location where I keep my tnsnames file.
I try to do sqlplus /#db1 in command prompt then it throws an error saying "invalid username /password"
But when I use sqlplus /#db1 before tsetting TNS_ADMIN parameter, it takes my local tns file (I guess) and login properly.
Now after setting TNS_ADMIN, if I try sqlplus user/pass#DB2 this works properly as DB2 is accessed using password and SSO isn't activated on this server.
Issue is SSO login in SQLplus doesn't work when I set my TNS_ADMIN parameter, tns entries are correct as I use the same db1 which was before activating SSO.
Do I need to add some parameter in sqlnet.ora located at my tnsnsames file to activate my SSO or any special setting DBA do to activate SSO on user and tns so that I can also do the same to use my tnsnames.ora file.
Scenario
cmd > sqlplus /#db1 --Logs successfully
cmd> set TNS_ADMIN=path/tns (my tnsnames.ora file location)
cmd > sqlplus /#db1 --Logs successfully --Fails to login
cmd > sqlplus user/pass#DB2 --Logs successfully
Note that my tnsnames.ora is not changed and is kept original with connection use for db1 when it was password login.
We use Kerberos for this SSO login for oracle sqlnet file in oracle home path, we have set some parameters related to Kerberos such as Kerberos_CC_NAME, Kerberos_CONF, Kerberos_CONF_MIT parameters. I used the same in my sqlnet file but it didnt works.

You have to specify location of your wallet in sqlnet.ora file, see Profile Parameters (sqlnet.ora)
In case of problems edit your sqlnet.ora file and add these lines
TNSPING.TRACE_DIRECTORY = path (location where you like to get trace file)
TNSPING.TRACE_LEVEL = user
The trace file should provide more information what is going wrong.

Related

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.

Default username and password for SQL*Plus in Ubuntu 14.04?

I followed the instructions mentioned to install SQL*Plus from Oracle Instant Client and How to Install SQLPlus.
SQL*Plus is successfully installed on my system but I cannot login and use it. There is a similar question here and here, but it is does not solve my problem.
On googling, most sources said that we enter a password upon installation, but I was neither prompted nor displayed any password. (I can attach terminal screen shots if it is required)
Is there any way I can login and start using SQL*Plus? Is there any default username or password?
I am stuck here: sqlplus username/password#//dbhost:1521/SID
I need a valid username and password. scott/tiger was of no help.
sqlplus / as sysdba gives this -> ERROR: ORA-12162: TNS:net service name is incorrectly specified and prompts me to enter username and password which I don't have.
I originally asked this question on AskUbuntu feeling its more appropriate there. If this question does not belong here, please comment and I will remove it.
EDIT:
I executed these statements after reading from here:
ORACLE_HOME=/u01/oracle; export ORACLE_HOME
ORACLE_SID=asdb; export ORACLE_SID
Now, On executing sqlplus / as sysdba I get the error message
ERROR: ORA-12545: Connect failed because target host or object does not exist
On executing sqlplus64 scott/tiger#//dbhost:1521/SID I get the error message
ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
It does not have anything to do with Ubuntu. When you enter sqlplus / as sysdba sqlplus tries to connect to the local database, which sid and oracle home should be specified by the environment variables ORACLE_SID and ORACLE_HOME. You, obviously, have not defined these variables.
All you need is to get the username, password, host name, where your database is located, port for the listener (the default port is 1521) and the Oracle SID. Then connect with sqlplus username/password#//dbhost:1521/SID. If you know the password for SYS user and have orapwSID file in the $ORACLE_HOME/dbs directory on the server side, you can connect with sys with the following command: sqlplus sys/password#//dbhost:1521/SID as sysdba.
moving everything into instant_client_11_* directory worked for me.

Why can I log in with SQL Developer but not with SQL*Plus?

I'm trying to connect to from SQL*Plus and get error ORA-12154, but I can connect from SQL Developer without any error. I can tnsping and also lsnrctl is okay and the listener is up and running.
I can connect as sys like sqlplus sys as sysdba which works fine; but with another user I do sqlplus username and when I type the password it gives me:
ORA-12154: TNS:could not resolve the connect identifier specified
SQL*Plus interprets an # symbol as the start of a TNS alias. If your password has that in it then it will be interpreted that way even if you are not trying to connect over SQL*Net, but with a local connection. So if you do:
sqlplus user/p#ssword
... then it will take just the p as the password, and the #ssword as the alias, so it will try to find a TNS alias of ssword in your tnsnames.ora file. Since that doesn't exist, you'll get the "ORA-12154: TNS:could not resolve the connect identifier specified" error.
That applies when you put your password in at the prompt too, so if you do:
sqlplus user
Enter password: p#ssword
you'll get the same thing. You can connect by enclosing the password in double-quotes:
sqlplus user
Enter password: "p#ssword"
but you can't do that with the unprompted version.
You're probably better off changing your password to something without that particular character if you want to be able to connect from SQL*Plus as well as from other clients that don't interpret TNS in the same way.
SQL Developer, for example, accepts the password and connection settings as separate fields; it isn't trying to parse the string you entered to identify its components, so it doesn't get confused. Even if you tell SQL Developer to connect using a TNS alias, it will use the tnsnames.ora value you select from its drop-down list, it won't try to take it from the user or password fields.
This one worked for me ( and was easier to implement from my behalf )
From : TNSPING OK but sqlplus gives ORA-12154?
Create an environment variable TNS_ADMIN that points to the directory where your tnsnames.ora file resides. Then try to connect with sqlplus.
TNS_ADMIN = D:\oracle\12.1.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
If that works, then my guess is you maybe installed the Oracle client software too, and when you run sqlplus, it looks for the tnsnames.ora file in your client home.
-- Instructions for Adding the Environment variable TNS_ADMIN in windows
Go to control panel / system
select Advanced system settings
Select "Advanced" tab, and the environment variable button is at the bottom.
create new variable TNS_ADMIN and give the path where the .ora files are stored. e.g. C:\app\oracle\product\11.2.0\client_1\network\admin

TNS:could not resolve the connect identifier

I am very new to this
I install oracle in Linux machine with orcl service
And created one mmsc user. If I am not login with mmsc user and try to connect sqlplus with the command, "sqlplus mmsc/mmsc" and "sqlplus mmsc/mmsc#orcl" Then listener is working for both the option.
But after login to mmsc user,
listener is working for "sqlplus mmsc/mmsc" but not working for "sqlplus mmsc/mmsc#orcl".
Please help me to solve this issue.
Thanks in Advance
Regards
Sankar
The problem is that the client does not find the tnsnames.ora file. The file is generally located in the directory $ORACLE_HOME/network/admin. To find the file it is the best to set the environment variable TNS_ADMIN to point to that directory. This of course requires that the mmsc user has read permissions in that directory.

Resources