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

尝试登录oracle

使用root用户将没有sqlplus命令

[[email protected] ~]# sqlplus /nolog

bash: sqlplus: 未找到命令...

[[email protected] ~]# su oracle

[[email protected] root]$ sqlplus /nolog

bash: sqlplus: 未找到命令...

切换为oracle账户尝试登录oracle 此处的/和as之间要有空格 而且只有用oracle账户登录才能生效 否则会提示输入账号密码。

[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri May 26 22:56:08 2017

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

Connected to an idle instance.

发现oracle没有启动

SQL> select 1 from dual;

select 1 from dual

*

ERROR at line 1:

ORA-01034: ORACLE not available

Process ID: 0

Session ID: 0 Serial number: 0

启动oracle

SQL> startup

ORACLE instance started.

Total System Global Area  839282688 bytes

Fixed Size    2217992 bytes

Variable Size  494929912 bytes

Database Buffers  335544320 bytes

Redo Buffers    6590464 bytes

Database mounted.

Database opened.

SQL> select 1 from dual;

1

----------

1

查看开放的端口没有1521

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[[email protected] ~]$ nmap 127.0.0.1

Starting Nmap 6.40 ( http://nmap.org ) at 2017-05-26 22:57 CST

Nmap scan report for localhost (127.0.0.1)

Host is up (0.0011s latency).

Not shown: 996 closed ports

PORT    STATE SERVICE

22/tcp  open  ssh

25/tcp  open  smtp

111/tcp open  rpcbind

631/tcp open  ipp

Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds

查看oracle监听的状态发现监听没有开启

[[email protected] ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-MAY-2017 22:58:03

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

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

TNS-12541: TNS:no listener

TNS-12560: TNS:protocol adapter error

TNS-00511: No listener

Linux Error: 111: Connection refused

开启监听

[[email protected] ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-MAY-2017 22:58:11

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

Starting /u01/oracle/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production

System parameter file is /u01/oracle/network/admin/listener.ora

Log messages written to /u01/diag/tnslsnr/localhost/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))

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

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-MAY-2017 22:58:11

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/oracle/network/admin/listener.ora

Listener Log File         /u01/diag/tnslsnr/localhost/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))

The listener supports no services

The command completed successfully

再次查看端口已经有了1521

[[email protected] oracle]# nmap 127.0.0.1

Nmap scan report for localhost (127.0.0.1)

Host is up (0.000043s latency).

Not shown: 995 closed ports

PORT     STATE SERVICE

22/tcp   open  ssh

25/tcp   open  smtp

111/tcp  open  rpcbind

631/tcp  open  ipp

1521/tcp open  oracle

但是在虚拟机外部仍然无法联通,telnet 1521端口失败,怀疑是防火墙,然后修改防火墙的配置文件解决。修改防火墙参考:http://blog.csdn.net/barryxt/article/details/18040335

在修改防火墙配置的时候,发现了一个问题。即使在/etc/sysconfig/iptables里配置了防火墙规则,在系统启动的时候是不生效的,要执行重启命令service iptables restart才能生效,否则读取的不是/etc/sysconfig/iptables的配置,而是系统的默认配置,如下:

此时是默认化配置吧?只有22.

[[email protected] oracle]#  iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0          
INPUT_direct  all  --  0.0.0.0/0            0.0.0.0/0          
INPUT_ZONES_SOURCE  all  --  0.0.0.0/0            0.0.0.0/0          
INPUT_ZONES  all  --  0.0.0.0/0            0.0.0.0/0          
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0          
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0          
FORWARD_direct  all  --  0.0.0.0/0            0.0.0.0/0          
FORWARD_IN_ZONES_SOURCE  all  --  0.0.0.0/0            0.0.0.0/0          
FORWARD_IN_ZONES  all  --  0.0.0.0/0            0.0.0.0/0          
FORWARD_OUT_ZONES_SOURCE  all  --  0.0.0.0/0            0.0.0.0/0          
FORWARD_OUT_ZONES  all  --  0.0.0.0/0            0.0.0.0/0          
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0          
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        
OUTPUT_direct  all  --  0.0.0.0/0            0.0.0.0/0

Chain FORWARD_IN_ZONES (1 references)
target     prot opt source               destination        
FWDI_public  all  --  0.0.0.0/0            0.0.0.0/0           [goto]
FWDI_public  all  --  0.0.0.0/0            0.0.0.0/0           [goto]

Chain FORWARD_IN_ZONES_SOURCE (1 references)
target     prot opt source               destination

Chain FORWARD_OUT_ZONES (1 references)
target     prot opt source               destination        
FWDO_public  all  --  0.0.0.0/0            0.0.0.0/0           [goto]
FWDO_public  all  --  0.0.0.0/0            0.0.0.0/0           [goto]

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target     prot opt source               destination

Chain FORWARD_direct (1 references)
target     prot opt source               destination

Chain FWDI_public (2 references)
target     prot opt source               destination        
FWDI_public_log  all  --  0.0.0.0/0            0.0.0.0/0          
FWDI_public_deny  all  --  0.0.0.0/0            0.0.0.0/0          
FWDI_public_allow  all  --  0.0.0.0/0            0.0.0.0/0

Chain FWDI_public_allow (1 references)
target     prot opt source               destination

Chain FWDI_public_deny (1 references)
target     prot opt source               destination

Chain FWDI_public_log (1 references)
target     prot opt source               destination

