分类: Oracle
2012-05-03 01:06:14
ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
ORA-12154: TNS: 无法解析指定的连接标识符
这两个错误是我刚刚经历过的,也是很多人都经常碰到的,无非就是在错误配置tnsnames.ora
的时候出现的,如果数据库找不到tnsnames.ora文件,则会直接报ORA-12154错误(你可以试试把tnsnames.ora改成别的文件名如tnsnamesbak.ora)
错误的:
SQL> show parameter service_name;(查看服务名:SERVICE_NAME)
NAME TYPE VALUE
------------------------------------ ---- ------------------- -----------
service_names string orcl
SQL> select name from v$database;(查看数据库名:DB_NAME)
NAME
---------
ORCL
SQL> select instance_name from v$instance;(查看实例名:INSTANCE_NAME)
INSTANCE_NAME
----------------
ABC
SQL> exit
[oracle@RHEL5 ~]$ ps -ef | grep ora_
oracle 7138 1 0 22:26 ? 00:00:00 ora_pmon_ABC
oracle 7140 1 0 22:26 ? 00:00:00 ora_psp0_ABC
oracle 7142 1 0 22:26 ? 00:00:00 ora_mman_ABC
oracle 7144 1 0 22:26 ? 00:00:00 ora_dbw0_ABC
oracle 7146 1 0 22:26 ? 00:00:00 ora_lgwr_ABC
oracle 7148 1 0 22:26 ? 00:00:00 ora_ckpt_ABC
oracle 7150 1 0 22:26 ? 00:00:00 ora_smon_ABC
oracle 7152 1 0 22:26 ? 00:00:00 ora_reco_ABC
oracle 7154 1 0 22:26 ? 00:00:00 ora_cjq0_ABC
oracle 7156 1 0 22:26 ? 00:00:00 ora_mmon_ABC
oracle 7158 1 0 22:26 ? 00:00:00 ora_mmnl_ABC
oracle 7160 1 0 22:26 ? 00:00:00 ora_d000_ABC
oracle 7162 1 0 22:26 ? 00:00:00 ora_s000_ABC
oracle 7169 1 0 22:26 ? 00:00:00 ora_qmnc_ABC
oracle 7190 1 0 22:26 ? 00:00:00 ora_q000_ABC
oracle 7192 1 0 22:26 ? 00:00:00 ora_q001_ABC
oracle 7290 1 0 22:32 ? 00:00:00 ora_j000_ABC
oracle 7309 6799 0 22:33 pts/0 00:00:00 grep ora
正确的:
NAME TYPE VALUE
--------------------------------------------- ------------ ----------
service_names string orcl10g
SQL> select name from v$database;
NAME
---------------------------
ORCL10G
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
orcl10g
SQL> exit
[oracle@rhel5u3 ~]$ ps -ef | grep ora_
oracle 4712 1 0 21:40 ? 00:00:00 ora_pmon_orcl10g
oracle 4714 1 0 21:40 ? 00:00:00 ora_psp0_orcl10g
oracle 4716 1 0 21:40 ? 00:00:00 ora_mman_orcl10g
oracle 4718 1 0 21:40 ? 00:00:00 ora_dbw0_orcl10g
oracle 4720 1 0 21:40 ? 00:00:00 ora_lgwr_orcl10g
oracle 4722 1 0 21:40 ? 00:00:00 ora_ckpt_orcl10g
oracle 4724 1 0 21:40 ? 00:00:00 ora_smon_orcl10g
oracle 4726 1 0 21:40 ? 00:00:00 ora_reco_orcl10g
oracle 4728 1 0 21:40 ? 00:00:00 ora_cjq0_orcl10g
oracle 4730 1 0 21:40 ? 00:00:00 ora_mmon_orcl10g
oracle 4732 1 0 21:40 ? 00:00:00 ora_mmnl_orcl10g
oracle 4734 1 0 21:40 ? 00:00:00 ora_d000_orcl10g
oracle 4736 1 0 21:40 ? 00:00:00 ora_s000_orcl10g
oracle 4741 1 0 21:40 ? 00:00:00 ora_qmnc_orcl10g
oracle 4753 1 0 21:40 ? 00:00:00 ora_q001_orcl10g
oracle 15588 1 0 22:36 ? 00:00:00 ora_q000_orcl10g
oracle 15755 1 0 22:43 ? 00:00:00 ora_j000_orcl10g
oracle 15758 15593 0 22:43 pts/2 00:00:00 grep ora_