Link to home
Start Free TrialLog in
Avatar of sikyala
sikyalaFlag for United States of America

asked on

How do I set a password for the listener

Could someone tell me what the syntax is for setting a password for the listener and still enable the startup scripts (i.e. dbora) working whenever the server is rebooted?
Avatar of schwertner
schwertner
Flag of Antarctica image


The information in this document is useful for system administrators and  
database administrators trying to automate Oracle database startup and shutdown.
 
The document describes the detailed steps for configuration on Red Hat Advanced  
Server 2.1, SuSE SLES7 and United Linux 1.0 (SuSE SLES8 Edition).  
The information may not apply to other Linux distributions.
 
The following configuration is done to allow Oracle database be up and running
in runlevels 3 (character mode) and 5 (X-Window system).  
 
Since the configuration is based on dbstart and dbshut scripts provided by the
Oracle Server installation, please see [NOTE:207508.1].
 
The configuration also facilitates automated startup shutdown of Intelligent  
Agent, Management Server and HTTP Server, which are available with Oracle Server.
 
The information in this document does not apply to Oracle Internet Application
Server. Still the script can be configured to handle starting up and shutting  
down iAS processes.
 
 
Configuring Linux for Automated Startup/Shutdown of Oracle Database
-------------------------------------------------------------------
 
1. Update 'oratab' (under /etc or /var/opt/oracle) as:
 
   <SID>:<ORACLE_HOME>:Y
 
where Y states that the database can be started up and shutdown using  
dbstart/dbshut.
 
2. Create the service script:
 
     /etc/init.d/dbora
 
Note: In Red Hat Advanced Server 2.1, the /etc/init.d is is a symbolic link to  
      /etc/rc.d/init.d  
 
Content of the script is as follows:
 
  #!/bin/bash
  #
  # chkconfig: 35 99 10    
  # description: Starts and stops Oracle processes
  #
  # Set ORA_HOME to be equivalent to the $ORACLE_HOME
  # from which you wish to execute dbstart and dbshut;
  #
  # Set ORA_OWNER to the user id of the owner of the
  # Oracle database in ORA_HOME.
  #
  ORA_HOME=<Type your ORACLE_HOME in full path here>
  ORA_OWNER=<Type your Oracle account name here>
 
  case "$1" in
    'start')
       # Start the Oracle databases:
       # The following command assumes that the oracle login
       # will not prompt the user for any values
       su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
       # Start the TNS Listener
       su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
       # Start the Intelligent Agent
       if [ -f $ORA_HOME/bin/agentctl ]; then
          su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl start"
       else
          su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_start"
       fi
       # Start Management Server
       if [ -f $ORA_HOME/bin/oemctl ]; then
          su - $ORA_OWNER -c "$ORA_HOME/bin/oemctl start oms"
       fi
       # Start HTTP Server
       if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then
          su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl start"
       fi
       touch /var/lock/subsys/dbora
       ;;
    'stop')
       # Stop HTTP Server
       if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then
          su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl stop"
       fi
       # Stop the Intelligent Agent
       if [ -f $ORA_HOME/bin/agentctl ]; then
          su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl stop"
       else
          su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_stop"
       fi
       # Stop the TNS Listener
       su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
       # Stop the Oracle databases:
       # The following command assumes that the oracle login
       # will not prompt the user for any values
       su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
       rm -f /var/lock/subsys/dbora
       ;;
  esac
  # End of script dbora
 
NOTE 1:
The lines:
 
  # chkconfig: 35 99 10    
  # description: Starts and stops Oracle database
 
are mandatory since they describe the characteristics of the service where:
 
  35 means that the service will be started in init levels 3 and 5 and will be  
     stopped in other levels.
  99 means that the service will be started at the near end of the init level  
     processing
  10 means that the service will be stopped at the near end of the init level  
     processing
 
