今天性能库的centos 上面的oracle18c 数据库连接不上了 这里进行了一次简单处理 针对不同问题进行说明: 1. 实例时 blocked 的状态 问题现象: LSNRCTL statusConnecting to (DESCRIPTION =(ADDRESS=(PROT
今天性能库的centos 上面的oracle18c 数据库连接不上了 这里进行了一次简单处理
针对不同问题进行说明:
1. 实例时 blocked 的状态 问题现象:
LSNRCTL> status Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 18.0.0.0.0 - Production Start Date 13-JUN-2019 21:13:25 Uptime 0 days 1 hr. 10 min. 34 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/gscloudlinuxdb/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gscloudlinuxdb)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "ora18c" has 1 instance(s). Instance "ora18c", status BLOCKED, has 1 handler(s) for this service... The command completed successfully
解决办法 使用静态注册。
方法
vim /u01/oracle/network/admin/listener.ora # status 信息里面有具体的位置。 # listener.ora Network Configuration File: /u01/oracle/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/oracle/) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = ora18c) (ORACLE_HOME = /u01/oracle) (SID_NAME = ora18c) ) ) LISTENER1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) (ADDRESS = (PROTOCOL = TCP)(HOST = dengqiushuang)(PORT = 1521)) ) )
2. 解决监听链接不上的问题 现象
[[email protected] admin]$ sqlplus / as sysdba SQL*Plus: Release 18.0.0.0.0 - Production on Thu Jun 13 22:31:27 2019 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. ERROR: ORA-12547: TNS:lost contact
网上搜到很多方法:
参照:
https://blog.51cto.com/hbxztc/1945049
1、查看操作系统内核参数是否无误 [[email protected] database]$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 15738 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 2047 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited 2、确认$ORACLE_HOME/bin/oracle文件权限是否有问题 (在rac下需要查看$ORACLE_HOME/bin/oracle和$GRID_HOME/bin/oracle两个文件), 正确权限为: [[email protected] adump]$ ll $ORACLE_HOME/bin/oracle -rwsr-s--x 1 oracle oinstall 232399083 Aug 28 17:23 /u01/app/oracle/product/11.2.0/db_1/bin/oracle 如果权限不对 chmod 6751 $ORACLE_HOME/bin/oracle 3、检查一下环境变量 echo $ORACLE_HOME echo $ORACLE_SID echo $LD_LIBRARY_PATH --注意:不同的操作系统此环境变量会不同 echo $PATH 4、检查$ORACLE_HOME/bin/oracle 和 $ORACLE_HOME/rdbms/lib/config.o 的文件大小是否为0, 如果大小为0,需要重新编译oracle软件: [[email protected] backup]$ relink all writing relink log to: /u01/app/oracle/product/11.2.0/db_1/install/relink.log 5、使用操作系统跟踪命令跟踪sqlplus连接过程,从而观察跟踪文件。 ltrace -f -o /tmp/sqlplus.log sqlplus / as sysdba 或truss命令
我这边很奇怪 我只是修改了一下 内核参数文件
vim /etc/security/limits.conf 我在最后面增加了这样的数据 * soft nproc 20470 * hard nproc 16384 * soft nofile 10240 * hard nofile 65536 * soft stack 10240 * hard stack 10240 把 oracle 修改为 所有的用户 重启或者不重启数据库 然后就可以了。
3. 结果为: