系统:Redhat linux
因为服务器虚拟机是复制别一个服务器过来的,换了IP,然后我一直起监督听与实例都无法联接数据库,最后查到根本的原因:
是因为更改IP了,hostIP也需要更改。
具体需要修改两个文件:
1、vi /etc/hosts文件,将IP修改成本机的IP
[oracle@plmdb ~]$ vi /etc/hosts
打开文件,按I进入编辑模式输入本机IP
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.2.1.223 plm
2、vi /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
[oracle@plmdb admin]$ vi /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
打开文件,按I进入编辑模式更改HOST
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = plm)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
修改为本机IP和上面的保持一致。如果不知道路径,可通过先停止监听(lsnrctl stop)再重启(lsnrctl start)的方式查看监听文件的所在位置。
首先使用oracle 用户登录liunx,然后在shell命令中执行下面的命令:
第1步:打开oracle 监听
$lsnrctl start
[oracle@plmdb ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-AUG-2017 13:23:58
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/plmdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=plm)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=plm)(PORT=1521)))
STATUS of the LISTENER
注释:
对于 Linux LSNRCTL: 版本 11.2.0.4.0-生产在 2017 年 8 月 15 日 13:23:58
版权所有 (c) 1991 年,2013 年,甲骨文。保留所有权利。
开始 /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: 请稍等...
对于 Linux TNSLSNR: 版本 11.2.0.4.0-生产
系统参数文件是 /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
日志消息写入 /u01/app/oracle/diag/tnslsnr/plmdb/listener/alert/log.xml
侦听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=plm)(PORT=1521)))
连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=plm)(PORT=1521)))
侦听器的状态
第2步:进入sqlplus
$sqlplus /nolog
SQL>
[oracle@plmdb ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 15 13:24:21 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL>
注释:
SQL * Plus: 在 8 月 15 日星期二发布 11.2.0.4.0 生产 13:24:21 2017年
版权所有 (c) 1982 年,2013 年,甲骨文。保留所有权利。
第3步:使用sysdba角色登录sqlplus
SQL>conn /as sysdba
SQL> conn /as sysdba
Connected to an idle instance.
注释:
连接到一个空闲的实例。
第4步:启动数据库
SQL>startup
经过上面四个步骤,oracle数据库就可以联接了。
SQL> startup
ORACLE instance started.
Total System Global Area 1.3395E+10 bytes
Fixed Size 2265904 bytes
Variable Size 6543117520 bytes
Database Buffers 6845104128 bytes
Redo Buffers 4759552 bytes
Database mounted.
Database opened.
SQL>
注释:
启动 ORACLE 实例。
总系统全局区 1.3395E 10 个字节
固定的大小 2265904 字节
可变大小 6543117520 字节
数据库缓冲区 6845104128 字节
重做缓冲区 4759552 字节
已装入的数据库。
打开的数据库。
总代码:
[oracle@plmdb ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-AUG-2017 13:23:58
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/plmdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=plm)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=plm)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 15-AUG-2017 13:23:59
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/plmdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=plm)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@plmdb ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 15 13:24:21 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL>
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1.3395E+10 bytes
Fixed Size 2265904 bytes
Variable Size 6543117520 bytes
Database Buffers 6845104128 bytes
Redo Buffers 4759552 bytes
Database mounted.
Database opened.
SQL>
所有评论(0)