Linux Oracle Services Start & Stop scripts and boot from boot

Source: Internet
Author: User
Tags stop script file permissions sqlplus

After installing the Oracle 10g R2 in CentOS 6.3, after rebooting, you will find that Oracle does not boot itself, which is normal, because the installation of Oracle under Linux does not start on its own, you must set the relevant parameters, First introduce how to start Oracle in general.

First, start Oracle under Linux

Log in to CentOS and switch to Oracle user rights

# su–oracle

Then enter:

$ sqlplus "/as sysdba"

The original picture will change to
Sql>

then please enter
Sql> Startup

You can start the database normally.

Also the instructions to stop the database are as follows:
sql> shutdown Immediate

Second, check whether the Oracle DB Listener is normal

Back to Terminal mode, enter:

$ LSNRCTL Status

Check to see if the listener has a boot.

If it does not start, you can enter:

$ lsnrctl Start

Start listener

sql> Conn [email protected] as SYSDBA

Then enter the password, sys to log into the database as SYSDBA.

Third, start Emctl

In addition, it can be found that http://localhost.localdomain:1158/em is not responding at present, this side to start another, start the following instructions:

$ emctl Start Dbconsole

This command runs for a long time and finishes with the following screen:

After manually starting the Oracle database, create the system to start the Oracle script itself.

Iv. Oracle Startup & Stop Scripts

1. Modify the Oracle System configuration file:/etc/oratab, only then can Oracle's own Dbstart and Dbshut work.

# Vi/etc/oratab
Orcl:/opt/oracle/102:y

# Entries is of the form:
# $ORACLE _sid: $ORACLE _home:<n| Y>:

2. Under/etc/init.d/, create the file Oracle with the following content:

#!/bin/sh# chkconfig:35 10# description:oracle auto start-stop script.## Set ora_home to is equivalent to the $ORACLE _home# from which-Wish to execute Dbstart and dbshut;## Set Ora_owner to the user ID of the OWNER of the# Oracle Datab ASE in Ora_home. Ora_home=/opt/oracle/102ora_owner=oracleif [!-F $ORA _home/bin/dbstart]then echo "Oracle Startup:cannot start" ex Itficase "in ' Start ') # Start the Oracle Databases:echo" Starting Oracle Databases ... "Echo"-------------------------------------------------">>/var/log/oracledate +"%T%a%d:starting Oracle Data Bases as part of the system up. ">>/var/log/oracleecho"-------------------------------------------------">>/ var/log/oraclesu-$ORA _owner-c "$ORA _home/bin/dbstart" >>/var/log/oracleecho "Done" # Start the Listener:echo " Starting Oracle Listeners ... "Echo"-------------------------------------------------">>/var/log/oracledate +"%T%a%d:starting Oracle List Eners as part of SyStem up. ">>/var/log/oracleecho"-------------------------------------------------">>/var/log/ oraclesu-$ORA _owner-c "$ORA _home/bin/lsnrctl start" >>/var/log/oracleecho "done." echo "-------------------------------------------------" >>/var/log/oracledate + "%T%a%d:finished." >>/ Var/log/oracleecho "-------------------------------------------------" >>/var/log/oracletouch/var/lock/ subsys/oracle;; ' Stop ') # Stop the Oracle Listener:echo "stoping Oracle Listeners ... "Echo"-------------------------------------------------">>/var/log/oracledate +"%T%a%d:stoping Oracle Liste NER as part of the system down. ">>/var/log/oracleecho"-------------------------------------------------">>/ var/log/oraclesu-$ORA _owner-c "$ORA _home/bin/lsnrctl Stop" >>/var/log/oracleecho "done." Rm-f/var/lock/subsys/oracle# Stop The Oracle Database:echo "stoping Oracle Databases ... "Echo"-------------------------------------------------">>/var/log/oracledate +"%T%a%d:stoping Oracle Databases as part of the system down. ">>/var/log/oracleech O "-------------------------------------------------" >>/var/log/oraclesu-$ORA _owner-c "$ORA _home/bin/ Dbshut ">>/var/log/oracleecho" done. " echo "echo"-------------------------------------------------">>/var/log/oracledate +"%T%a%d:finished. " ;>/var/log/oracleecho "-------------------------------------------------" >>/var/log/oracle; Restart ') $ stop$0 start;; Esac

3. Change file permissions
# chmod 755/etc/init.d/oracle

4. Add a service
# chkconfig--level Oracle on

5. Need to stop the database before shutting down or restarting the machine and doing the operation
# ln-s/etc/init.d/oracle/etc/rc0.d/k01oracle//shutdown
# ln-s/etc/init.d/oracle/etc/rc6.d/k01oracle//restart

6. How to use
# service Oracle Start//Launch Oracle
# Service Oracle Stop//Turn off Oracle
# Service Oracle Restart//Restart Oracle

7. Testing

A. Boot from boot

Last Login:mon 19:57:06-10.0.0.145
[Email protected] ~]# su-oracle
[Email protected] ~]$ sqlplus "/as sysdba"

Sql*plus:release 10.2.0.1.0-production on Mon Nov 26 20:07:33 2012

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-production
With the partitioning, OLAP and Data Mining options

Sql> set linesize 300;
Sql> set pagesize 30;
Sql> select * from Scott.emp;

EMPNO ename JOB MGR hiredate SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH Clerk 7902 17-dec-80 800 20
7499 ALLEN salesman 7698 20-feb-81 1600 300 30
7521 WARD salesman 7698 22-feb-81 1250 500 30
7566 JONES MANAGER 7839 02-apr-81 2975 20
7654 MARTIN salesman 7698 28-sep-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-may-81 2850 30
7782 CLARK MANAGER 7839 09-jun-81 2450 10
7788 SCOTT ANALYST 7566 19-apr-87 3000 20
7839 KING President 17-nov-81 5000 10
7844 TURNER salesman 7698 08-sep-81 1500 0 30
7876 ADAMS Clerk 7788 23-may-87 1100 20
7900 JAMES Clerk 7698 03-dec-81 950 30
7902 FORD ANALYST 7566 03-dec-81 3000 20
7934 MILLER Clerk 7782 23-jan-82 1300 10

Rows selected.

Sql>

B. Service Oracle Stop

Sql> disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-productionwith the partitioning, OLA P and Data Mining options[[email protected] ~]$ logout[[email protected] ~]# service Oracle stopstoping Oracle Listeners. .. Done.stoping Oracle Databases ... Done. [[email protected] ~]# su-oracle[[email protected] ~]$ sqlplus "/as sysdba" Sql*plus:release 10.2.0.1.0-production on Mon Nov 20:17:20 2012Copyright (c) 1982, 2005, Oracle.  

C. Service Oracle Start

D. Service Oracle Restart

At this point, the Oracle Service start & Stop script is set up with the boot boot setting.

Installing Oracle 10g R2 under CentOS 6.3 (x32)

Http://www.cnblogs.com/mchina/archive/2012/11/06/2737472.html

David Camp

    • Technical Exchange, please add QQ Group:

System operation and Maintenance technology share: 315871865

    • For business cooperation, please contact the author qq:562866602
    • My number: Mchina_tang
    • Write to me: [email protected]
    • My address: Jiangsu/Suzhou

we always believe that sharing is a virtue | We believe, great people Share knowledge ...

Linux Oracle Services Start & Stop scripts and boot from boot

Related Article

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.