首页 > 代码库 > Oracle学习笔记之第六节网络介绍及配置,会话

Oracle学习笔记之第六节网络介绍及配置,会话

ps aux | grep ora_pmon 有几个数据库服务器就有几个这个进程(进程监控进程和外部打交道)

vim sqlnet.ora 这个可以让数据库略微安全,让sqlplus 不能登陆

sqlnet.authentication_services=(none)


conn hr/oracle_4U@orcl 产生物理连接逻辑会话

host ps 查看终端是哪个

! ps 

然后通过windows的sqlplus plus 工具连接

select * from v_$session s where s.TERMINAL =‘pts/2‘;

SADDR 会话地址 SGA共享池,控制新值的存放

PADDR 内存地址

TADDR 事物地址,旧值地址,如果更改就产生事物,也在共享池

这时候lsnrctl stop

select salary from employes; 还是连着的,但是进行一个新的连接就发现连不上了

lsnrctl

help

srvctl status listener

crs_stat -p | grep lsnr

crs_unregister ora.LISTENER.lsnr

srvctl add  listener -p 15210  手动增加监听器


crsctl stop has 关闭整个集群

emctl start dbconsole 启动图形页面

emca  重新生成图形页面

emca -deconfig dbcontrol db -repos drop

emca -config dbcontrol db -repos create 


配置第2个监听器

vim listener.ora

srvctl add  listener -l l2 -p 15211

srvctl start listener -l l2 

lsnrctl services l2

vim tnsnames.ora


sqlplus /nolog

alter system register; 强制系统去动态注册一下


动态注册远程开不了数据库

FOR15212 =

 (DESCRIPTION =

(ADDRESS_LIST=

        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.55)(PORT = 15212))

        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.55)(PORT = 15211))

))


conn hr/oracle_4U@192.168.0.55:15212/orcl.example.com 简单连接

shutdown abort强制关闭数据库


export LANG=en_US

netmgr 图形配置网络页面

netca


vim tnsnames.ora

conn hr/oracle_4U@192.168.0.55:TIGER/rcat.example.com

TIGER 负载均衡配置


让两个监听器认识lsnrctl services D000......


vim listener.ora

#动态注册LISTENER监听器

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15212))

    )

  )

#动态注册L2监听器

L2=

(DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15213))

    )

  )

  

  #使监听器LISTENER静态注册,使其能够与上面的监听器进行一动一静

SID_LIST_LISTENER =

        (SID_LIST =

                (SID_DESC =

                        (GLOBAL_DBNAME= rcat.example.com)

                        (SID_NAME= rcat)

                        (ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1/

        )

        )

        )

使监听器L2静态注册,使其能够与上面的监听器进行一动一静

SID_LIST_L2 =

        (SID_LIST =

                (SID_DESC =

                        (GLOBAL_DBNAME= rcat.example.com)

                        (SID_NAME= rcat)

                        (ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1/

        )

        )

        )

vim tnsnames.ora

#tnsnames.ora所在的那台客户端认为在15212能找到注册服务,若不能找到就连不上。

RCAT =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15212))

    (CONNECT_DATA =http://www.mamicode.com/

      (SERVER = DEDICATED)

      (SERVICE_NAME = rcat.example.com)

    )

  )


#tnsnames.ora所在的那台客户端认为在15212能找到注册服务,若不能找到就连不上。

RCAT2

(DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15213))

    (CONNECT_DATA =http://www.mamicode.com/

      (SERVER = DEDICATED)

      (SERVICE_NAME = rcat.example.com)

    )

  )


  #动态注册FOR15212

FOR15212 =

  (DESCRIPTION =

  (ADDRESS_LIST=

  (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15212))

  (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15213))


  )

)


#tiger是给win客户端写的条目,负载均衡静态15212和15213这两个监听端口

