OLR and LISTENER resource.

OLR and LISTENER resource.

When you create resource LISTENER you must use following settings (listener name, oracle home, ports). But when you create it you haven’t set some important settings.

[oracle@server ~]$ srvctl config listener
Name: LISTENER
Home: /opt/oracle/product/rdbms1123
End points: TCP:1521/IPC:EXTPROC

[oracle@server ~]$ srvctl getenv listener
LISTENER:

We haven’t set TNS_ADMIN, NLS_LANG. It is clear for understand if we want to set this parameter we should use setenv.

[oracle@server ~]$ srvctl setenv listener -h

Sets the listener's environment values.

Usage: srvctl setenv listener [-l <lsnr_name>] -t "<name>=<val> [,...]" | -T "<name>=<value>"
 -l <lsnr_name> Listener name
 -t "<name>=<val>,.." Names and values of environment variables
 -T "<name>=<val>" Name and value of a single environment variable
 -h Print usage
[oracle@server ~]$ srvctl modify listener -h

Modifies the configuration for the listener.

Usage: srvctl modify listener [-l <lsnr_name>] [-o <oracle_home>] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"]
 -l <lsnr_name> Listener name (default name is LISTENER)
 -o <oracle_home> ORACLE_HOME path
 -p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]" Comma separated tcp ports or listener endpoints
 -h Print usage
[oracle@server ~]$ srvctl setenv listener -t NLS_LANG=AMERICAN_AMERICA.UTF8

[oracle@server ~]$ srvctl getenv listener
LISTENER:
NLS_LANG=AMERICAN_AMERICA.UTF8

But what happen if we set different ORACLE_HOME through setenv?

[root@server ~]# strings /proc/19890/environ |grep ORACLE_HOME
ORACLE_HOME=/opt/oracle/product/rdbms1123

[oracle@server ~]$ srvctl setenv listener -t ORACLE_HOME=/opt/oracle/product/grid1123

[oracle@server ~]$ srvctl getenv listener
LISTENER:
NLS_LANG=AMERICAN_AMERICA.UTF8
ORACLE_HOME=/opt/oracle/product/grid1123

[oracle@server ~]$ srvctl stop listener
[oracle@server ~]$ srvctl start listener

[root@server ~]# strings /proc/25423/environ |grep ORACLE_HOME
ORACLE_HOME=/opt/oracle/product/grid1123

ORACLE_HOME variable in process environments was rewrited!

One more thing, how look resource through crsctl

[root@server ~]# crsctl status resource ora.LISTENER.lsnr -f -t -init
NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
STATE=ONLINE
TARGET=ONLINE
ACL=owner:oracle:rwx,pgrp:dba:r-x,other::r--,group:dba:r-x,user:oracle:rwx
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%
ALIAS_NAME=
AUTO_START=restore
CHECK_INTERVAL=60
CHECK_TIMEOUT=30
CREATION_SEED=138
DEFAULT_TEMPLATE=PROPERTY(RESOURCE_CLASS=listener) PROPERTY(LISTENER_NAME=PARSE(%NAME%, ., 2))
DEGREE=1
DESCRIPTION=CRS resource type for the Listener
ENABLED=1
ENDPOINTS=TCP:1521 IPC:EXTPROC
ID=ora.LISTENER.lsnr
LOAD=1
LOGGING_LEVEL=1
NLS_LANG=
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
ORACLE_HOME=/opt/oracle/product/rdbms1123
PORT=1521
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=60
START_DEPENDENCIES=
START_TIMEOUT=180
STATE_CHANGE_TEMPLATE=
STOP_DEPENDENCIES=
STOP_TIMEOUT=0
TYPE_VERSION=1.2
UPTIME_THRESHOLD=1d
USR_ORA_ENV=NLS_LANG=AMERICAN_AMERICA.UTF8 ORACLE_HOME=/opt/oracle/product/grid1123
USR_ORA_OPI=false
VERSION=11.2.0.3.0

ORACLE_HOME variable will not change if we use config/modify unlike USR_ORA_ENV who change every time when we use setenv.

setenv very important for resources/processes environment settings!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s