CentOS Oracle Services Start & Stop scripts and boot from

Source: Internet
Author: User

Oracle Services start & Stop scripts with boot.

Oracle installation directory and environment:

  installation directory:/hywl/oracle/app/product/11.1.1/db_1
in CentOS 6.5 After installing the Oracle 10g R2, after rebooting, you will find that Oracle does not start itself, this is normal, because the installation of Oracle under Linux does not start itself, you must set the relevant parameters, first of all, we introduce how to start Oracle.
login to CentOS, switch to Oracle User Rights
# su–oracle
and then enter:
$ Sqlplus "/as sysdba"
The original screen will change to
Sql>,
then enter
sql> startup
To start the database normally.
Additional instructions to stop the database are as follows:
sql> shutdown immediate
Check if Oracle DB Listener is normal
back to terminal mode, enter:
$ lsnrctl Status
  Check to see if the listener has a start
if it does not start, you can enter:
$ lsnrctl start
Start listener

sql> Conn sys as SYSDBA
then enter the password, sys log in as SYSDBA.
Start Emctl
You can also find the http://localhost.localdomain:1158/em There is no response at this time, this way to start the other, start the command as follows:
$ emctl Start Dbconsole
This command takes longer to run.
After manually starting the Oracle database, create the system to start the Oracle script itself.
If you cannot access it, you need to view the firewall configuration, open the Http,https service, and 1158,1521 Port
 
 


Two. Modify the Oracle System configuration file:/etc/oratab
Modify the Oracle System configuration file:/etc/oratab, only then can Oracle's own Dbstart and Dbshut work.
# Vi/etc/oratab
ORCL:/opt/oracle/app/product/11.2.0/dbhome_1:y
Change the original n to Y
Note: There is no Oratab (this file is generated when the Oracle installation executes the following script), and the two scripts are re-executed
/oradata/orainventory/orainstroot.sh
/opt/oracle/app/product/11.2.0/dbhome_1/root.sh

three. Create an Oracle self-boot script
Because the Dbstart and Dbshut scripts are modified, the script can be started or shut down directly with the Oracle service and listener, so the script starts or shuts down the database as long as the Dbstart or Dbshut script is invoked. If you do not modify by default, you must increase the start and close listening statements in the script
su-$ORACLE _owner-c "$ORACLE _home/bin/lsnrctl start"
su-$ORACLE _owner-c "$ORACLE _home/bin/lsnrctl Stop"
If you want to start the OEM automatically or turn off the OEM automatically, use the following statement:
su-$ORACLE _owner-c "$ORACLE _home/bin/emctl start Dbconsole"
su-$ORACLE _owner-c "$ORACLE _home/bin/emctl stop Dbconsole"

The script only starts Oracle snooping and Oracle Services, and the Dbstart script has been modified, so the specific script (/ETC/INIT.D/HYWL) is as follows:
#!/bin/bash
# WhoAmI
# root
# chkconfig:2345 99 01
#/ETC/INIT.D/HYWL
# description:starts The Oracle dabase deamons
#
Oracle_home=/hywl/oracle/app/product/11.1.1/db_1
Oracle_owner=oracle
Case "$" in
Start
Echo-n "Starting HYWL:"
su-$ORACLE _owner-c "$ORACLE _home/bin/dbstart"
Touch/var/lock/subsys/hywl
Echo
;;
Stop
Echo-n "shutting down HYWL:"
su-$ORACLE _owner-c "$ORACLE _home/bin/dbshut"
Rm-f/VAR/LOCK/SUBSYS/HYWL
Echo
;;
Restart
Echo-n "Restarting HYWL:"
$ stop
$ start
Echo
;;
*)
echo "Usage: ' basename ' Start|stop|restart"
Esac

four. Give self-startup script execution permissions
chmod 775/ETC/INIT.D/HYWL


Five. Add Configuration service
[Email protected] ~]#/sbin/chkconfig--add HYWL
Reasons why the HYWL service does not support chkconfig:
"Service does not support Chkconfig":-this hint is because the Oracle self-starter script must have these two lines before
# chkconfig:2345 99 01
#description: Oracle 11g Service
Of course, if you do not use this command to configure the service, you can also manually create a file link to complete, as follows:
File link
Ln-s/etc/init.d/hywl /etc/rc.d/rc2.d/s99hywl

Ln-s/etc/init.d/hywl /ETC/RC.D/RC3.D/S99HYWL
Ln-s/etc/init.d/hywl /ETC/RC.D/RC4.D/S99HYWL
Ln-s/etc/init.d/hywl /ETC/RC.D/RC5.D/S99HYWL
Ln-s/etc/init.d/hywl /ETC/RC.D/RC0.D/K01HYWL
Ln-s/etc/init.d/hywl /ETC/RC.D/RC1.D/K01HYWL
Ln-s/etc/init.d/hywl /ETC/RC.D/RC6.D/K01HYWL
To delete a link, do the following:

Rm-rf/etc/rc.d/rc2.d/s99hywl
Rm-rf/etc/rc.d/rc3.d/s99hywl
Rm-rf/etc/rc.d/rc4.d/s99hywl
Rm-rf/etc/rc.d/rc5.d/s99hywl
Rm-rf/etc/rc.d/rc0.d/k01hywl
Rm-rf/etc/rc.d/rc1.d/k01hywl
Rm-rf/etc/rc.d/rc6.d/k01hywl

Six. Test whether the configuration is successful
Service HYWL (Oracle Self-startup script name)--Used to check if the configuration was successful, and if any errors would have specific output, check for changes based on the output results.
Service HYWL start test to successfully start Oracle
Note:
If you do not create an Oracle self-boot script, you can add the statement of the service you want to start directly in the/etc/rc.d/rc.local file
Su-oracle-c "/hywl/oracle/app/product/11.1.1/db_1/bin/dbstart"
Su-oracle-c "/hywl/oracle/app/product/11.1.1/db_1/bin/emctl start Dbconsole"

Setup is complete.

This article is from the "Green Home" blog, please be sure to keep this source http://77jiayuan.blog.51cto.com/386386/1569408

CentOS Oracle Services Start & Stop scripts and boot from

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.