错误详情
[Oracle@orcl bin]$ ./sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 18 08:12:04 2025
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specifiedOS登录解析
注意:Oracle 数据库使用SYSDBA用户在OS级别登录时,需要满足最基本的两个条件
a). 必须设置ORACLE_HOME路径,并将其加入到PATH变量中
b).必须设置ORACLE_SID变量,ORACLE_SID表明需要登录的数据库
错误原因
解决方案
$ export ORACLE_BASE=/u01/db/11.2.0.4
$ export ORACLE_HOME=$ORACLE_BASE/orcl
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export ORACLE_SID=ORCL2、登录即可
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 22 20:48:44 2025
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, OLAP, Data Mining and Real Application Testing options
SQL>理解SYS用户
# 取消操作系统认证
$ cd $ORACLE_HOME/network/admin
$ vi sqlnet.ora
SQLNET.AUTHENTICATION_SERVICE=NONE -- 默认不存在该参数,设置为NTS即开启
[oracle@orcl ~]$ sqlplus / as sysdba -- 登录
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 22 20:48:44 2025
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, OLAP, Data Mining and Real Application Testing options
SQL>b)数据库认证:该方式一般针对普通用户而言,主要是将密码记录在数据库的表中,但用户需要登录时必须输入正确的用户名和密码加监听服务连接到数据库中进行校验,校验正确方可登录。
[oracle@orcl ~]$ sqlplus apps/apps@orcl -- 普通用户登录方式
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 22 20:52:50 2025
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, OLAP, Data Mining and Real Application Testing options
SQL>「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




