Friday, March 26, 2010

How to set oracle listener password

In general there are three ways by which you can set Oracle database listener password.
A. Editing the listener.ora file directly and setting the password within it.
B. Using lsnrctl utility.
C. Using GUI such as Oracle Net Manager or Enterprise Manager.

A. Editing the listener.ora file directly and setting the password within it:
Through this method password is stored in a plain text format inside listener.ora file without any encryption. Note that, through this way it is possible to set more than one listener password. Following steps demonstrate the procedure.

Step 01: Locate the listener.ora file. Based on the operating system and environmental settings the location varies. The default location is $ORACLE_HOME/network/admin or if you set TNS_ADMIN environmental variable then it overrides default location. Alternatively, if your listener is up you can issue "lsnrctl status" command to check the location of listener.ora file.
E:\>lsnrctl status

LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 27-MAR-2010 09:40:38

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date                27-MAR-2010 09:36:06
Uptime                    0 days 0 hr. 4 min. 32 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   E:\oracle\product\10.2.0\db_2\network\admin\listener.ora
Listener Log File         E:\oracle\product\10.2.0\db_2\network\log\listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "a" has 1 instance(s).
  Instance "a", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

Step 02: After you locate listener.ora file check its contents.
For example, following is my listener.ora file contents.
# listener.ora Network Configuration File: E:\oracle\product\10.2.0\db_2\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
  (SID_DESC=
        (GLOBAL_DBNAME=a)
        (ORACLE_HOME=E:\oracle\product\10.2.0\db_1)
        (SID_NAME=a)
   )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

Step 03: Add a password line corresponding to the listener.
From above contents you see my listener has the default name LISTENER from lines,
LISTENER =
   (DESCRIPTION_LIST =
It is the line starting LISTENER= . Within listener.ora file we need to add a line to this file with the following format:
   PASSWORDS_{LISTENER_NAME}=listener_password
Here the listener is called LISTENER then we need a add following lines within the listener.ora file.
 PASSWORDS_LISTENER=listener_password
You can also set multiple passwords as follows:
   PASSWORDS_LISTENER=(password1,password2)
For example I want to have my "LISTENER" listener password as "arjudba" so my listener.ora file will look like,
# listener.ora Network Configuration File: E:\oracle\product\10.2.0\db_2\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
  (SID_DESC=
        (GLOBAL_DBNAME=a)
        (ORACLE_HOME=E:\oracle\product\10.2.0\db_1)
        (SID_NAME=a)
   )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )
PASSWORDS_LISTENER=arjudba
Note that, After you set password in 9i, you will now require a password whenever you wish to stop the listener or any other "destructive" listener actions. However in Oracle database 10g, if you are not logged into the operating system with a privileged account, you will have to enter a password while doing any destructive operation to listener. Like,
$ lsnrctl
LSNRCTL> set password

B. Using lsnrctl utility.
With the lsnrctl utility you can secure your password by making password encrypted. Setting password through lsnrctl utility is a recommended option. Step by step it is demonstrated.

Step 01: Invoke lsnrctl utility.
E:\>lsnrctl

LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 27-MAR-2010 11:24:26

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

Welcome to LSNRCTL, type "help" for information.
Step 02: Set the current listener to which you want to set password.
LSNRCTL> set current_listener listener
Current Listener is listener
Step 03: Invoke change_password command:
After invoking change_password it will prompt you for old password, if you have any old password set then type that. But if you don't have any old password then simply press Enter.
Then it will prompt you for the new password which you want to set and then press enter.
Then it will again prompt you to reenter the new password for confirmation and then press enter.
After this password will be changes for running instance or session of the listener.
LSNRCTL> change_password
Old password:
New password:
Reenter new password:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Password changed for listener
The command completed successfully
Step 04: Set up password for the all future instance or session:
Issue "set password" and "save_config" command if want it applicable for all the future instance or session. Issuing "save_config" command you save the configuration file after setting the password otherwise it will be lost.

LSNRCTL> set password
Password:
The command completed successfully
LSNRCTL> save_config
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Saved LISTENER configuration parameters.
Listener Parameter File   E:\oracle\product\10.2.0\db_2\network\admin\listener.ora
Old Parameter File   E:\oracle\product\10.2.0\db_2\network\admin\listener.bak
The command completed successfully

After you set password using lsnrctl utility if you open listener.ora file you will see a new entry like below which is an encrypt one.
#----ADDED BY TNSLSNR 27-MAR-2010 11:37:15---
PASSWORDS_LISTENER = 44A81038BB249678
#--------------------------------------------

C. Using GUI such as Oracle Net Manager or Enterprise Manager.
Invoke netca or using Eneterprise Manager you can add listener password as directed by graphical window.

Related Documents
ORA-12518: TNS:listener could not hand off client connection
The listener supports no services
lsnrctl start fails with TNS-12541, TNS-12560,TNS-00511, Linux Error: 111:
Listener Hangs, Child listener process remains persistence
EM Daemon is not running
ORA-12541: TNS:no listener
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Login to Dbconsole, Authentication failed!null Returned
How to Enable Listener Logging and Tracing

Thursday, March 25, 2010

NTP and csstd time synchronization option to install Oracle Clusterware 11gR2

In Oracle 11gR2 and later version, while installing Oracle clusterware it is required time synchronization across all nodes within a cluster. We can use two different options to setup time synchronization.

1)Operating system configured Network Time Protocol (NTP).
2)Oracle Cluster Time Synchronization Service (ctssd).

If you don't have NTP services started then Oracle Cluster Time Synchronization Service is used. However if you want to use ctssd (Cluster Time Synchronization Service Daemon) service in the cluster, then deconfigure and deinstall the Network Time Protocol (NTP).

In order to deactivate NTP service, you need to follow the following procedures.

i)Stop the existing ntpd service.
# /sbin/service ntpd stop

ii)Disable the service from the initialization sequences so that it does not start during startup.
# chkconfig ntpd off

iii)Remove the ntp.conf file.
# rm /etc/ntp.conf
or,
# mv /etc/ntp.conf to /etc/ntp.conf.bak

Also remove the file /var/run/ntpd.pid which maintains the pid for the NTP daemon.
# rm /var/run/ntpd.pid

When the installer finds that the NTP protocol service is inactive, the Cluster Time Synchronization Service is installed in active mode and synchronizes the time across the nodes.

IF NTP is active on the server, then the Cluster Time Synchronization Service is started in observer mode, and no active time synchronization is performed by Oracle Clusterware within the cluster.

To check whether ctssd is active or not as grid installation owner just issue,
$ crsctl check ctss

If you want to continue using NTP time synchronization service, then you need to modify the NTP initialization file to set the -x flag, which prevents time from being adjusted backward. After you modify it restart ntpd. Following steps demonstrate the procedure on Oracle Enterprise Linux, Red Hat Linux.

i)Edit /etc/sysconfig/ntpd file and add -x flag.
# vi /etc/sysconfig/ntpd
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
SYNC_HWCLOCK=no

ii)Restart NTP service.
# /sbin/service ntp restart

On SUSE systems, modify the configuration file /etc/sysconfig/ntp with the following settings.
NTPD_OPTIONS="-x -u ntp"

Related Documents
http://arjudba.blogspot.com/2010/03/cluvfy-fails-with-prvf-5436-prvf-9652.html
http://arjudba.blogspot.com/2010/03/in-11gr2-grid-rootsh-fails-with-crs.html
http://arjudba.blogspot.com/2010/03/what-to-do-after-failure-of-oracle.html
http://arjudba.blogspot.com/2009/12/enable-archive-log-mode-for-rac.html
http://arjudba.blogspot.com/2008/09/list-of-parameters-that-must-have.html
http://arjudba.blogspot.com/2008/08/oracle-rac-software-components.html
http://arjudba.blogspot.com/2008/08/oracle-clusterware-processes-on-unix.html
http://arjudba.blogspot.com/2008/08/configure-raw-devices-for-asm-in-rac.html
http://arjudba.blogspot.com/2008/08/crs-stack-fails-to-start-after-reboot.html
http://arjudba.blogspot.com/2008/08/configure-network-for-oracle-rac.html
http://arjudba.blogspot.com/2008/08/pre-installation-rac-environement-setup.html
http://arjudba.blogspot.com/2008/08/configure-server-to-install-oracle-rac.html

Monday, March 22, 2010

cluvfy fails with PRVF-5436 PRVF-9652 Cluster Time Synchronization Services check failed

Problem Description
"cluvfy comp clocksync" check fails with PRVF-5436 and PRVF-9652 error like below.

$GRID_HOME/bin/cluvfy comp clocksync
..
..
..
Checking daemon liveness...
Liveness check passed for "xntpd"
PRVF-5436 : The NTP daemon running on one or more nodes lacks the slewing option "slewalways yes"
Clock synchronization check using Network Time Protocol(NTP) failed
PRVF-9652 : Cluster Time Synchronization Services check failed

From $ORACLE_BASE/oraInventory/logs/installActions{$TIMESTAMP}.log installation logs it shows similar entries like following:

..
INFO: Checking daemon liveness...
INFO: Liveness check passed for "xntpd"
INFO: PRVF-5436 : The NTP daemon running on one or more nodes lacks the slewing option "slewalways yes"
INFO: Clock synchronization check using Network Time Protocol(NTP) failed
INFO: PRVF-9652 : Cluster Time Synchronization Services check failed
INFO: Post-check for cluster services setup was unsuccessful on all the nodes.

Cause of the Problem
The problem happened because the time service (such as NTP) is not running or doesn't have slew option set.

Solution of the Problem
The problem happened because time service NTP is not running or doesn't have slew option set.
So, ensure that NTP service is up and running.
Based on the operating system solutions are given below.

1) Linux:
To verify service as root user issue,
# /sbin/service ntpd status
ntpd (pid 4423) is running...

Check process is running or not by.
# ps -ef|grep ntp
ntp 4209 1 0 Mar10 ? 00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -x

# grep OPTIONS /etc/sysconfig/ntpd
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -x"

If NTP service is not started then to start the service issue,
To start the service issue,

# /sbin/service ntpd start

2) Solaris:
To verify the service issue,

# /usr/bin/svcs ntp
STATE STIME FMRI
online 3:29:11 svc:/network/ntp:default

# ps -ef|grep ntp
root 21223 1 0 Mar 10 ? 0:21 /usr/lib/inet/xntpd

# grep slewalways /etc/inet/ntp.conf
slewalways yes

To start the NTP service issue,

# /usr/sbin/svcadm enable ntp

3) HP-UX:

To verify the service issue,

# ps -ef|grep ntp
root 6022 1 0 14:23:42 ? 0:01 /usr/sbin/xntpd -x

# grep XNTPD_ARGS /etc/rc.config.d/netdaemons
export XNTPD_ARGS="-x"

To start the service issue,
# /sbin/init.d/xntpd start

4) AIX:

To verify the service issue,

# /usr/bin/lssrc -ls xntpd
xntpd tcpip 368754 active

# ps -ef|grep ntp
root 786614 151686 0 08:02:32 - 0:00 /usr/sbin/xntpd -x

# grep xntpd /etc/rc.tcpip
start /usr/sbin/xntpd "$src_running" -a "-x"

To start the service issue,

# /usr/bin/startsrc -s xntpd -a "-x"
Related Documents
http://arjudba.blogspot.com/2010/03/cluvfy-fails-with-prvf-5436-prvf-9652.html
http://arjudba.blogspot.com/2010/03/in-11gr2-grid-rootsh-fails-with-crs.html
http://arjudba.blogspot.com/2010/03/what-to-do-after-failure-of-oracle.html
http://arjudba.blogspot.com/2009/12/enable-archive-log-mode-for-rac.html
http://arjudba.blogspot.com/2008/09/list-of-parameters-that-must-have.html
http://arjudba.blogspot.com/2008/08/oracle-rac-software-components.html
http://arjudba.blogspot.com/2008/08/oracle-clusterware-processes-on-unix.html
http://arjudba.blogspot.com/2008/08/configure-raw-devices-for-asm-in-rac.html
http://arjudba.blogspot.com/2008/08/crs-stack-fails-to-start-after-reboot.html
http://arjudba.blogspot.com/2008/08/configure-network-for-oracle-rac.html
http://arjudba.blogspot.com/2008/08/pre-installation-rac-environement-setup.html
http://arjudba.blogspot.com/2008/08/configure-server-to-install-oracle-rac.html

Sunday, March 21, 2010

In 11gR2 Grid root.sh fails with CRS-2674: Start of 'ora.cssd' failed

Problem Description
In Linux x86-64 system while installing Oracle Grid Infrastructure RAC cluster running $GRID_HOME/root.sh succeeds on the 1st node but fails on the 2nd node while attempting to start 'ora.cssd'.

Following is the log file entry from the cssd log.

CRS-2674: Start of 'ora.cssd' on 'rac2' failed
CRS-2679: Attempting to clean 'ora.cssd' on 'rac2'
CRS-2681: Clean of 'ora.cssd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'rac2'
CRS-2677: Stop of 'ora.diskmon' on 'rac2' succeeded
CRS-4000: Command Start failed, or completed with errors.
CRS-2672: Attempting to start 'ora.cssd' on 'rac2'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac2'
CRS-2674: Start of 'ora.diskmon' on 'rac2' failed
CRS-2679: Attempting to clean 'ora.diskmon' on 'rac2'
CRS-5016: Process "/u01/oracle/11.2.0/grid/bin/diskmon" spawned by agent "/u01/oracle/11.2.0/grid/bin/orarootagent.bin" for action "clean" failed: details at "(:CLSN00010:)" in "/u01/oracle/11.2.0/grid/log/rac2/agent/ohasd/orarootagent_root/orarootagent_root.log"
CRS-2681: Clean of 'ora.diskmon' on 'rac2' succeeded
CRS-2674: Start of 'ora.cssd' on 'rac2' failed
CRS-2679: Attempting to clean 'ora.cssd' on 'rac2'
CRS-2681: Clean of 'ora.cssd' on 'rac2' succeeded
CRS-4000: Command Start failed, or completed with errors.
Command return code of 1 (256) from command: /u01/oracle/11.2.0/grid/bin/crsctl start resource ora.ctssd -init -env USR_ORA_ENV=CTSS_REBOOT=TRUE
Start of resource "ora.ctssd -init -env USR_ORA_ENV=CTSS_REBOOT=TRUE" failed
Failed to start CTSS
Failed to start Oracle Clusterware stack

Cause of the Problem
The startup of the CSS daemon on RAC node 2 failed because either it could not establish a network connection to the first node or it could not synchronize time with the first node. You can be sure by reviewing the messages seen in the CSS daemon log ($GRID_HOME/log/{nodename}/cssd/ocssd.log) on the 2nd node. If your 2nd node hostname is rac2 then review at location $GRID_HOME/log/rac2/cssd/ocssd.log.

From is the part of ocssd.log entry.

2010-03-13 10:59:36.581: [ CSSD][1246480704]clssnmLocalJoinEvent: Node rac1, number 1, is in an existing cluster with disk state 3
2010-03-13 10:59:36.582: [ CSSD][1246480704]clssnmLocalJoinEvent: takeover aborted due to cluster member node found on disk
2010-03-13 10:59:36.685: [ CSSD][1162561856]clssnmvDHBValidateNCopy: node 1, rac1, has a disk HB, but no network HB, DHB has rcfg 157026738, wrtcnt, 1507, LATS 66284084, lastSeqNo 1507, uniqueness 1261524838, timestamp 1261526376/66279084
2010-03-13 10:59:37.110: [ CSSD][1215011136]clssgmWaitOnEventValue: after CmInfo State val 3, eval 1 waited 0
2010-03-13 10:59:37.513: [ CSSD][1235990848]clssnmSendingThread: sending join msg to all nodes
2010-03-13 10:59:37.513: [ CSSD][1235990848]clssnmSendingThread: sent 5 join msgs to all nodes

While the connectivity on the cluster interconnect appeared to be functioning (nodes can be pinged via their private nodenames/IP addresses), a firewall blocked traffic on certain ports thus impacting the communication between the CRS daemon processes. It may also be reason that due to time synchronization problem running script root.sh on 2nd node fails.

Solution of the Problem
1) Disable Firewall:
Disable firewalls in all nodes. In Linux log in as root and run the following commands,
$ su
# service iptables stop
# service ip6tables stop


To disable firewall permanently issue,
# chkconfig iptables off
# chkconfig ip6tables off


If you want to enable firewall then exclude all traffic on the private network from the firewall configuration.

2) Synchronize Time between the nodes:
Setup NTP server to ensure that you have time synchronized between all nodes. In the post How to setup NTP Server it is discussed how to setup NTP server. So after synchronize timing deconfigure and reconfigure your grid infrastructure installation by following http://arjudba.blogspot.com/2010/03/what-to-do-after-failure-of-oracle.html.
Related Documents
http://arjudba.blogspot.com/2010/03/cluvfy-fails-with-prvf-5436-prvf-9652.html
http://arjudba.blogspot.com/2010/03/in-11gr2-grid-rootsh-fails-with-crs.html
http://arjudba.blogspot.com/2010/03/what-to-do-after-failure-of-oracle.html
http://arjudba.blogspot.com/2009/12/enable-archive-log-mode-for-rac.html
http://arjudba.blogspot.com/2008/09/list-of-parameters-that-must-have.html
http://arjudba.blogspot.com/2008/08/oracle-rac-software-components.html
http://arjudba.blogspot.com/2008/08/oracle-clusterware-processes-on-unix.html
http://arjudba.blogspot.com/2008/08/configure-raw-devices-for-asm-in-rac.html
http://arjudba.blogspot.com/2008/08/crs-stack-fails-to-start-after-reboot.html
http://arjudba.blogspot.com/2008/08/configure-network-for-oracle-rac.html
http://arjudba.blogspot.com/2008/08/pre-installation-rac-environement-setup.html
http://arjudba.blogspot.com/2008/08/configure-server-to-install-oracle-rac.html