TIGER =

    (DESCRIPTION =

        (ADDRESS_LIST =

        (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15212))

        (ADDRESS = (PROTOCOL = TCP)(HOST = station90.example.com)(PORT = 15213))

        (LOAD_BALANCE = yes )

    )

    (CONNECT_DATA =http://www.mamicode.com/

        (SERVICE_NAME = rcat.example.com)

    )

  )

  

  #以上需要使其动态注册生效,需要进sqlplus修改配置

. oraenv

rcat

sqlplus /nolog

conn /as sysdba

alter system set local_listener=FOR15212;

alter register;   #更快的让监听器动态注册,不然得等待2分钟以上

. oraenv

+ASM

sqplus /nolog

conn /as sysdba

alter system set local_listener=FOR15212;

#以上需要使其动态注册生效,需要进sqlplus修改配置

. oraenv

rcat

sqlplus /nolog

conn /as sysdba

alter system set local_listener=FOR15212;

alter system register;  #更快的让监听器动态注册,不然得等待2分钟以上

. oraenv

+ASM

sqplus /nolog

conn /as sysdba

alter system set local_listener=FOR15212;

alter system register; #更快的让监听器动态注册,不然得等待2分钟以上

#更快的让监听器动态注册,不然得等待2分钟以上


以上结束后查看LISTENER监听器状态

[oracle@station90 admin]$ lsnrctl services LISTENER;


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-SEP-2016 23:16:52


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=station90.example.com)(PORT=15212)))

Services Summary...

Service "+ASM" has 1 instance(s).

  Instance "+ASM", status READY, has 1 handler(s) for this service... #是动态注册出现的

    Handler(s):

      "DEDICATED" established:0 refused:0 state:ready

         LOCAL SERVER

Service "rcat.example.com" has 2 instance(s).

  Instance "rcat", status UNKNOWN, has 1 handler(s) for this service... #是静态注册出现的

    Handler(s):

      "DEDICATED" established:0 refused:0

         LOCAL SERVER

  Instance "rcat", status READY, has 1 handler(s) for this service...  #是动态注册出现的

    Handler(s):

      "DEDICATED" established:0 refused:0 state:ready

         LOCAL SERVER

Service "rcatXDB.example.com" has 1 instance(s).                        #是动态注册出现的隐含服务,XMLDB

  Instance "rcat", status READY, has 1 handler(s) for this service...

    Handler(s):

      "D000" established:0 refused:0 current:0 max:1022 state:ready

         DISPATCHER <machine: station90.example.com, pid: 12730>

         (ADDRESS=(PROTOCOL=tcp)(HOST=station90.example.com)(PORT=44903))

The command completed successfully


L2监听器的状态

[oracle@station90 admin]$ lsnrctl services l2


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 05-SEP-2016 23:19:08


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=station90.example.com)(PORT=15213)))

Services Summary...

Service "rcat.example.com" has 2 instance(s).

  Instance "rcat", status UNKNOWN, has 1 handler(s) for this service...   #是静态注册出现的

    Handler(s):

      "DEDICATED" established:0 refused:0

         LOCAL SERVER

  Instance "rcat", status READY, has 1 handler(s) for this service...    #是动态注册出现的

    Handler(s):

      "DEDICATED" established:0 refused:0 state:ready

         LOCAL SERVER

Service "rcatXDB.example.com" has 1 instance(s).                          

  Instance "rcat", status READY, has 1 handler(s) for this service... #是动态注册出现的隐含服务,XMLDB

    Handler(s):

      "D000" established:0 refused:0 current:0 max:1022 state:ready

         DISPATCHER <machine: station90.example.com, pid: 12730>

         (ADDRESS=(PROTOCOL=tcp)(HOST=station90.example.com)(PORT=44903))

The command completed successfully


小提示:crossdver软件可以让WINDOWNS程序装在linux上

本文出自 “Oracle个人学习笔记” 博客,请务必保留此出处http://wuchunqiang.blog.51cto.com/1022331/1851414

Oracle学习笔记之第六节网络介绍及配置,会话