Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to enable oracle DB, monitoring, and oem boot (dbstart)

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

How to enable oracle DB, monitoring, and oem boot (dbstart)

Let oracle DB, monitor, and oem boot (dbstart)

Oracle provides an automatic restart function accompanied by the operating system. In Windows, you can modify "my computer-> Management-> Service-> OracleService$ORACLE_SID", or directly use the Win+ R key to open the running window, enter services.msc to open the service, find the corresponding Oracle service, and then change the startup type in its properties to automatic. Generally, it will be automatically set to automatic after installation on the Windows system.

For the Linux/Unix operating system, what should I do if I want to set up an automatic restart? This Oracle provides a dbstart command for startup, and there are two ways to configure it.

1.1.1.1 method 1: configure service service for Linux

1. Modify / etc/oratab

[root@oracle ~] # vim / etc/oratab

Orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y # change N to Y

The file / etc/oratab is created by the root.sh script and is also updated when the instance is created with DBCA. When $ORACLE_SID:$ORACLE_HOME: is set to Y, the instance is allowed to self-start, and when set to N, self-startup is not allowed. The configuration in this file only acts as a switch and does not specifically perform startup and shutdown, which is done by the $ORACLE_HOME/bin/dbstart and dbshut scripts. These two scripts will check the configuration in the / etc/oratab file when they are executed, and can only continue when they are Y.

two。 Modify $ORACLE_HOME/bin/dbstart and $ORACLE_HOME/bin/dbshut

[root@oracle ~] # vim $ORACLE_HOME/bin/dbstart

[root@oracle ~] # vim $ORACLE_HOME/bin/dbshut

ORACLE_HOME_LISTNER=$ORACLE_HOME ($1 changed to $ORACLE_HOME)

The location of ORACLE_HOME_LISTNER: the dbstart of Oracle 11g is on line 80, and the dbshut file is on line 50.

3. Create a startup script

Create a script using the root user:

[root@oracle ~] # vim / etc/rc.d/init.d/oracle

#! / bin/bash

# chkconfig: 2345 99 10

# description: Startup Script for oracle Databases

# / etc/rc.d/init.d/oracle

Export ORACLE_BASE=/u01/app/oracle/

Export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

Export PATH=$PATH:$ORACLE_HOME/bin

Export ORACLE_UNQNAME=PROD1

Echo "> > / var/log/oraclelog

Echo `date +'% Y-%m-%d% HRV% MVA% S`` > / var/log/oraclelog

Case "$1" in

Start)

Echo "- startup oracle-" > > / var/log/oraclelog

Su oracle-c "$ORACLE_HOME/bin/dbstart"

Su oracle-c "$ORACLE_HOME/bin/emctl start dbconsole"

Touch / var/lock/subsys/oracle

Echo `date +'% Y-%m-%d% HRV% MVA% S`` > / var/log/oraclelog

Echo "- startup oracle successful-" > > / var/log/oraclelog

Echo "OK"

Stop)

Echo "- shutdown oracle-" > > / var/log/oraclelog

Su oracle-c "$ORACLE_HOME/bin/dbshut"

Su oracle-c "$ORACLE_HOME/bin/emctl stop dbconsole"

Rm-f / var/lock/subsys/oracle

Echo `date +'% Y-%m-%d% HRV% MVA% S`` > / var/log/oraclelogg

Echo "- shutdown oracle successful-" > > / var/log/oraclelog

Echo "OK"

Restart)

Echo "- shutdown oracle-" > > / var/log/oraclelog

Su oracle-c "$ORACLE_HOME/bin/dbshut"

Su oracle-c "$ORACLE_HOME/bin/emctl stop dbconsole"

Rm-f / var/lock/subsys/oracle

Echo `date +'% Y-%m-%d% HRV% MVA% S`` > / var/log/oraclelog

Echo "- shutdown oracle successful-" > > / var/log/oraclelog

Echo "- startup oracle-" > > / var/log/oraclelog

Su oracle-c "$ORACLE_HOME/bin/dbstart"

Su oracle-c "$ORACLE_HOME/bin/emctl start dbconsole"

Touch / var/lock/subsys/oracle

