【问题标题】:Sql plus not able to connect to oraclesql plus无法连接oracle
【发布时间】:2014-08-23 19:57:21
【问题描述】:

我已经在我的 Windows7 操作系统上安装了 Oracle 11g。 这工作正常,但突然从 Sqlplus 连接 oracle 时出现错误。

C:\>sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Sun Aug 24 00:14:32 2014

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

Enter user-name: system
Enter password:

ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0

我已将 ORACLE_HOME=C:\app\product\11.2.0\dbhome_1 和 ORACLE_SID 设置为 orcl。

listener.ora

#Network Configuration File: C:\app\product\11.2.0\dbhome_1\network\admin\listener.ora
#Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = C:\app

tnsnames.ora

# tnsnames.ora Network Configuration File: C:\app\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

更新1

我的 init.ora 文件:

# Example INIT.ORA file
#
# This file is provided by Oracle Corporation to help you start by providing
# a starting point to customize your RDBMS installation for your site. 
# 
# NOTE: The values that are used in this file are only intended to be used
# as a starting point. You may want to adjust/tune those values to your
# specific hardware and needs. You may also consider using Database
# Configuration Assistant tool (DBCA) to create INIT file and to size your
# initial set of tablespaces based on the user input.
###############################################################################

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)

db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='<ORACLE_BASE>/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='<ORACLE_BASE>'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300 
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'

还是报错:

C:\>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 4 23:17:00 2014

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

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 1670221824 bytes
Fixed Size                  2176328 bytes
Variable Size            1157630648 bytes
Database Buffers          503316480 bytes
Redo Buffers                7098368 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 1916
Session ID: 5 Serial number: 5


SQL> conn shah
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0

感谢有人能在这方面提供帮助。在此先感谢。

【问题讨论】:

  • 请确保您的数据库已启动。

标签: sql oracle oracle11g


【解决方案1】:

它有用且知识渊博,希望在这里也有用:

http://ora-data.blogspot.com/2016/11/sqlplus-not-connecting-in-oracle.html

[oracle@ebs sqlplus]$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin

[oracle@ebs sqlplus]$ pwd
/u01/StageR122/oracle/product/11.2.0/dbhome_1/sqlplus

[oracle@ebs sqlplus]$ export PATH=$PATH:/u01/StageR122/oracle/product/11.2.0/dbhome_1/bin/

[oracle@ebs sqlplus]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 11 12:52:30 2016

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

Connected to an idle instance.

SQL>

谢谢,

【讨论】:

    【解决方案2】:
    C:\> sqlplus /nolog
    
    SQL> conn / as sysdba
    
    SQL> startup
    
    **Database starts**
    
    SQL> conn <<your_user>>
    

    如果数据库没有启动,那么您的init.ora 文件有问题。

    祝你好运。

    【讨论】:

    • 没有运气。这是我的 init.ora 文件内容。 db_name='ORCL' memory_target=1G 进程 = 150 audit_file_dest='/admin/orcl/adump' audit_trail ='db' db_block_size=8192 db_domain='' db_recovery_file_dest='/flash_recovery_area' db_recovery_file_dest_size=2G diagnostic_dest= '' dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' open_cursors=300 remote_login_passwordfile='EXCLUSIVE' undo_tablespace='UNDOTBS1' # 你可能想确保控制文件是在不同的物理设备上创建的 # 设备 control_files = (ora_control1, ora_control2) 兼容 ='11.2.0'
    • 我的错。在 nolog 模式下打开 SQLplus 后尝试以 sysdba 连接:conn / as sysdba(仅当您以安装 Oracle 的 SO 用户身份登录时才有效)。然后尝试启动命令。我将编辑答案以添加它。
    • 试过了,但没有成功,我已经添加了有问题的init.ora文件以及update1下的启动命令结果。
    • 哦,孩子。看起来像背景进程或数据文件的问题,因为其他一切看起来都很好。也许 dba.stackoverflow.com 上的人可以帮助您。您必须查看警报日志和跟踪信息,但这听起来不是该站点的正确问题。也许从备份中恢复?
    【解决方案3】:

    确保 Windows 服务 OracleOraDB18Home1TNSListener 正在运行。如果它已经在运行重启OracleOraDB18Home1TNSListener 服务。

    运行以下 shell 命令:

    sqlplus sys as sysdba
    startup
    

    你也可以运行这个命令来查看

    sqlplus myUsername/myPassword@localhost
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-08
      • 2015-12-10
      • 1970-01-01
      相关资源
      最近更新 更多