Oracle 11gR2 RAC 数据库不能连接(ORA-12537: TNS:connection closed)

本文解决了Oracle11gR2RAC数据库中出现的ORA-12537错误,通常由监听器权限问题引起。文章详细介绍了可能的原因,包括监听器所有者无法访问数据库中的Oracle二进制文件、Oracle二进制文件权限设置不正确或文件系统不支持suid。并提供了具体的解决步骤。

Oracle 11gR2 RAC 数据库不能连接(ORA-12537: TNS:connection closed)的解决

 

[oracle@rac01 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 29 21:06:10 2012

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

SQL> connect system/***@astt
ERROR:
ORA-12537: TNS:connection closed

[root@rac01 app]# ls -ltr
drwxr-xr-x 3 root   oinstall 4096 08-28 19:05 grid
drwxrwx--- 6 grid   oinstall 4096 08-29 00:03 oraInventory
drwxrwxr-x 7 oracle oinstall 4096 08-29 00:20 oracle
[root@rac01 app]# chmod 755 oracle
[root@rac01 app]# chmod 755 grid
[root@rac01 app]# ls -ltr
drwxr-xr-x 3 root   oinstall 4096 08-28 19:05 grid
drwxrwx--- 6 grid   oinstall 4096 08-29 00:03 oraInventory
drwxr-xr-x 7 oracle oinstall 4096 08-29 00:20 oracle

 

[oracle@rac01 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 29 21:28:23 2012

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

SQL> connect system/***@astt;
????
SQL>

SQL> select instance_name from gv$instance;

INSTANCE_NAME
----------------
astt1
astt2

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
astt1

SQL>

 

 

参考:

metalink  [ID 1069517.1]:


Symptoms
In environment where listener home (including SCAN listener which resides in Grid Infrastructure/ASM home) and database home are owned by different OS user, ORA-12537 could happen when connecting through listener, when creating database through DBCA, or when installing database software and creating a database in runInstaller. Job Role Separation is a typical example as SCAN and local grid home listener is owned differently than database.

Error detail
12537, 00000, "TNS:connection closed"
// *Cause: "End of file" condition has been reached; partner has disconnected.
// *Action: None needed; this is an information message.
Before the error is reported, connection could hang for a while, and a core file may also be generated.
Screen output:
SQL> conn system/xxx@OSES
ERROR:
ORA-12537: TNS:connection closed
OR
PRCR-1079 : Failed to start resource ora.db11.db
CRS-5011: Check of resource db11 failed: details at ..
CRS-2674: Start of ora.db11.db on racnode1 failed
ORA-12546: TNS:permission denied

listener_scann.log or listener.log
TNS-12518: TNS:listener could not hand off client connection
TNS-12546: TNS:permission denied
TNS-12560: TNS:protocol adapter error
  TNS-00516: Permission denied
   Linux Error: 13: Permission denied
OR
TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
  TNS-00517: Lost contact
   Linux Error: 32: Broken pipe

runInstaller error if installing
INFO: Starting Output Reader Threads for process /ocw/grid/bin/kfod
INFO: Parsing KFOD-00300: OCI error [-1] [OCI error] [ORA-12547: TNS:lost contact
INFO: Parsing ] [12547]
INFO: Parsing
INFO: The process /ocw/grid/bin/kfod exited with code 1
..
SEVERE: [FATAL] [INS-30502] No ASM disk group found.
   CAUSE: There were no disk groups managed by the ASM instance +ASM1.
Cause
1. Listener owner (including SCAN listener) can not access oracle binary in database home:
As listener owner:

$ ls -l $RDBMS_HOME/bin/oracle
ls: /home/oracle/app/oracle/product/11.2/db/bin/oracle: Permission denied

2. Oracle binary in database home has wrong permission:

ls -l $RDBMS_HOME/bin/oracle
-rwxr-x--x 1 oracle asmadmin 184286251 Aug  9 16:25 /home/oracle/app/oracle/product/11.2/db/bin/oracle
The permission "-rwxr-x--x" is wrong as it's missing suid bit, oracle binary should have permission of 6751:

-rwsr-s--x 1 oracle asmadmin 184286251 Aug  9 16:25 /home/oracle/app/oracle/product/11.2/db/bin/oracle
Note: If Job Role Separation is in place, the group will be <asmadmin>, otherwise it will be <oinstall>

3. File System for database home does not support setuid/suid or has nosetuid/nosuid set:

mount| grep <mount_point_of_ORACLE_HOME>
/home/oracle on /dev/dsk/diskoracle read/write/nosuid..
Solution
Solution is to make sure file system for database home has setuid/suid set, database binary($RDBMS_HOME/bin/oracle) has correct ownership and permission, and listener owner is able to access database oracle binary (as listener owner, "ls -l $RDBMS_HOME/bin/oracle" will tell)
If its Job Role Separation environment, please refer to the following document:
Oracle® Grid Infrastructure
Installation Guide
11g Release 2 (11.2)
Oracle ASM Job Role Separation Option with SYSASM
### Oracle RAC 客户端连接时出现 TNS-12547 错误的解决方案 在 Oracle RAC 环境中,客户端连接时出现 `TNS-12547: lost contact` 错误通常与网络配置、权限设置或 Oracle 二进制文件的权限问题有关。以下是针对该问题的详细分析和解决方法: #### 1. 检查 Oracle 二进制文件的权限 确保 Oracle 二进制文件的权限设置正确。错误可能是因为 `$ORACLE_HOME/bin/oracle` 文件的权限不正确导致的。需要确认以下几点: - 文件的所属用户和组应为 `oracle:oinstall`。 - 权限应设置为 `6751`。 可以使用以下命令检查和修改权限: ```bash ls -l $ORACLE_HOME/bin/oracle chmod 6751 $ORACLE_HOME/bin/oracle chown oracle:oinstall $ORACLE_HOME/bin/oracle ``` 如果在 RAC 环境中,需要对所有节点执行上述操作[^3]。 #### 2. 验证监听器状态 检查监听器是否正常运行。可以通过以下命令验证监听器的状态: ```bash lsnrctl status ``` 如果监听器未启动或配置不正确,可能会导致连接失败。确保监听器配置文件 `listener.ora` 和 `tnsnames.ora` 的内容正确无误,并且监听器已成功启动。 #### 3. 检查网络配置 TNS-12547 错误也可能由网络问题引起。需要检查以下内容: - 确保客户端能够通过 `ping` 命令访问数据库服务器。 - 验证防火墙规则,确保客户端与服务器之间的端口(通常是 1521)未被阻止。 - 使用 `tnsping` 工具测试客户端与数据库连接性: ```bash tnsping <service_name> ``` #### 4. 检查 Oracle 用户环境变量 确保 Oracle 用户的环境变量配置正确。特别是以下变量: - `ORACLE_HOME` - `ORACLE_SID` - `PATH` 可以通过以下命令检查和设置环境变量: ```bash export ORACLE_HOME=/path/to/oracle/home export ORACLE_SID=<sid_name> export PATH=$ORACLE_HOME/bin:$PATH ``` #### 5. 检查操作系统日志 有时,操作系统级别的日志可以提供更多关于错误的线索。可以在以下位置查找相关日志: - Linux: `/var/log/messages` 或 `/var/log/syslog` - Windows: 事件查看器中的应用程序日志 #### 6. 检查 Oracle 数据库告警日志 查看数据库告警日志文件(`alert_<sid>.log`),以获取更多关于错误的详细信息。告警日志通常位于 `$ORACLE_BASE/diag/rdbms/<db_name>/<instance_name>/trace/` 目录下。 #### 7. 重新编译 Oracle 客户端库 如果上述方法均无效,可能是 Oracle 客户端库文件损坏。尝试重新安装或重新编译客户端库文件。 --- ### 示例代码:检查和修改权限 以下是一个示例脚本,用于检查和修改 Oracle 二进制文件的权限: ```bash #!/bin/bash # 检查当前权限 echo "当前权限:" ls -l $ORACLE_HOME/bin/oracle # 修改权限 chmod 6751 $ORACLE_HOME/bin/oracle chown oracle:oinstall $ORACLE_HOME/bin/oracle # 验证修改后的权限 echo "修改后权限:" ls -l $ORACLE_HOME/bin/oracle ``` --- ### 注意事项 - 如果问题仍未解决,建议收集以下信息并联系 Oracle 支持团队: - 数据库版本 - 监听器配置文件内容 - 客户端连接字符串 - 告警日志中的错误信息 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值