重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3416|回复: 0
打印 上一主题 下一主题

[Oracle] ORA-12162: TNS:net service name is incorrectly specified 错误解决

[复制链接]
跳转到指定楼层
楼主
发表于 2019-8-29 13:52:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
报错现象:
[oracle@hisdg ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 29 00:59:02 2019
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


Enter user-name:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified



使用连接串的方式正常启动数据库:
[oracle@hisdg ~]$ sqlplus system/oracle@orcl
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 29 01:02:23 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options



SQL>


报错原因:ORACLE_SID没有指定导致的!
[oracle@hisdg ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@hisdg ~]$ echo $ORACLE_SID


[oracle@hisdg ~]$ ls -al

drwx------  4 oracle oinstall 4096 8月  29 00:58 .
drwxr-xr-x. 4 root   root     4096 8月  20 21:48 ..
-rw-------  1 oracle oinstall  890 8月  29 00:46 .bash_history
-rw-r--r--  1 oracle oinstall   18 8月  29 2012 .bash_logout
-rw-r--r--  1 oracle oinstall  441 8月  29 00:58 .bash_profile
-rw-r--r--  1 oracle oinstall  124 8月  29 2012 .bashrc
drwxr-xr-x  2 oracle oinstall 4096 7月  14 2010 .gnome2
drwxr-xr-x  4 oracle oinstall 4096 8月   9 03:39 .mozilla
-rw-------  1 oracle oinstall  649 8月  29 00:58 .viminfo
[oracle@hisdg ~]$ vi .bash_profile
[oracle@hisdg ~]$  source .bash_profile
[oracle@hisdg ~]$ echo $ORACLE_SID     
orcl

再次尝试登陆:
[oracle@hisdg ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 29 01:04:12 2019
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DGDATA/orcl/datafile/system.256.1017533309
+DGDATA/orcl/datafile/sysaux.257.1017533309
+DGDATA/orcl/datafile/undotbs1.258.1017533309
+DGDATA/orcl/datafile/users.259.1017533309

SQL>                                                   






分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-20 06:18 , Processed in 0.101439 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表