Linux under the Oracle set up to boot implementation method _oracle

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

After installing Oracle 10g R2 under CentOS 6.3, you will find that Oracle does not start on its own, which is normal, because installing Oracle under Linux does not start on its own, you have to set the relevant parameters yourself, First, let's begin by describing how to launch Oracle in general.

First, start Oracle under Linux

Log on to CentOS, switch to Oracle user rights

# su–oracle

Then enter:

$ sqlplus "/as sysdba"

The original picture will become
Sql>

Next, enter
Sql> Startup

You can start the database normally.

In addition, the instructions for stopping the database are as follows:
sql> shutdown Immediate

Second, check the Oracle DB Listener is normal

Back to Terminal mode, enter:

$ LSNRCTL Status

Check to see if the listener has started

If it is not started, you can enter:

$ lsnrctl Start

Start the Listener

Sql> Conn SYS@ORCL 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 currently not responding, this side to start another, start the instructions are as follows:

$ emctl Start Dbconsole

This instruction runs for a long time and finishes the screen as follows:

When you start the Oracle database manually, create a script that starts the system to launch Oracle yourself.

Iv. Oracle Start & Stop Scripts

1. Modify Oracle System Configuration file:/etc/oratab, only in this way, Oracle Dbstart and Dbshut can play a role.

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

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

2. Create a file Oracle under/etc/init.d/, which reads as follows:

Copy Code code as follows:

#!/bin/sh
# chkconfig:35 80 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 database in Ora_home.
ora_home=/opt/oracle/102
Ora_owner=oracle
if [!-F $ORA _home/bin/dbstart]
Then
echo "Oracle startup:cannot start"
Exit
Fi
Case "$" in
' Start ')
# Start the Oracle databases:
echo "Starting Oracle Databases ... "
echo "-------------------------------------------------" >>/var/log/oracle
Date + "%T%a%d:starting Oracle Databases as part of system up." >>/var/log/oracle
echo "-------------------------------------------------" >>/var/log/oracle
su-$ORA _owner-c "$ORA _home/bin/dbstart" >>/var/log/oracle
echo "Done"
# Start The Listener:
echo "Starting Oracle Listeners ... "
echo "-------------------------------------------------" >>/var/log/oracle
Date + "%T%a%d:starting Oracle Listeners as part of system up." >>/var/log/oracle
echo "-------------------------------------------------" >>/var/log/oracle
su-$ORA _owner-c "$ORA _home/bin/lsnrctl start" >>/var/log/oracle
echo "Done."
echo "-------------------------------------------------" >>/var/log/oracle
Date + "%T%a%d:finished." >>/var/log/oracle
echo "-------------------------------------------------" >>/var/log/oracle
Touch/var/lock/subsys/oracle

' Stop ')
# Stop the Oracle Listener:
echo "Stoping Oracle Listeners ... "
echo "-------------------------------------------------" >>/var/log/oracle
Date + "%T%a%d:stoping Oracle Listener as part of system down." >>/var/log/oracle
echo "-------------------------------------------------" >>/var/log/oracle
su-$ORA _owner-c "$ORA _home/bin/lsnrctl Stop" >>/var/log/oracle
echo "Done."
Rm-f/var/lock/subsys/oracle
# Stop the Oracle Database:
echo "Stoping Oracle Databases ... "
echo "-------------------------------------------------" >>/var/log/oracle
Date + "%T%a%d:stoping Oracle Databases as part of system down." >>/var/log/oracle
echo "-------------------------------------------------" >>/var/log/oracle
su-$ORA _owner-c "$ORA _home/bin/dbshut" >>/var/log/oracle
echo "Done."
echo ""
echo "-------------------------------------------------" >>/var/log/oracle
Date + "%T%a%d:finished." >>/var/log/oracle
echo "-------------------------------------------------" >>/var/log/oracle

' Restart ')
$ stop
$ start

Esac

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

4. Add Service
# chkconfig--level Oracle on

5. Need to stop the database before shutting down or restarting the machine, do the operation
# Ln-s/etc/init.d/oracle/etc/rc0.d/k01oracle/shutdown
# ln-s/etc/init.d/oracle/etc/rc6.d/k01oracle//reboot

6. How to use
# service Oracle Start//Start Oracle
# Service Oracle Stop//Close Oracle
# Service Oracle Restart//Restart Oracle

7. Test

A. Power-on self-starter

Copy Code code as follows:

Last Login:mon Nov 19:57:06 from 10.0.0.145
[Root@ors ~]# Su-oracle
[Oracle@ors ~]$ sqlplus "/as sysdba"

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

Copyright (c) 1982, +, 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
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
SMITH Clerk 7902 17-dec-80 800 20
ALLEN salesman 7698 20-feb-81 1600 300 30
WARD salesman 7698 22-feb-81 1250 500 30
JONES MANAGER 7839 02-apr-81 2975 20
MARTIN salesman 7698 28-sep-81 1250 1400 30
BLAKE MANAGER 7839 01-may-81 2850 30
CLARK MANAGER 7839 09-jun-81 2450 10
SCOTT ANALYST 7566 19-apr-87 3000 20
KING PRESIDENT 17-nov-81 5000 10
TURNER salesman 7698 08-sep-81 1500 0 30
ADAMS Clerk 7788 23-may-87 1100 20
JAMES Clerk 7698 03-dec-81 950 30
FORD ANALYST 7566 03-dec-81 3000 20
MILLER Clerk 7782 23-jan-82 1300 10
Rows selected.

Sql>

B. Service Oracle Stop

Copy Code code as follows:

Sql> disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-production
With the partitioning, OLAP and Data Mining options
[Oracle@ors ~]$ Logout
[Root@ors ~]# Service Oracle Stop
Stoping Oracle Listeners ...
Done.
Stoping Oracle Databases ...
Done.
[Root@ors ~]# Su-oracle
[Oracle@ors ~]$ sqlplus "/as sysdba"
Sql*plus:release 10.2.0.1.0-production on Mon Nov 26 20:17:20 2012
Copyright (c) 1982, +, Oracle. All rights reserved.
Connected to a idle instance.
Sql> set linesize 300;
Sql> set pagesize 30;
Sql> select * from Scott.emp;
SELECT * FROM Scott.emp
*
ERROR at line 1:
Ora-01034:oracle Not available
Sql>

C. Service Oracle Start

Copy Code code as follows:

Sql> disconnected
[Oracle@ors ~]$ Logout
[Root@ors ~]# Service Oracle Start
Starting Oracle Databases ...
Done
Starting Oracle Listeners ...
Done.
[Root@ors ~]#

D. Service Oracle Restart

Copy Code code as follows:

[Root@ors ~]# Service Oracle Restart
Stoping Oracle Listeners ...
Done.
Stoping Oracle Databases ...
Done.

Starting Oracle Databases ...
Done
Starting Oracle Listeners ...
Done.
[Root@ors ~]#

At this point, the Oracle service startup & Stop scripts and power-on self boot settings are complete.

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.