有一次遇到了记录下。
#su到oracle用户下
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ sqlplus /nolog
SQL> conn /as sysdba
SQL> shutdown immediate 关闭数据库
SQL> startup 数据库启动
SQL> exit
[oracle@localhost ~]$ lsnrctl start 启用监听
停掉lsnrctl
[oracle@localhost ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-JAN-2018 08:00:14
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
启动lsnrctl
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-JAN-2018 08:00:23
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.241.155)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 22-JAN-2018 08:00:23
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/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.241.155)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
这个命令会列出Oracle Net Listener的进程
[oracle@localhost ~]$ netstat -antp | grep tnslsnr
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 192.168.241.155:1521 0.0.0.0:* LISTEN 6407/tnslsnr
[oracle@localhost ~]$
#退出oracle用户
[oracle@localhost ~]$ exit
logout
[root@localhost ~]#
用plsql连接到数据库,tnsnames.ora增加配置
TEST_DB155 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.241.155)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
有一次Linux的ip变了以后,出现了这个
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 01-SEP-2018 03:38:08
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.241.155)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
Linux Error: 99: Cannot assign requested address
Listener failed to start. See the error message(s) above...
进去改了下ip就好了
[oracle@localhost ~]$ vim /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
==============================================================
select * from dba_users; 查看数据库里面所有用户,前提是你是有dba权限的帐号,如sys,system
select * from all_users; 查看你能管理的所有用户!
select * from user_users; 查看当前用户信息 !
用system用户查看到SCOTT用户过期 ,TEST用户还没过期,所以SCOTT用户上不去。