Eventually, you’ll issue a valid SQL statement and SQLPlus* will return the error ORA-00904 invalid identifier. First, make sure it’s not a typo and you typed a valid and existing column name. If the column exists you should be able to query it and not get this error. The invalid identifier error most commonly happens when you are referencing an invalid alias in a select statement.
As a remainder, to avoid ORA-00904, column names cannot be an Oracle reserved keyword and must contain these four criteria to be valid:
Also, as an advice, avoid using lowercase or any other special character. Although it’s possible to do so using double quotes when defining a column name, it’s prone to errors and will slow investigation when troubleshooting as it’s just not the standard way to do.
In my case, the error was due to an invalid index after a column rename. So I just dropped and recreated the index.
-- Create the new index
Create index schema.new_index (col1, col2, col3) tablespace my_tablespace online;
-- Drop the old
Drop index schema.old_index;
-- Rename to be clean
Alter index schema.new_index rename to old_index;
Here's the way to force the shared pool to shrink dynamically. Documentation states that ASMM can only increase shared pool, and can't shrink. When the automatic shared memory management feature is enabled, the internal tuning algorithm tries to determine an optimal size for the shared pool based on the workload. It usually converges on this va... Read more
20 Mar 2019 - 2 minute readIn some cases, you need to duplicate an Oracle user, along with all it's privileges. Doing this manually can be tedious. Hopefully, we can use the data dictionary to extract the data we need and dump it into a SQL file to modify and replay. Here's how to do it: ```sql set head off set pages 0 set long 9999999 spool user_script.sql SELECT DBMS... Read more
20 Feb 2018 - 1 minute readOn rare occasions, mostly during a high server load peak or a process failure, an Oracle instance may not accept any connection. Either from regular users as well as SYSDBA. This situation is called a **hung database** and must be quickly resolved as the database isn't accessible for your users anymore. As you cannot connect to the hung database... Read more
20 May 2017 - 1 minute read