Need your advise on the below:
Recently we migrated to Oracle client 19c from Oracle 11g through script on the windows server.
The script has wiped the previous Environment variable path for oracle 11g and replaced with 19c which is good.
The set up is such that, When I tried to connect to the DB, it first checks the environmental variable and then establishes the DB connection.
Sample Script:
set ora
set tns
pause
tnsping GENPF_dev_connect
sqlplus
The respective output are
"set ora"
ORACLE_Home=F:\GENPF\Oracle\product\19.0.0\client_32
Note: This path is correctly set
"set tns"
TNS_ADMIN=C:\Oracle\product\11.2.0\Client_1\Network\Admin\
TNS_NAMES=F:\GENPF\Oracle\product\19.0.0\client_32\network\admin
Note: Not sure from where Oracle took the TNS_ADMIN path.
TNS_NAMES path is correctly set
tnsping GENPF_dev_connect
Used parameter files:
C:\Oracle\product\11.2.0\Client_1\Network\Admin\sqlnet.ora
The strange part on tnsping is, even after defining and retrieving the right TNS_NAMES, it only checks the path for TNS_ADMIN.
As a work around, I set the TNS_ADMIN with the right path under Environmental variable such as
TNS_ADMIN=F:\GENPF\Oracle\product\19.0.0\client_32\network\admin
Even after adding the above entry, Oracle seems to ignore the environment variable path added and always provides the old entry.
Please suggest where things are going wrong on this?
Related
On various UX environments I run some shellscripts to gather software version info and push it back to a central server. One script does this for Oracle.
On a 12.1.0.2.0 Oracle server (Solaris 11.2 system), the oracle owner account can sqlplus into the local Oracle service, after running oraenv with ORACLE_SID set & ORAENV_ASK=no
Either of these syntaxes works:
sqlplus oracle_ID/password
sqlplus oracle_ID/password#ORACLE_SID
However a non oracle owner account can only use the
sqlplus user_ID/password syntax to connect to the local oracle service!
sqlplus 'user_ID/password#"//hostname:1521/ORACLE_SID"' - syntax also works perfectly.
Attempting to use the following syntax is broken - the first is the one of interest (& works across all other Oracle database hosts for all instances):
sqlplus user_ID/password#ORACLE_SID - ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
sqlplus user_ID/password#"/ORACLE_SID" - ORA-12154: TNS:could not resolve the connect identifier specified
tnsping ORACLE_SID connects with the service OK.
ohost:~$ truss sqlplus user_ID/password#ORACLE_SID
truss: cannot trace set-id or unreadable object file: /apps/oracle/product/12.1.0.2/bin/sqlplus
It would be best to have one consistent syntax across all my servers for the data gathering script and I was curious why the change of UNIX id would cause this anomaly. Any ideas or ideas how to debug? Thx A.
Update: 15-Apr-2020 - After more GoogFu answer lies in which 'adapter' the user account uses to resolve the 'alias'.
oracle owner uses 'TNSNAMES' adapter whereas monitor account uses 'HOSTNAME' and the HOSTNAME method sends a null SERVICE_NAME field in the CONNECT_DATA. I haven't spotted why the oracle owner uses the TNSNAMES method, yet. I've looked through shell environment variables for both UNIX id's and the oraenv sets up all the ones that refer to the ORACLE_HOME okay. Can't see anything specifically TNS or 'net' related...
Easy when you know how. Seems a little weird to answer my own question...
Simply, the tnsnames.ora file was not world (other) readable. Hence non dba-group accounts had to fall back to the HOSTNAME resolution method.
That was a merry waste of 4 hours. It's not the first time an Oracle installation has had over(?) zealous permissions set on a config or shared object file, inside a 'server' installation, that a genuine client process requires. I haven't looked specifically but it doesn't seem to be filed as a bug with Oracle.
So I got connected to Oracle 11g in cmd as follows
However, when I type the same username and password in Oracle SQL Developer, it does not work. And I have uname and pwd, what goes in the connection name?
This what I got, when i entered a connection name and My uname and PWD
Oracle SQL Developer
Just give any string in your connection name, that is used for identify different connection in sql developer.
Like,
Connection name : Connection_1
username : system
password : yourpass
If you want to create another connection to another database or another schema then you have to give another name and by login you can directly access that particular schema.
Hope it will help.
I think the issue might be that SQL Developer uses a different tnsnames.ora file. The file can be set under:
Tools>Preferences>Database>Advanced
Choose the correct tnsnames directory there.
Depending on your developer version, you might also want to set the Oracle Client folder.
After that in your connection dialog choose TNS instead of BASIC. And pick the tnsalias name from the list from the file.
Let me know if that works.
I also faced the same issue and after trying series of steps came to this conclusion.
1)Make sure to follow the blog to install the DB and check the validation steps too :
https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/Windows_DB_Install_OBE/Installing_Oracle_Db12c_Windows.html
This blog makes sure that you are able to connect to SQL via CMD.
2) If you still face issue while connecting to SQL developer for the same configuration,check : Advanced system settings-->Environment variables-->system variables--> PATH
Make sure you have entry for the DB here.
Environment variable for DB
3) If above step is a success,check the tnsnames.ora and listener.ora files present in the location : dbhome_1\network\admin
These files should have a valid entry for the localhost and SID/service name.
Thanks,
Sandeep
The other day I got this annoying oracle error: ORA-12705: Cannot access NLS data files or invalid environment specified. Funny thing I wasn't trying to access NLS data files
There are two possible causes:
An attempt was made to issue an ALTER SESSION statement with an invalid NLS parameter or value.
The NLS_LANG environment variable contains an invalid language, territory, or character set.
Fix:
Unset the NLS_LANG environment variable
Windows - The NLS_LANG must be unset in the Windows registry (re-named is best). Look for the NLS_LANG subkey in the registry at \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, and rename it.
Linux/UNIX - Here you simply issue the Linux command "unset NLS_LANG"
I have Oracle 10g XE and Windows 7. I resolved this as follows:
Go to Control panel > Regional and language options > Format and set your language.
Follow this procedure to set the NLS_LANG environment variable for Oracle databases.
To set the NLS_LANG environment variable for Oracle databases
Determine the NLS_LANG value.
In the data warehouse database, run the command
SELECT * FROM V$NLS_PARAMETERS
Make a note of the NLS_LANG value, which is in the format [NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET].
For example: American_America.UTF8
For Windows:
Navigate to Control Panel > System and click the Advanced tab. Click Environment Variables.
In System variables section, click New.
In the Variable Name field, enter NLS_LANG.
In the Variable Value field, enter the NLS_LANG value that was returned in Step 1.
The format for the NLS_LANG value should be [NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET].
For example: American_America.UTF8.
For UNIX, set the variable as shown below:
setenv NLS_LANG
For example: setenv NLS_LANG American_America.UTF8.
If your data is 7-bit or 8-bit ASCII and the Informatica Server is running on UNIX, then set
NLS_LANG _.WE8ISO8859P1
CAUTION: Make sure you set the NLS_LANG variable correctly, as stated in this procedure, or your data will not display correctly.
Reboot the machine after creating the variable.
In my case, I was creating a database adapter in the oracle weblogic console, solve the problem by doing the following configuration.
Windows -> control panel -> region: 1. Change the format to English (United States) date format M / d / yy and 2. Change my address to the United States. Perform this configuration because my machine was configured with the Spanish language, then restart the computer and I worked without problems.
After addition of path in Environment variable of Oracle Instant client the Oracle SQLPLUSW goes to Oracle Instant client and for that client it required to set NLS LANG AS American_America.UTF8
You can also just set the NLS config in your oracle settings
In case if above solutions not helped, can try my solution. I just replaced my latest version of Ojdbc14.jar to an older version Ojdbc5.jar. It helped me to solve my issue.
I was trying to configure my Data Source on WebLogic 12c that was pointing to an 11g Database and I kept getting this error. I found out that WL 12c is not compatible with oracle 11g databases.
I know it is not related but I am sure someone else will find this useful.
After a long struggle of installing any Oracle XE on my windows XP I gave up and decided to create my database manually. The setup file provided by Oracle skips fast the Creation of Database services phase and completes. But OracleXEService does not get installed.
I've set evrything up, the directories, the service, Oracle_SID. All of them go normally. Then I connect to sqlplus, to an idle instance:
sqlplus /nolog
connect / as sysdba
then I type
spool create_script.log
and then finally when I enter
#C:\create_script.sql;
I get error stating Oracle is not available. I've checked the task manager, oracle.exe is there. I've restarted the OracleServiceXE. Nothing helps. Many say I should check if ORACLE_SID and ORACLE_HOME match. I wonder how should I know if they match or not?
You will need to post more information. What does your DB create script look like? Are you seeing any errors in the alert log or other logs on your server?
The ORACLE_HOME you specify for your service in your listener.ora file should match what your actual ORACLE_HOME path is set to.
I found out my servers, running Oracle 10g, were not initializing with the same NLS_SORT value when using the sqlplus binary.
Is there a way to set the default NLS_SESSION_PARAMETERS for every instance of sqlplus?
PS: The idea is not to do an ALTER SESSION at the beginning of every sql script.
the NLS parameters are specified by the client application. SQL*Plus on windows will have its parameters defined in the registry (same as the ORACLE_HOME where it is installed). On *nix systems the paremeters are defined as environment variable.
You can find additionnal information in the documentation.
Use an ON LOGON trigger to do the ALTER SESSION?
Then you can do it in one place and won't have have to change every client.