Echo `date +'% Y-%m-%d% HRV% MVA% S`` > / var/log/oraclelog

Echo "- startup oracle successful-" > > / var/log/oraclelog

Echo "OK"

*)

Echo "Usage: 'basename $0' start | stop | restart"

Exit 1

Esac

Exit 0

4. Set permissions to the script

[root@oracle ~] # chmod 755 / etc/rc.d/init.d/oracle

5. Build servic

[root@oracle] # chkconfig-- add oracle

[root@oracle ~] # chkconfig oracle on

[root@oracle] # chkconfig-- list oracle

Oracle 0:off 1:off 2:on 3:on 4:on 5:on 6:off

6. Check whether it is effective or not

First, use root users to test whether the service works:

[root@edsir4p1 ~] # service oracle stop

[root@edsir4p1 ~] # service oracle start

[root@edsir4p1 ~] # service oracle restart

Restart OS to verify whether it works.

Use service to test:

[root@edsir4p1 ~] # service oracle stop

Processing Database instance "PROD1": log file / u01/app/oracle/product/11.2.0/dbhome_1/shutdown.log

Processing Database instance "PROD2": log file / u01/app/oracle/product/11.2.0/dbhome_1/shutdown.log

Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0

Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.

Https://edsir4p1.us.oracle.com:1158/em/console/aboutApplication

Stopping Oracle Enterprise Manager 11g Database Control...

... Stopped.

OK

[root@edsir4p1 ~] # service oracle start

Processing Database instance "PROD1": log file / u01/app/oracle/product/11.2.0/dbhome_1/startup.log

Processing Database instance "PROD2": log file / u01/app/oracle/product/11.2.0/dbhome_1/startup.log

Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0

Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.

Https://edsir4p1.us.oracle.com:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 11g Database Control. Started.

-

Logs are generated in directory / u01/app/oracle/product/11.2.0/dbhome_1/edsir4p1.us.oracle.com_PROD1/sysman/log

OK

1.1.1.2 method 2: configure / etc/rc.d/rc.local file

1. Modify / etc/oratab

[root@oracle ~] # vim / etc/oratab

Orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y # change N to Y

two。 Modify $ORACLE_HOME/bin/dbstart and $ORACLE_HOME/bin/dbshut

[root@oracle ~] # vim $ORACLE_HOME/bin/dbstart

[root@oracle ~] # vim $ORACLE_HOME/bin/dbshut

ORACLE_HOME_LISTNER=$ORACLE_HOME ($1 changed to $ORACLE_HOME)

The location of ORACLE_HOME_LISTNER: the dbstart of Oracle 11g is on line 80, and the dbshut file is on line 50.

3. Create a startup script

Add the following script to the / etc/rc.d/rc.local or / etc/rc.local file (/ etc/rc.local is the soft connection file for / etc/rc.d/rc.local):

Export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

Su oracle-c $ORACLE_HOME/bin/dbstart

Export ORACLE_UNQNAME=PROD1

Su oracle-c "$ORACLE_HOME/bin/emctl start dbconsole"

If no EM is created in the environment, you don't have to add the lines ORACLE_UNQNAME and emctl.

It should be noted that / etc/rc.local is the soft connection file for / etc/rc.d/rc.local, as shown below:

[oracle@edsir4p1-PROD1 ~] $ll / etc/rc.local

Lrwxrwxrwx 1 root root 13 Aug 31 2013 / etc/rc.local-> rc.d/rc.local

[oracle@edsir4p1-PROD1 ~] $ll / etc/rc.d/rc.local

-rwxr-xr-x 1 root root 401 Jan 2 03:51 / etc/rc.d/rc.local

4. Check whether it is effective or not

First, use root users to test whether the service works:

[root@edsir4p1 ~] # export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

[root@edsir4p1 ~] # su oracle-c $ORACLE_HOME/bin/dbstart

Processing Database instance "PROD1": log file / u01/app/oracle/product/11.2.0/dbhome_1/startup.log

Processing Database instance "PROD2": log file / u01/app/oracle/product/11.2.0/dbhome_1/startup.log

Restart OS to verify whether it works.

1.1.1.3 Summary

For these two methods, there are several issues that should be paid attention to:

1. Multiple instances are automatically restarted.

two。 The monitor will also restart automatically.

3. The detailed logs of the restart are $ORACLE_HOME/shutdown.log and $ORACLE_HOME/startup.log.

4. The environment variables of oracle users do not need to be configured.

5. The function of ORACLE_UNQNAME is to set the environment variable of EM, and emctl is to start OEM. If not, you don't have to set it.

6. The role of ORACLE_HOME is to set the environment variables for database listening.

7. For ASM and RAC environments, you only need to register the database resources in the CRS to boot.

About Me

. .

● author: wheat seedlings, part of the content is sorted out from the network, if there is any infringement, please contact the wheat seedlings to delete

● article is updated synchronously on itpub (http://blog.itpub.net/26736162/abstract/1/), blog Park (http://www.cnblogs.com/lhrbest) and personal Wechat official account (xiaomaimiaolhr).

● article itpub address: http://blog.itpub.net/26736162/abstract/1/

● article blog park address: http://www.cnblogs.com/lhrbest

● pdf version of this article, personal introduction and wheat seedling cloud disk address: http://blog.itpub.net/26736162/viewspace-1624453/

● database written examination interview questions database and answers: http://blog.itpub.net/26736162/viewspace-2134706/

● DBA Baodian Jinri Toutiao address: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826

. .

● QQ group number: 230161599 (full), 618766405

● WeChat group: you can add me Wechat, I will pull everyone into the group, if you are the one

● contact me, please add QQ friend (646634621), indicate the reason for adding

● completed at 24:00 in Mordor from 2018-01-01 06:00 to 2018-01-31.

The content of the ● article comes from the study notes of wheat seedlings, and some of it is sorted out from the Internet. Please forgive me if there is any infringement or improper place.

Copyright ● all rights reserved, welcome to share this article, please reserve the source for reprint

. .

The micro store of ● wheat seedlings: https://weidian.com/s/793741433?wfr=c&ifr=shopdetail

A series of database books published by ● wheat seedlings: http://blog.itpub.net/26736162/viewspace-2142121/

● good news: wheat seedlings OCP and OCM have started classes. For more information, please click: http://blog.itpub.net/26736162/viewspace-2148098/

. .

Use Wechat client to scan the following QR code to follow the Wechat official account (xiaomaimiaolhr) and QQ group (DBA treasure book) of wheat seedlings and learn the most practical database technology.

Wheat seedling Wechat official account wheat seedling DBA treasure QQ group 2 "DBA written test noodles treasure book" readers group wheat seedlings micro shop

. .

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report