[20170825]不启动监听远程能连接数据库吗2.txt

--//曾经写过一篇不启动监听连接数据库的帖子:http://blog.itpub.net/267265/viewspace-1816211/
--//利用共享服务器模式.
--//昨天测试备库启动drcp,突然想到这个跟共享模式有一些类似.自己也测试看看.

1.环境:
SYS@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

--//启动drcp.
SYS@book> exec dbms_connection_pool.start_pool()
PL/SQL procedure successfully completed.

$ lsnrctl service
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 25-AUG-2017 16:40:36
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "book" has 2 instance(s).
  Instance "book", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:23 refused:0
         LOCAL SERVER
  Instance "book", status READY, has 3 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:31 refused:0 state:ready
         LOCAL SERVER
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: xxxxx, pid: 22244>
         (ADDRESS=(PROTOCOL=tcp)(HOST=xxxxx)(PORT=33994))
      "N000" established:0 refused:0 current:0 max:40000 state:ready
         CMON <machine: xxxxx, pid: 34251>
         (ADDRESS=(PROTOCOL=tcp)(HOST=xxxxx)(PORT=34401))
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Service "book123" has 1 instance(s).
  Instance "book", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0
         LOCAL SERVER
Service "bookXDB" has 1 instance(s).
  Instance "book", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: xxxxx, pid: 22244>
         (ADDRESS=(PROTOCOL=tcp)(HOST=xxxxx)(PORT=33994))
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: xxxxx, pid: 53522>
         (ADDRESS=(PROTOCOL=tcp)(HOST=xxxxx)(PORT=64784))
The command completed successfully

--//注意看下划线的端口号34401.
# lsof -i -P -n | grep 34401
oracle    34251  oracle   11u  IPv6 32813593      0t0  TCP *:34401 (LISTEN)

# ps -ef | grep  3425[1]
oracle   34251     1  0 16:40 ?        00:00:00 ora_n000_book
--//对应进程是34251.进程名为ora_n000_book.

$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 25-AUG-2017 16:45:56
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
The command completed successfully

$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 25-AUG-2017 16:46:54
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.78)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
--//可以发现监听已经关闭.

3.测试连接:
--//采用ezconnect模式,这样快捷一些.
$ rlsql scott/book@192.168.100.78:34401/book:POOLED
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 25 16:50:41 2017
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

SCOTT@192.168.100.78:34401/book:POOLED> select sysdate from dual ;
SYSDATE
-------------------
2017-08-25 16:50:52

SCOTT@192.168.100.78:34401/book:POOLED> select sid, serial#,server from v$session where sid = ( select sid from v$mystat where rownum=1);
       SID    SERIAL# SERVER
---------- ---------- ---------
        31         57 POOLED

SCOTT@192.168.100.78:34401/book:POOLED> @ &r/spid
       SID    SERIAL# SPID       PID  P_SERIAL# C50
---------- ---------- ------ ------- ---------- --------------------------------------------------
        31         57 34257       26         29 alter system kill session '31,57' immediate;

$ ps -ef | grep 3425[7]
oracle   34257     1  0 16:40 ?        00:00:00 ora_l002_book

--//同样对于共享模式也一样,前面知道端口号33994.

$ rlsql scott/book@192.168.100.78:33994/book:shared
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 25 16:57:06 2017
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

SCOTT@192.168.100.78:33994/book:shared> select sid, serial#,server from v$session where sid = ( select sid from v$mystat where rownum=1);

SID    SERIAL# SERVER
---------- ---------- ---------
       263          9 SHARED

总结:
--//再次用一句安全的术语讲"苍蝇不叮无缝的蛋"。^_^.
--//只要知道drcp的端口号(当然要启动这个服务)或者共享模式的端口号,不启动监听一样能连接数据库.
--//补充netstat -tnlp | grep ora的输出.
# netstat -tnlp | egrep 'Active|Proto|ora'
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 :::34401                    :::*                        LISTEN      34251/ora_n000_book
tcp        0      0 :::33994                    :::*                        LISTEN      22244/ora_d000_book

