oracle sys/as,sqlplus sys/oracle@orcl as sysdba无法登录

(1)现象

$ sqlplus as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期一 3月 30 20:50:08 2015

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

ERROR:

ORA-01031: insufficient privileges

请输入用户名:

(2)原因分析

查看一下listener.ora

$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin

$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = ORCL)

(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)

(SID_NAME = ORCL)

)

)

LISTENER =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = oracleServer)(PORT = 1521))

)

ADR_BASE_LISTENER = /u01/app/oracle

这里有两个ORCL。第一个表示服务名,大小写无所谓;第二个表示实例名,要跟数据库的名称(或SID)一样,严格区分大小写。

数据库名为orcl,而这里的SID_NAME为ORCL。原因就在这里。

(3)改正方法

把listener.ora中的SID_NAME改为orcl。

(4)拓展

$ cat tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

ORCL =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = OracleServer)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = ORCL)

)

)

tnsname.ora中也有两个ORCL,大小写都可以。

你可能感兴趣的:(oracle,sys/as)