This is a pretty common error and there are a few reasons you might be seeing this error.
1. The database could simply be down. If you’re on *nix platform you can simple check this by a simple
ps -ef | grep pmon. If this returns
ora_pmon_<instance_name>. You’re instance is up and running and you can move on to reason #2.
ps -ef | grep pmon oracle 17232 1 0 Feb11 ? 00:01:00 ora_pmon_orcl grid 18072 1 0 Feb08 ? 00:00:08 asm_pmon_+ASM oracle 18557 1 0 Feb08 ? 00:01:08 ora_pmon_orcl2 oracle 20159 1 0 Feb08 ? 00:02:51 ora_pmon_orcl3
2. The more common cause for this error is due to invalid environment settings. You need to make sure you check your
ORACLE_SID environment settings. If either of these are not set correctly then you could encounter this error.
env | grep ORA ORACLE_SID=orcl ORACLE_HOME=/u01/app/oracle/11.2.0/db_1
3. If you’re getting this error for only remote connections, you need to check your listener and make sure that your instance is registering with the listener. If you’re using auto registration you need to verify that your local_listener parameter is set correctly inside the database in order to make remote connections.