[20170825]不启动监听远程能连接数据库吗2.txt的更多相关文章

  1. (转)oracle 启动监听 报“监听程序不支持服务” 解决

    转自 http://www.51testing.com/html/99/478599-842622.html 今天安装了oracle后,启动监听,报错如下:    启动tnslsnr: 请稍候... ...

  2. TNS-12541,TNS-12560,TNS-00511,TNS-12542,TNS-12560,TNS-00512数据库启动监听报错

    第 1章   数据库server监听错误 1.1.1数据库监听错误 1.1.1.1 问题及现象 server环境为ORACLE11G RAC环境,系统启动后,监听没起来. [oracle@RAC4 ~ ...

  3. 启动监听报错:TNS-12537: TNS:connection closed TNS-12560: TNS:protocol adapter error TNS-00507: Connection closed Linux Error: 29: Illegal seek

    启动监听程序报错: 说明:在rhel5.8上安装完成oracle11g数据库后,使用netca创建完监听,启动监听时报错.还未使用dbca创建实例. [oracle@rusky-oracle11g ~ ...

  4. Linux下安装oracle遇到启动监听服务器启动失败

    1.发现监听服务器没有启动,则  lsntctl start 启动监听服务器: 2.发现TNS-12555问题: 3.查找TNS-12555错误,找到一个满意的答案: chmod  777 /var/ ...

  5. Win7/Vista/Server2008下VS 环境 调试调用 HTTP.SYS 无法启动监听服务及启动后其他机器无法访问端口

    一. VS调试在Win7(vista系列)操作系统下 HttpListener无法绑定多个 指定IP.端口问题 来自:http://www.cnblogs.com/ryhan/p/4195693.ht ...

  6. Linux下的启动oracle服务 启动监听 开放端口操作

    尝试登录oracle 使用root用户将没有sqlplus命令 [root@localhost ~]# sqlplus /nolog bash: sqlplus: 未找到命令...     [root ...

  7. oracle登陆,在监听服务启动了的情况下,登陆用户还是报错未启动监听服务的错误(刚开始装oracle是能登陆的,重启之后装了plsql)

    刚开始装oracle是能登陆的,重启之后装了140M的plsql,所以有可能是plsql跟oracle监听冲突了,所以我之后换了33M的plsql,oracle就没问题了,可以正常登陆了

  8. PLSQL Developer 客户端没有TNS监听,无法连接数据库

    在Windows Server 2008 中安装了 64位的Oracle,好不容易将监听做好,在使用客户端 PLSQL Developer 的时候发现竟然没有TNS监听. 问题如下: 如上图所示,打开 ...

  9. java启动监听错误: org.springframework.web.context.ContextLoaderListener

    项目启动会报以下错误: 解决方案如下: 感谢好心人的提示“其实可能是你的jar文件没有同步发布到自己项目的lib目录中(如果你是用Maven进行构建的话) 可以试试 下面的办法 项目点击右键 点击 P ...

随机推荐

  1. centos7使用lldb调试netcore应用转储dump文件

    centos7下安装lldb,dotnet netcore 进程生成转储文件,并使用lldb进行分析 随着netcore应用在linux上部署的应用越来越多,碰到cpu 100%,内存暴涨的情况也一直 ...

  2. odoo开发笔记 -- 传递上下文实现列表视图按照指定条件过滤显示

    按钮传递上下文: <xpath expr="//div[@name='dec_work_sheet_id']" position="after"> ...

  3. Android 源码分析01_AsyncTask

    [参考文献] http://blog.csdn.net/singwhatiwanna/article/details/17596225 /* * Copyright (C) 2008 The Andr ...

  4. C#7.0--引用返回值和引用局部变量

    一.在C#7.0以上版本中,方法的返回值可以通过关键字ref指定为返回变量的引用(而不是值)给调用方,这称为引用返回值(Reference Return Value,或ref returns): 1. ...

  5. 使用 Linux 自带的 logrotate 程序来控制日志文件尺寸

    1. 编写配置文件,内容如下(以 Amadeus 系统为例): 编写配置文件,放在 /etc/logrotate.d/xxxx 下,其中 xxxx 是自己取的名字,无需后缀.例如 Amadeus 系统 ...

  6. 一文揭秘定时任务调度框架quartz

    之前写过quartz或者引用过quartz的一些文章,有很多人给我发消息问quartz的相关问题, quartz 报错:java.lang.classNotFoundException quartz源 ...

  7. Go语言程序结构分析初探

    每一种编程语言都有自己的语法.结构以及自己的风格,这也是每种语言展现各自魅力及众不同的地方.Go也不例外,它简单而优雅,与此同时使用起来也很有趣.在本文中,我们将讨论以下几点: Go程序结构 如何运行 ...

  8. 动手实现react Modal组件

    Modal组件 长话不多说,接下来让我们来动手实现一个react Modal组件. 我们先来看一下实际效果 Modal的布局 首先,让我们先思考下一个Modal组件的布局是怎么样的. 我们先拿一个基本 ...

  9. SQL Where in (1,2,3,4) 换成字段一列的值

    ) ; , ) ) FROM r_resource WHERE id IN ( @resource) 换成 ) : , ) ) FROM r_resource )) SELECT cid,id FRO ...

  10. windows server 2008 R2 开启远程桌面

    1.计算机  ——属性 2.远程设置 3.远程桌面-允许运行任意版本远程连接-选择用户-添加用户:Administrator;或是可以是其他非管理员用户(默认的系统管理员已经被授予了访问权限); 点确 ...