Code: Select all
LISTENER_FILE=`cat $ORACLE_HOME/network/admin/listener.ora | grep "PORT"`
EXISTING_PORT=${LISTENER_FILE##*=}
EXISTING_PORT=${EXISTING_PORT%%\)*}
if [ -z "$LISTENER_PORT" ] && [ -z "$EXISTING_PORT" ]
then
echo
echo "***Enter LISTENER_PORT (only applicable to new listener) : "
else
echo
echo "***Current LISTENER_PORT =$EXISTING_PORT"
echo "***Press <ENTER> to retain the Current value : "
f
the content of listener.ora is as follow:
Code: Select all
# listener.ora Network Configuration File: C:\app\chleng\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
#Default LISTENER.ORA file
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = TIMHALL)
(SID_NAME = TIMHALL)
)
(SID_DESC =
(GLOBAL_DBNAME = Oracle8)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bn-william)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
)
ADR_BASE_LISTENER = C:\app\william
so how do I convert the above code so that I can extract the port number?
thanks