尝试登录oracle
使用root用户将没有sqlplus命令
[root@localhost ~]# sqlplus /nolog
bash: sqlplus: 未找到命令...
 
 
[root@localhost ~]# su oracle
[oracle@localhost root]$ sqlplus /nolog
bash: sqlplus: 未找到命令...
 
 
切换为oracle账户尝试登录oracle 此处的/和as之间要有空格 而且只有用oracle账户登录才能生效 否则会提示输入账号密码。
[oracle@localhost ~]$ 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
[oracle@localhost ~]$ 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监听的状态发现监听没有开启
[oracle@localhost ~]$ 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
 
开启监听
[oracle@localhost ~]$ 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
[root@localhost 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.

[root@localhost 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

重启一下:

[root@localhost oracle]# service iptables restart

此处就是配置文件里的配置了:
Redirecting to /bin/systemctl restart  iptables.service
[root@localhost 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

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

  1. Linux下启动Oracle服务和监听程序步骤

    Linux下启动Oracle服务和监听程序启动和关闭步骤整理如下: 1.安装oracle: 2.创建oracle系统用户: 3./home/oracle下面的.bash_profile添加几个环境变量 ...

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

    $ su – oracle $ sqlplus / nolog sql> conn / as sysdba sql> startup                 #启动Oracle,需 ...

  3. linux启动oracle服务 和监听

    (1) su - oracle 切换成oracle 用户 (2)sqlplus / as sysdba (3)startup: (4)quit:退出sql模式 exit 退出oracle用户 (5)l ...

  4. cmd启动Oracle服务和监听服务

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

  5. 【不积跬步,无以致千里】Linux下启动Oracle服务和监听程序

    oracle数据库是重量级的,其管理非常复杂,将其在linux平台上的启动和关闭步骤整理一下. 安装完毕oracle以后,需要创建oracle系统用户,并在/home/oracle下面的.bash_p ...

  6. linux下如何开启oracle服务和开启监听

    su - oracle  切换到oracle用户模式下 sqlplus /nolog  //登录sqlplus SQL> connect /as sysdba  //连接oracle SQL&g ...

  7. tomcat启动成功但是没有监听8080端口

    查看tomcat日志 cd tomcat/logs tailf -1000 catlina.out 错误如下: /home/work/jdk/jdk-10.0.1/jre/bin/java: No s ...

  8. linux下启动oracle服务命令

    以redflag(redhat /centos)linux下的 oracle 10g 为例: 如果oracle安装和配置都没有问题的话: 依次执行以下代码即可启动oracle服务. #su - ora ...

  9. linux下oracle数据库服务和监听的启动停止

    oracle数据库是重量级的,其管理非常复杂,将其在linux平台上的启动和关闭步骤整理一下. 安装完毕oracle以后,需要创建oracle系统用户,并在/home/oracle下面的.bash_p ...

随机推荐

  1. Git 常用命令大全-转载

    一. Git 常用命令速查 git branch 查看本地所有分支git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支git branch -r ...

  2. python多媒体文件抽取

    多文件抽取有:只获取url,或直接下载,下面是怎么将数据下载下来,并显示进度. 本节主要介绍urllib模块提供的urlretrieve()函数.urlretrieve()方法直接将远程数据下载到本地 ...

  3. 串口使用和CSerial类

    1 串口通信的基本原理 串口通信中无论是写入串口还是读取串口,都是对缓冲区操作的.可以理解为写串口就是向输出缓冲区写入内容,读取串口就是从输入串口缓冲区读取内容.但是何时打开串口,何时发送数据,何时接 ...

  4. 增加游戏受众:在英特尔核显上运行MR游戏

    为了获得良好的用户体验,通常VR游戏需要稳定在每秒90帧,这意味着整个场景只有11.1毫秒的时间来进行左右眼渲染,这就是为何VR游戏需要配备高端的独立显卡.现在来看看我们如何使用最新版英特尔图形性能分 ...

  5. Django-给视图加装饰器

    给FBV加装饰器 FBV:function based view FBV本身就是一个函数,所以跟普通函数加装饰器是一样的 # 装饰函数是要在APP文件中定义,本例是在app01\templatetag ...

  6. configparser模块 subprocess 模块,xlrd 模块(表格处理)

    今日内容: 1.configparser模块 2.subprocess模块 3.xlrd(读),xlwt(写) 表格处理 configparser模块 import configparser # co ...

  7. Go语言入门篇-网络经验

    Go语言学习手册 golang*看云  golang圣经 wuYinIO 1.go语言开发中的坑 go新手容易犯的三个致命错误   Golang 需要避免踩的 50 个坑 2.go语言数据类型 map ...

  8. 51CTO下载-html+javascript+css学习宝典

    一.html知识 1. meta标签 Meta: 提供网页信息,搜索引擎使用 <meta name=“aa” content=“bbb”> <meta http-equiv=“exp ...

  9. 一篇文章搞懂python2、3编码

    说在前边: 编码问题一直困扰着每一个程序员的编程之路,如果不将它彻底搞清楚,那么你的的这条路一定会走的格外艰辛,尤其是针对使用python的程序员来说,这一问题更加显著, 因为python有两个版本, ...

  10. MSSQL 索引

    INCLUDE索引作用:减少 key lookup所带来的性能开销. 效率主要体现在覆盖查询(建的索引为覆盖索引),在查询时把SELECT显示列放在INCLUDE里作为非索引健列,不用于查询只显示在结 ...