Showing posts with label ora. Show all posts
Showing posts with label ora. Show all posts

Monday

Invalid or Nonexistent Column Name – ORA 00904


There are multiple reasons which can lead to this common error code.
Below, there are some scenarios which can occur.




  • The column name entered is either missing or invalid.Enter a valid column name. A valid column name must begin with a letter, be less than or equal to 30 characters, and consist of only alphanumeric characters and the special characters $, _, and #. If it contains other characters, then it must be enclosed in double quotation marks. It may not be a reserved word.


  • If you are copying column definition from some other table’s DDL statement and if the selected  column is not the last one you will also copy comma, and if you put it as last column in your DDL statement you will see “ORA-00904: invalid identifier”because after comma Oracle expect another column declaration.


  • If you will see the error Schema Creation Failed: ORA-00904: invalid identifier. The reason is that your schema creation failed because AUDIT is a reserved word in Oracle 11g R2.+


  • Apart from table creation, you will see error “ORA-00904: invalid identifier” if you use wrong column name in INSERT statement or use a non-existent column name. Most of the time it happens because of typo, but some other time it could be due to parallel update e.g. someone changed the schema of table and renamed or dropped the column you are referring in INSERT query.

Wednesday

What are Listener.ora , Tnsnames.ora , sqlnet.ora files?

What is a Listener.ora File?

The information about this listener can be found in the listener.ora file.
This file is normally found in the $ORACLE_HOME/network/admin folder.
If the file is not here then you can search in /etc folder if you are on a unix server.

If you have RAC then you can find the name of listener in the initdbname.ora file

So the important point you have to remember is that you should compulsorily  have a listener.ora file
if your users have to connect from a different server.

What is a Tnsnames.ora File?
The tnsnames.ora file contains the information about the server where your database is present , the
port number information , the database name , the protocol used (tcp etc ).  If a user wants to
connect to a database then the software program which the user is using will look in the
tnsnames.ora file and find out all the information what we discussed before. Then the software
program uses this information and makes a connection to the database with the help of the listener.

So important point is if a user want to connect to a database he or she would definetly need a
tnsnames.ora file.

What happens if 100 users want to connect to the database? Do we need 100 tnsnames.ora files?
If the users are using a software program that is located on their machine then each user will need his
own tnsnames.ora file. If the users are connecting to a website for example www.google.com then
the user do not need to have a tnsnames.ora on his machine because the website is located on a
webserver so the tnsnames.ora file would already be in the webserver.

Some java programs do not need a tnsnames.ora file .What they do is ,they can read all this
information from a different file which they created . The java developers speak to the dba and will
get the database information. Then they store this information in a different file. Then the java
program reads this file and will connect to the database.


What is sqlnet.ora file ?

If a tnsnames.ora file has to work properly , then we need the sqlnet.ora file. The sqlnet.ora file
contains some information which the user process(the user connection) needs ,to find exactly where
a database server is located. So the user process normally reads the tnsnames.ora file and then the
sqlnet.ora file and thus will find the complete database server information, database name etc and
will talk to the listener which is present on the database server. The listener will then will see that a
conenction is opened to the database.

There are also lot of other parameters in the sqlnet.ora file that you can use.

 For UNIX users, the order in which Oracle searches locations for Oracle Net files like sqlnet.ora and tnsnames.ora are in this order:

1. $HOME for hidden files only (i.e., .sqlnet.ora and .tnsnames.ora)
2. $TNS_ADMIN
3. $HOME
4. /etc or /var/opt/oracle (depends on platform)
5. $ORACLE_HOME/network/admin

For Windows users, the search order is a bit different. It goes like this,
1. current path (associated with the running client application)
2. Environment variable TNS_ADMIN defined for the session
3. Environment variable TNS_ADMIN defined for the system
4. Windows Registry Key TNS_ADMIN
5. %ORACLE_HOME%\network\admin