[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. Docker部署Vue 工程包

    docker部署 Vue 工程包 目录结构 [root@host ~]# tree front/ front/ ├── dist.conf ├── dist.zip ├── Dockerfile └─ ...

  2. python 怎样获取toast?

    toast是什么? 想要获取toast的小伙伴们,肯定知道这个是一个什么玩意,例行还是加一个图,加以解释,下图的就是传说中的toast,它有一个特点,出现时间特别短,很难通过定位元素去获取这个toas ...

  3. SQL查询去掉重复数据

    本文主要总结数据库去掉重复数据的方法 去掉重复数据的方法: 第一种:distinct 根据单个字段去重,能精确去重: 作用在多个字段时,只有当这几个字段的完全相同时,才能去重: 关键字distinct ...

  4. POJ 2909

    #include<iostream> #include<stdio.h> #define M 35000 #include<math.h> #define N 38 ...

  5. python TypeError: 'int' object is not callable 问题解决

    TypeError: 'int' object is not callable 这个错误的原因很简单 看下面的程序: def loss(a,b): return a-b loss = 0 loss = ...

  6. SQL Server性能优化(15)选择合适的索引

    一.关于聚集索引列的选择(参考) 1. 聚集索引所在的列,或者列的组合最好是唯一的. 当我们创建的聚集索引的值不唯一时,SQL Server则无法仅仅通过聚集索引列(也就是关键字)唯一确定一行.此时, ...

  7. Oracle PL/SQL,游标,过程

    1.PL/SQL  语法相关 -- SQL 语言只是访问,操作数据库的语言,而比并不是程序设计语言,因此不能用于程序开发. -- PL/SQL 是在标准SQl语言上进行过程性扩展后形成的程序设计语言, ...

  8. koa2搭建服务器

    首先初始化项目 npm init -y 安装koa2 npm install koa --save 项目根目录 新建 index.js //这是最基本的服务 const Koa = require(' ...

  9. resin4.0.25 安装配置 及结合eclipse开发

    resin4.0.25 安装配置 及结合eclipse开发 本文大部分内容是对官网的翻译,及自己配置后的一些体会. 一.  基于win  ,resin基本安装1,安装jdk1.6或更高版本2,配置环境 ...

  10. [JZOJ5984] 仙人掌

    Description Solution 标算我并不会... 考虑一种根号思想 首先以 \(1\) 为根dfs整棵树 那么在任意时刻一个点的儿子的权值种类最多只会有 \(\sqrt m\) 种. 可以 ...