NOTE 2:  
The Management Server is not shut down during service stop since it requires  
interaction and there is no harm in system killing the processes since the  
database is shut down already.
 
 
3. Set script permissions:
 
    chmod 755 /etc/init.d/dbora
 
 
3. Register the Service
 
    /sbin/chkconfig --add dbora
 
This action registers the service to the Linux service mechanism. On SuSE SLES7
and Red Hat Advanced Server 2.1 it will arrange symbolic links under  
rc<runlevel>.d directories to /etc/init.d/dbora script.
 
On SuSE SLES7 the following symbolic links are created:
 
/etc/init.d/rc0.d/K10dbora
/etc/init.d/rc1.d/K10dbora
/etc/init.d/rc2.d/K10dbora
/etc/init.d/rc3.d/S99dbora
/etc/init.d/rc4.d/K10dbora
/etc/init.d/rc5.d/S99dbora
/etc/init.d/rc6.d/K10dbora
 
 
On Red Hat Advanced Server 2.1 the following symbolic links are created:
 
/etc/rc.d/rc0.d/K10dbora
/etc/rc.d/rc1.d/K10dbora
/etc/rc.d/rc2.d/K10dbora
/etc/rc.d/rc3.d/S99dbora
/etc/rc.d/rc4.d/K10dbora
/etc/rc.d/rc5.d/S99dbora
/etc/rc.d/rc6.d/K10dbora
 
 
The symbolic links are not created in United Linux 1.0 (SuSE SLES8 Edition)  
with the 'chkconfig -add' command.  
To have the symbolic links created run the following in addition:
 
   /sbin/chkconfig --set dbora 35
 
After this action, the following symbolic links will be created pointing  
to /etc/init.d/dbora script:
 
/etc/init.d/rc3.d/S01dbora
/etc/init.d/rc3.d/K22dbora
/etc/init.d/rc5.d/S01dbora
/etc/init.d/rc5.d/K22dbora
 
 
In all cases, the 'dbora' service will be running in runlevels 3,5 and it will  
be stopped in other runlevels (i.e. 0,1,2,4,6).
 
 
RELATED DOCUMENTS
-----------------
 
- Linux man page: chkconfig (8)
- Linux man page: chmod (1)  
- Linux man page: init.d (7)  
- Linux man page: ln (1)  
 
[NOTE:207508.1] Dbstart does not work if using an spfile only
[NOTE:1074016.6] LINUX: DBORA DOES NOT WORK ON REDHAT LINUX
[NOTE:1016388.102] LINUX: DBSHUT FAILS WHEN ISSUING REBOOT, INIT6, OR SHUTDOWN.
[NOTE:126146.1] dbora fails to start the database





Note:1019793.6

AUTOMATIC STARTUP/SHUTDOWN OF ORACLE INSTANCES ON SUN SOLARIS
This document discusses methods for automatically starting up and shutting    
down Oracle instances during UNIX system startup or shutdown.  Specific    
schemes for performing these actions on Sun Solaris are presented, along  
with a listing of the important scripts and directories that come into play in  
the process.    
     
For more detailed explanations and alternatives, please refer to the System    
Administrator's Guide for Sun Solaris.    
   
   
Search Words: dbstart, dbshut
 
 
Files of Interest In Your Oracle Installation                                  
---------------------------------------------                        
The following list summarizes the functions performed by the different Oracle    
startup and shutdown scripts (which are invoked during system startup and    
shutdown, respectively).    
   
Script                    Description  
-------------------------|--------------------------------------------------  
$ORACLE_HOME/bin/dbstart |Ensures a clean startup of database instance(s),  
                         |even after system failure    
-------------------------|--------------------------------------------------  
$ORACLE_HOME/bin/dbshut  |Ensures a clean shutdown for data base instances      
-------------------------|--------------------------------------------------  
/etc/oratab    or        |Contains a field that specifies whether a    
/var/opt/oracle/oratab   |particular database instance should be brought  
                         |up/down at system startup/shutdown time. By    
                         |specifying "Y" in this field, the "dbstart" and    
                         |"dbshut" scripts bring this database instance up or    
                         |down.                                              
