数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

Oracle Net8 网络配置和联接


发布日期:2021年08月16日
 
Oracle Net8 网络配置和联接

1)服务器端配置Listener

添加Listeners 设置选择 DataBase Name方式填写个参数 { HomeDir = /ora/ SID =ora }

2)启动Net服务lsnrctl start

3)停止Net服务lsnrctl stop

4)参数文件摘要

5)客户端配置添加 Net Service Name 同Windows客户端一样格式

1)服务器端配置Listener

执行/ora/bin/netasst

填写描述>首选Oracle服务

PROTOCOL = TCP

HOST =

PORT =

查看生成的 Net Server配置文件listenerora

[oracle@lin admin]$ more listenerora

# LISTENERORA Configuration File:/ora/network/admin/listenerora

# Generated by Oracle Net Assistant

LISTENER =

(DESCRIPTION =

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

  (PROTOCOL_STACK =

    (PRESENTATION = TTC)

    (SESSION = NS)

  )

)

SID_LIST_LISTENER =

(SID_LIST =

  (SID_DESC =  

   (ORACLE_HOME = /ora)

   (SID_NAME = ora)

  )

)

### 如果指明监听服务的全局名则有类似这一行(GLOBAL_DBNAME = ora)

2)启动Net服务lsnrctl start

首先你可以这样取得帮助

[oracle@lin /ora]$ lsnrctl

LSNRCTL> help

然后开始启动start

[oracle@lin bin]$ lsnrctl start

联接时机器会逐步告诉你正在启动…正在联接…已经联接的状态最后他说成功啦! 下面是一些简要信息

LSNRCTL for Linux: Version Production on NOV ::

(c) Copyright Oracle Corporation All rights reserved

Starting /ora/bin/tnslsnr: please wait

TNSLSNR for Linux: Version Production

System parameter file is /ora/network/admin/listenerora

Log messages written to /ora/network/log/listenerlog

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))

(PROTOCOL_STACK=(PRESENTATION=TTC)(SESSION=NS)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))

(PROTOCOL_STACK=(PRESENTATION=TTC)(SESSION=NS)))

STATUS of the LISTENER

Alias LISTENER

Version TNSLSNR for Linux: Version Production

Start Date NOV ::

Uptime days hr min sec

Trace Level off

Security OFF

SNMP OFF

Listener Parameter File /ora/network/admin/listenerora

Listener Log File /ora/network/log/listenerlog

Services Summary

ora has service handler(s)

The command completed successfully

以上提示说个服务被处理命令成功完成

3)停止Net服务lsnrctl stop

最简单的方法是 [oracle@lin /ora]$ lsnrctl stop

有时侯进程出了差错tnslsnr没有响应像WindowsNT常犯的毛病一 样

这里有一个强硬的手段先找出它的进程号然后 kill掉!

[oracle@lin /ora]$ ps ef|grep tns

oracle : ? :: /ora/bin/tnslsnr LISTENER inher

或使用更少的参数也能找到tnslsnr:

[oracle@lin /ora]$ ps e

PID TTY TIME CMD

? :: tnslsnr

现在杀死PID = 的进程

[oracle@lin /ora]$ kill

LSNRCTL象 SVRMGRL一样是一个服务器管理程序有不少参数或者说是 子程序带星号的是一个外部程序

[oracle@lin bin]$ lsnrctl stop

LSNRCTL for Linux: Version Production on NOV ::

(c) Copyright Oracle Corporation All rights reserved

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))

(PROTOCOL_STACK=(PRESENTATION=TTC)(SESSION=NS)))

The command completed successfully

Listeners =DataBase Name = Global DB Name =ora HomeDir = /ora/ SID =ora

[oracle@lin oracle]$ cd /ora/net*/ad*

[oracle@lin admin]$ ls

listenerora namesinisql samples sqlnetora

namesdrpsql namesupgsql sqlnetfdf tnsnamesora

下面是在 Windwos NT/ 上远程控制 TNSLSNR 的情形(图略)

4)参数文件摘要

[oracle@lin admin]$ more /u/app/oracle/admin/ora/pfile/initoraora

db_name = ora

instance_name = ora ## 事例名是关键字

service_names = ora

control_files = (/u/app/oracle/oradata/ora/controlctl /u/app/oracle/oradata/ora/controlctl)

db_block_buffers =

shared_pool_size =

log_checkpoint_interval =

log_checkpoint_timeout =

processes =

log_buffer =

log_archive_start = true

log_archive_dest_ = location=/u/app/oracle/admin/ora/arch

log_archive_format = %t_%sdbf

# 切记打开回滚段

rollback_segments = (r r r r)

# global_names = false ### 监听服务无需指明全局名

# oracle_trace_enable = true

# define directories to store trace and alert files

background_dump_dest = /u/app/oracle/admin/ora/bdump

core_dump_dest = /u/app/oracle/admin/ora/cdump

user_dump_dest = /u/app/oracle/admin/ora/udump

db_block_size =

remote_login_passwordfile = exclusive

os_authent_prefix =

compatible = ## 也可以兼容

)客户端网络配置

[oracle@lin admin]$ more tnsnamesora

# TNSNAMESORA Configuration File:/ora/network/admin/tnsnamesora

# Generated by Oracle Net Assistant

使用net助理结果自动保存在 tnsnamesora 中

[oracle@lin /ora]$ netass* 添加Service: 名称ora参数如下

PROTOCOL=TCP HOST= PORT= Oracle_SID=ora

机器解释成一个Oracle服务器地址包

( DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))

  (PROTOCOL_STACK=(PRESENTATION=TTC)(SESSION=NS))

)

一般说来客户端采用Windowsx/NT/因为这里软件开发容易程序员和工具较为普及

Windows 客户端网络配置与此类似其内容见于: \OraNT\net\Admin\tnsnameora

ORAWORLD =

  (DESCRIPTION =

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

    (CONNECT_DATA = (SID = ora))

  )

    在Windows(beta专业版)中安装Personal Oeacle监听服务安装失败

只要理解以上oracle结构原理可以手工复制Net文件修改配置

copy CDROM\\NT_x\server\lsnrctlexetnslsnrexetnspingexe  C:\orant\bin

copy CDROM\\listenerora  C:\orant\net\admin

我不久前有这么一次经历               

上一篇:JDBC存取ORACLE大型数据对象LOB几种情况的示范类

下一篇:某个数据文件损坏,如何打开数据库?