Chain FWDO_public (2 references)
target     prot opt source               destination        
FWDO_public_log  all  --  0.0.0.0/0            0.0.0.0/0          
FWDO_public_deny  all  --  0.0.0.0/0            0.0.0.0/0          
FWDO_public_allow  all  --  0.0.0.0/0            0.0.0.0/0

Chain FWDO_public_allow (1 references)
target     prot opt source               destination

Chain FWDO_public_deny (1 references)
target     prot opt source               destination

Chain FWDO_public_log (1 references)
target     prot opt source               destination

Chain INPUT_ZONES (1 references)
target     prot opt source               destination        
IN_public  all  --  0.0.0.0/0            0.0.0.0/0           [goto]
IN_public  all  --  0.0.0.0/0            0.0.0.0/0           [goto]

Chain INPUT_ZONES_SOURCE (1 references)
target     prot opt source               destination

Chain INPUT_direct (1 references)
target     prot opt source               destination

Chain IN_public (2 references)
target     prot opt source               destination        
IN_public_log  all  --  0.0.0.0/0            0.0.0.0/0          
IN_public_deny  all  --  0.0.0.0/0            0.0.0.0/0          
IN_public_allow  all  --  0.0.0.0/0            0.0.0.0/0

Chain IN_public_allow (1 references)
target     prot opt source               destination        
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW

Chain IN_public_deny (1 references)
target     prot opt source               destination

Chain IN_public_log (1 references)
target     prot opt source               destination

Chain OUTPUT_direct (1 references)
target     prot opt source               destination

重启一下:

[[email protected] oracle]# service iptables restart

此处就是配置文件里的配置了:
Redirecting to /bin/systemctl restart  iptables.service
[[email protected] oracle]#  iptables -n -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0          
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0          
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:1521
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

时间: 2024-10-30 01:39:49

Linux下的启动oracle服务 启动监听 开放端口操作的相关文章

Linux下启动Oracle服务和监听程序

注:如果读者是出现监听无法启动 请参阅本人实录解决办法:http://blog.csdn.net/johnstrive/archive/2009/08/06/4418481.aspx Oracle数据库是重量级的,其管理非常复杂,将其在Linux平台上的启动和关闭步骤整理一下. 安装完毕oracle以后,需要创建oracle系统用户,并在/home/oracle下面的.bash_profile添加几个环境变量:ORACLE_SID,ORACLE_BASE,ORACLE_HOME.比如: expo

cmd启动Oracle服务和监听服务

启动数据库服务 net start oracleserviceorcl 启动数据库监听 lsnrctl start

linux下启动oracle服务命令

以redflag(redhat /centos)linux下的 oracle 10g 为例: 如果oracle安装和配置都没有问题的话: 依次执行以下代码即可启动oracle服务. #su - oracle $sqlplus / as sysdba >startup >exit $lsnrctl start $ps -ef|grep oracle ps -ef|grep oracle为查看oracle服务,如果现实列表服务一般表示oracle服务已经启动.

Linux Oracle服务启动&停止脚本与开机自启动

在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介绍一般而言如何启动oracle. 一.在Linux下启动Oracle 登录到CentOS,切换到oracle用户权限 # su – oracle 接着输入: $ sqlplus "/as sysdba" 原本的画面会变为SQL> 接着请输入SQL> startup 就可以正常的

Linux Oracle服务启动&停止脚本与开机自启动

Linux Oracle服务启动&停止脚本与开机自启动 http://www.cnblogs.com/mchina/archive/2012/11/27/2782993.html Linux Oracle服务启动&停止脚本与开机自启动

linux下安装及配置和启动memcached

一.下载文件: 下载memcached和libevent,放到/hom/zwl/目录下 # wget http://www.danga.com/memcached/dist/memcached-1.2.0.tar.gz # wget http://www.monkey.org/~provos/libevent-1.2.tar.gz 由于memcached需要Lievent的支持,so,首先对Libevent做个简单的介绍: Libevent是一个轻量级的开源高性能网络库 上来当然要先夸奖啦,Li

Linux下Redis的部署和启动笔记

Linux下Redis的部署和启动 下载安装介质 Redis官网地址:http://www.redis.io/目前最新版本是redis-3.0.3. 可以访问 http://download.redis.io/releases/redis-3.0.3.tar.gz 下载后使用SCP上传到服务器, 或者直接下载: wget http://download.redis.io/releases/redis-3.0.3.tar.gz 解压及编译 [email protected]:/data$ tar

mongodb-2.6.0 在win7 64下的安装和服务启动

转自: http://blog.csdn.net/lingchen214/article/details/24537629 1   自定义安装到C:\mongodb目录下. 2  手动在C:\mongodb目录下创建data\db和logs两个文件夹 3  以管理员身份启动cmd,进入到c:\mongodb\bin为当前目录. c:\mongodb\bin>  echo logpath=c:\mongodb\logs\mongodb.log> c:\mongodb\mongod.cfg c:\

Linux下memcache的安装和启动

memcache是高性能,分布式的内存对象缓存系统,用于在动态应用中减少数据库负载,提升访问速度.据说官方所说,其用户包括twitter.digg.flickr等,都是些互联网大腕呀.目前用memcache解决互联网上的大用户读取是非常流行的一种用法. 下载安装 下载了,我到了其官方(http://memcached.org/),目前最新的下载版本是1.4.5 还要再安装libevent这个软件,从官方(http://monkey.org/~provos/libevent/)下载,目前最新的稳定