CentOS Oracle 11g R2 is set to boot automatically [1] Change/etc/oratab [root @ localhost ~] # Vi/etc/oratab # This file is used by ORACLE utilities. it is created by root. sh # and updated by the Database Configuration Assistant when creating # a database. # A colon, ':', is used as the field terminator. A new line terminates # the entry. lines beginning with a pound sign, '#', are comments. # Entries are of the form: # $ ORACLE_SID: $ ORACLE_HOME: <N | Y >:# # The first and second fields are the sys Tem identifier and home # directory of the database respectively. the third filed indicates # to the dbstart utility that the database shocould, "Y", or shocould not, # "N", be brought up at system boot time. # Multiple entries with the same $ ORACLE_SID are not allowed. # MFGS:/usr/oracle/app/product/11.2.0/dbhome_1: Y # change here [2] Add the SID environment variable www.2cto.com to the oracle user profile file [root @ localhost ~] # Vi/usr/oracle/. bash_profile #. bash_profile # Get the aliases and functionsif [-f ~ /. Bashrc]; then .~ /. Bashrcfi # User specific environment and startup programs PATH = $ PATH: $ HOME/bin export PATH # add at the last line umask 022 export ORACLE_BASE =/usr/oracle/app export ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/dbhome_1export PATH = $ PATH: $ ORACLE_HOME/bin # Add export ORACLE_SID = MFGS [3] at the end of the file to create the Init script for starting Oracle [root @ localhost ~] # Vi/etc/rc. d/init. d/oracle # this is an example #! /Bin/bash # oracle: Start/Stop Oracle Database 11g R2 # chkconfig: 345 90 10 # description: The Oracle Database is an Object-Relational Database Management System. # processname: oracle. /etc/rc. d/init. d/functions www.2cto.com LOCKFILE =/var/lock/subsys/oracleORACLE_HOME =/usr/oracle/app/product/11.2.0/dbhome_1ORACLE_USER = oracle case "$1" in 'start ') if [-f $ LOCKFILE]; then echo $0 already running. Exit 1 fi echo-n $ "Starting Oracle Database: "su-$ ORACLE_USER-c" $ ORACLE_HOME/bin/lsnrctl start "su-$ ORACLE_USER-c" $ ORACLE_HOME/bin/dbstart $ ORACLE_HOME "su-$ ORACLE_USER-c" $ ORACLE_HOME/bin/emctl start dbconsole "touch $ LOCKFILE ;; 'stop') if [! -F $ LOCKFILE]; then echo $0 already stopping. exit 1 fi echo-n $ "Stopping Oracle Database: "su-$ ORACLE_USER-c" $ ORACLE_HOME/bin/lsnrctl stop "su-$ ORACLE_USER-c" $ ORACLE_HOME/bin/dbshut "su-$ ORACLE_USER-c" $ ORACLE_HOME/ bin/emctl stop dbconsole "rm-f $ LOCKFILE ;; 'restart') $0 stop $0 start; 'status') if [-f $ LOCKFILE]; then echo $0 started. else echo $0 stopped. fi; *) echo "Usage: $0 [start | stop | status] "exit 1 esac exit 0 [4] Change the start script permission [root @ localhost ~] # Chmod 755/etc/rc. d/init. d/oracle [5] Start the oracle database [root @ localhost ~] # Service oracle startStarting Oracle Database: LSNRCTL for Linux: Version 11.2.0.1.0-Production on 09-OCT-2012 12:50:44 Copyright (c) 1991,200 9, Oracle. all rights reserved. starting/usr/oracle/app/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... www.2cto.com TNSLSNR for Linux: Version 11.2.0.1.0-ProductionSystem parameter file is/usr/oracle/app/product/11.2.0/dbhome_1/network/admin/l istener. oraLog messages written to/usr/oracle/app/diag/tnslsnr/localhost/listener/alert/lo g. xmlListening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521) Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521) STATUS of the LISTENER ---------------------- Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0-ProductionStart Date 09-OCT-2012 12: 50: 44 Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File/usr/oracle/app/product/11.2.0/dbhome_1/network/admin/listener. oraListener Log File/usr/oracle/app/diag/tnslsnr/localhost/listener/alert/log. xmlListening Endpoints Summary... (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = localhost) (PORT = 1521 ))) the listener supports no servicesThe command completed successfullyOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996,200 9 Oracle Corporation. all rights reserved. https://localhost:1158/em/console/aboutApplicationStarting Oracle Enterprise Manager 11g Database Control ....... started. export Logs are generated in directory/usr/oracle/app/product/11.2.0/dbhome_1/localhost_MFGS/sysman/log www.2cto.com the command for shutting down the oracle database is [root @ localhost ~] # Service oracle stop [6] Set oracle to auto-start upon startup [root @ localhost ~] # Chkconfig oracle on [root @ localhost ~] # Chkconfig -- list oracleoracle 0: off 1: off 2: on 3: on 4: on 5: on 6: off