-------------------------|--------------------------------------------------  
   
System V Versus BSD UNIX Startup and Shutdown Procedures  
--------------------------------------------------------  
Since the system re-boot procedure is unique for each Unix Operating System,  
but can be generalized based on whether the Operating System is System V-based  
or BSD-based, this section describes the generic approach taken by System V  
and BSD-based UNIX operating systems at system startup and shutdown time.  For  
more specific information, refer to the appropriate operating system-specific  
section below.  
                       
System V Procedures      
- - - - - - - - - -  
System V initialization scripts are contained in /etc/rc<n>.d directories    
where "n" is the run-level value of the script.  A run-level of 0 usually    
signifies power shutdown mode, while a run-level of 2 signifies multi-user    
mode.    
                                                                                 
The directories contain initialization scripts such as "S75cron" and "K30tcp".  
These scripts are named using the following method:    
                                                                                 
     [K or S][two-digit number][descriptive filename]    
                                                                                 
Names starting with "S" indicate scripts that are called at startup; names  
starting with "K" indicate scripts that are called at shutdown time.      
   
Scripts containing larger numbers in their names are executed after those    
with lower numbers.  Oracle startup scripts typically contain larger    
numbers in their names, such as "S99oracle", indicating that the script    
should be run after the system has been started up.  Oracle shutdown script  
names, on the other hand, usually contain smaller numbers, such as    
"K01oracle" indicating that the script should be run before system shutdown.  
   
BSD Procedures      
- - - - - - -  
BSD-based systems, use /etc/rc*, files, such as /etc/rc, /etc/rc.local and  
so on, at system startup time.                    
                                                               
During system shutdown, the /etc/shutdown command is invoked before any    
system or system-defined scripts.  Some implementations invoke  
/etc/rc.shutdown at shutdown time.    
         
 
                                                                 
Sun Solaris                                                                    
- - - - - -  
                                                               
     Relevant Files                                                              
       
        /etc/inittab           -- Controls the initialization process    
        /etc/rc2               -- Script to start/stop processes at run    
                                  level 2    
        /etc/rc0               -- Script to start/stop processes at run    
                                  level 0    
        /etc/rc2.d/S99dbstart  -- Link to the script /etc/init.d/dbstart  
        /etc/rc0.d/K01dbshut   -- Link to the script /etc/init.d/dbshut    
        /var/opt/oracle/oratab -- Oracle oratab file                            
         
The process of startup and shutdown for Solaris 2.3 is similar to that of    
OSF/1, the only difference being that all the appropriate scripts and    
directories can be accessed from /etc instead of /sbin (directories such as    
rc0.d, rc2.d and others are actually located in /etc).  Scripts such as        
rc0, rc2, are symbolic links to corresponding scripts in /sbin.    
                                                       
/etc/init.d/dbstart and /etc/init.d/dbshut are simple one-line scripts    
containing the following commands, respectively:            
                                                       
    su - <oracle_owner> -c <$ORACLE_HOME>/bin/dbstart            
                                                               
            and                                              
                                                                       
    su - <oracle_owner> -c <$ORACLE_HOME>/bin/dbshut                
                                                                 
                                                                 
where "<$ORACLE_HOME>" stands for the path to which $ORACLE_HOME points, and    
<oracle_owner> stands for the userid who owns the Oracle installation.    
                                                             
Unlike with OSF/1, the "start" and "stop" parameters, passed to the scripts by  
the system, are ignored by /etc/init.d/dbstart and /etc/init.d/dbshut.    
                                                                             
Note: please make sure that both dbstart and dbshut in /etc/init.d are          
      executable by the oracle userid.                                          
 
For more details of the initialization process, please refer to    
/etc/init.d/README.



 
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial