Oracle

lsnrctl 不適用於 Ubuntu 14.04

  • July 28, 2021

我已經設法安裝Oracle 11gUbuntu 14.04很多痛苦。我最終設法安裝了它,但listener似乎沒有工作,甚至沒有響應任何命令。

/home/oracle/.bash_profile的是

R=$TMP; export TMPDIR

ORACLE_HOSTNAME=belgenet-test.localdomain; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
DB_HOME=$ORACLE_BASE/product/11.2.0/db_1; export DB_HOME
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_HOME_LISTNER=$ORACLE_HOME export ORACLE_HOME_LISTNER
ORACLE_TERM=xterm; export ORACLE_TERM
BASE_PATH=/usr/sbin:$PATH; export BASE_PATH
PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:$BASE_PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

我的hosts文件:

127.0.0.1       localhost
10.0.1.23      belgenet-test

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我的ORACLE_HOMEPATH變數正在工作:

oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ echo $PATH
/u01/app/oracle/product/11.2.0/db_1/bin:/u01/app/oracle/product/11.2.0/db_1/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/u01/app/oracle/product/11.2.0/db_1/OPatch:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/u01/app/oracle/product/11.2.0/db_1/OPatch:/usr/sbin:/u01/app/oracle/product/11.2.0/db_1/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/u01/app/oracle/product/11.2.0/db_1/OPatch:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

但是,lsnrctl命令根本不響應:

oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ lsnrctl status
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ lsnrctl start
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$

可能是什麼問題?

PS:我可以連接到sqlplus

編輯1:

我的listener.ora文件內容:

# listener.ora Network Configuration File: /u02/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = belgenet-test)(PORT = 1521))
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
   )
 )

ADR_BASE_LISTENER = /u01/app/oracle

編輯2:

我的tnsnames.ora文件:

ORCL =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.23)(PORT = 1521))
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = orcl)
   )
 )

tnsping orcl結果:

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 03-DEC-2015 17:12:15

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.23)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
TNS-12541: TNS:no listener

lsnrctl status根本不提供任何輸出

編輯3:

lsnrctl權限:

oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ ls -lah lsnrctl
-rwxr-xr-x 1 oracle oinstall 0 Aug 24  2013 lsnrctl

如果我執行chmod 755 lsnrctl,則lsnrctl根本無法處理錯誤消息-sh: lsnrctl: command not found,但chmod +x可以listener執行(仍然沒有輸出)。

的所有者lsnrctloracle:oinstall

編輯4:

所有權lsnrctl

oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ chmod 755 lsnrctl
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ lsnrctl start
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ chmod +x lsnrctl
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ lsnrctl start
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$ ls -lh lsnrctl
-rwxr-xr-x 1 oracle oinstall 0 Aug 24  2013 lsnrctl
oracle@belgenet-test:/u01/app/oracle/product/11.2.0/db_1/bin$

編輯5:

好的,我有問題。ls命令顯示lsnrctl文件大小為 0 字節。我從另一台電腦複製lsnrctl,現在它給出了一個輸出(雖然仍然是一個錯誤):

oracle@belgenet-test:~$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 04-DEC-2015 09:27:31

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

Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
 TNS-00517: Lost contact
  Linux Error: 32: Broken pipe

您的 lsnrctl 有 0 個字節,因此您沒有正確安裝 Oracle 軟體或者您的安裝已損壞。所以重新安裝Oracle軟體。

您的文件中似乎ADDRESS_LIST缺少一行 ( ) :listener.ora

LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = BELGENETTEST)(PORT = 1521))
       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
     )
   )
 )

該命令lsnrctl status應給出輸出及其參數和在此伺服器上執行的數據庫列表。

檢查network\admin客戶端電腦上的目錄以檢查您是否有包含tnsnames.ora連接數據庫資訊的文件。用命令檢查它tnsping orcl

引用自:https://dba.stackexchange.com/questions/122800