配置和自动启动Oracle的监听(lsnrctl)

标签: oracle lsnrctl 自动启动
13874人阅读 评论(0) 收藏 举报

配置Oracle lsnrctl 和自动启动

1.设置主机名称
[root@www ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=www.redhat6.com

2.设置主机名称与IP地址的对应
[root@www ~]# cat /etc/hosts
127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4
::1          localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.16 www.redhat6.com

3.修改:/u01/app/oracle/network/admin/listener.ora
[oracle@www admin]$ cat listener.ora 
# listener.ora Network Configuration File: /u01/app/oracle/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = www.redhat6.com)(PORT = 1521))
    )
  )


ADR_BASE_LISTENER = /u01/app

4.修改:/u01/app/oracle/network/admin/tnsnames.ora
[oracle@www admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = www.redhat6.com)
    )
  )

5.lsnrctl 的常用方法
[oracle@www admin]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 29-NOV-2013 21:56:57

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

Welcome to LSNRCTL, type "help" for information.
LSNRCTL> help
The following operations are available
An asterisk (*) denotes a modifier or extended command:

start               stop                status              
services            version             reload              
save_config         trace               spawn               
change_password     quit                exit                
set*                show* 


lsnrctl start  -- 启动监听
lsnrctl stop   -- 停止监听
lsnrctl status -- 查看状态

6.设置Oracle数据库和lsnrct自动启动方法

(我的机器是RedHat6_64,Oracle11g)

6.1.编辑: /etc/oratab

[root@www ~]# cat /etc/oratab 
#



# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
#orcl:/u01/app/oracle:N
orcl:/u01/app/oracle:Y    #这里把"N"改为"Y"


6.2.修改 /etc/rc.local

[root@www ~]# cat /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

# 添加下面两条
su - oracle -c 'dbstart'
su - oracle -c 'lsnrctl start'


6.3.重新启动系统.Oracle数据库正常启动.监听也启动了.

[oracle@www ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Nov 29 21:49:56 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select status from v$instance;

STATUS
------------
OPEN


 

[oracle@www ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 29-NOV-2013 22:03:23

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=www.redhat6.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                29-NOV-2013 21:25:24
Uptime                    0 days 0 hr. 37 min. 59 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/network/admin/listener.ora
Listener Log File         /u01/app/diag/tnslsnr/www/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=www.redhat6.com)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

 

其它问题:

关闭linux防火墙:

暂时关闭:
service iptables stop

永久性,需重启:
chkconfig iptables off

[root@www ~]# chkconfig --list | grep iptables
iptables       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@www ~]# chkconfig iptables off
[root@www ~]# chkconfig --list | grep iptables
iptables       	0:off	1:off	2:off	3:off	4:off	5:off	6:off


关闭selinux:

1 永久方法 – 需要重启服务器
修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。

2 临时方法 – 设置系统参数
使用命令setenforce 0
附:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式


 

查看评论

Oracle LSNRCTL------监听器的启动和关闭

      对于DBA来说,启动和关闭oracle监听器是很基础的任务,但是Linux系统管理员或者程序员有时也需要在开发数据库中做一些基本的DBA操作,因此了解一些基本的管理操作对他们来说很重要。 ...
  • zjliu1984
  • zjliu1984
  • 2009-06-16 14:31:00
  • 27144

监听总结之3.监听命令:lsnrctl工具的三个命令start、stop和status都是分步执行的

首先,我们需要知道两个事情: 1、lsnrctl工具下的三个命令,分别是status、stop、start。 我们从三个命令执行后在屏幕上显示的结果来看,可以发现一个共性,就是都有“正在连接到”这句话...
  • haiross
  • haiross
  • 2013-11-07 14:51:17
  • 9506

oracle服务器重启后监听启动

1、检查oracle数据库是否启动:ps -ef | grep ora 2、检查Oracle DB监听器是否正常:          输入:lsnrctl status检查监听是否启动,如未启动 ...
  • jjwyll
  • jjwyll
  • 2017-03-09 16:03:53
  • 6007

oracle 监听启动、停止、查看命令

Oracle配置好环境变量,则cd $ORACLE_HOME即可定位到Oracle主目录 1.su oracle 然后启动监听器 1.lsnrctl start 会看到启动成功的...
  • zwj1030711290
  • zwj1030711290
  • 2017-03-20 17:42:19
  • 3588

lsnrctl start

在oracle用户下使用lsnrctl start来启动监听程序,但是发现报了如下错误: oracle@Web2:~> lsnrctl start LSNRCTL for Linux: Vers...
  • Fighter_wjl
  • Fighter_wjl
  • 2011-11-07 10:04:36
  • 487

遭遇lsnrctl start错误

[oracle@Oracle9iDemo ~]$ lsnrctl startLSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-DEC-2...
  • DB_Wade
  • DB_Wade
  • 2009-12-14 17:27:00
  • 3025

oracle 监听 lsnrctl 命令

listener control 监听控制 因为你在键入 lsnrctl 回车之后,就进入到监听控制界面。 $lsnrctl start   --启动监听进程 $lsnrctl statu...
  • snowfoxmonitor
  • snowfoxmonitor
  • 2015-08-16 07:53:41
  • 4162

个人总结:oracle数据库监听服务启动不成功

1。IP错误。 在设置URL时错误,例如:jdbc:oracle:thin:@192.168.0.36:1521:sharp 数据库服务器不正确:ping 服务器IP是否正确。不正确,将URL更改为正...
  • hustwht
  • hustwht
  • 2016-08-17 00:15:54
  • 12698

Oracle 11g 监听服务启动不了

监听日志显示: Tue Apr 18 20:35:36 2017 Message 459 not found; No message file for product=NETWORK, f...
  • u010673851
  • u010673851
  • 2017-04-18 20:48:14
  • 639

oracle11gR2单机设置开机自启动监听和数据库

设置开机自启动: 以下两个文件需要根据注释修改: vi /etc/oratab orcl:/u01/app/oracle/product/11.2.0/db_home:N 把N改成Y就可以了 vi /...
  • z2916310960
  • z2916310960
  • 2017-03-03 13:54:06
  • 2111
    个人资料
    专栏达人 持之以恒
    等级:
    访问量: 74万+
    积分: 9218
    排名: 2870
    博客专栏
    文章分类
    最新评论