Automating Database Startup and Shutdown(开机启动和关闭oracle)

简介: 參考:http://download.oracle.com/docs/pdf/B10812_02.pdf Use the dbstart and dbshut scripts to automate database startup and shutdown.
參考:http://download.oracle.com/docs/pdf/B10812_02.pdf

Use the dbstart and dbshut scripts to automate database startup and shutdown.
Perform the following tasks to set up these scripts so that they are called at system
startup and shutdown. Perform these steps for every new database that you want to
configure for automated startup and shutdown:
1. Log in as the root user.
2. Edit the oratab file for your platform:
■ Solaris:
/var/opt/oracle/oratab
Note: The procedure described in this section applies to
single-instance databases only.
See Also: For more information about system startup and
shutdown procedures, see the init command in your UNIX
system documentation.
Automating Startup and Shutdown
Starting and Stopping Oracle Software 2-11
■ Other operating systems:
/etc/oratab
Database entries in the oratab file appear in the following format:
SID:ORACLE_HOME:{Y|N}
In this example, Y or N specifies whether you want the scripts to start up or
shut down the database. For each database that you want to start up and shut
down, find the instance identifier (SID) for that database, identified by the SID
in the first field, and change the last field for each to Y.
3. Change directory to one of the following directories, depending on your
platform:
4. Create a file called dbora with the following contents. Change the value
specified for the ORACLE_HOME environment variable to an Oracle home
directory for your installation, and change the value of the ORACLE
environment variable to the username of the owner of the database installed in
the Oracle home directory (typically oracle):
#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for you installation
ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1
#
# change the value of ORACLE to the login name of the
# oracle owner at your site
#
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
Platform Initialization File Directory
AIX /etc
Linux and Solaris /etc/init.d
HP-UX and Tru64 UNIX /sbin/init.d
Automating Startup and Shutdown
2-12 Administrator’s Reference
PLATFORM=`uname`
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
if [ "$PLATFORM" = "HP-UX" ] ; then
remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
exit
else
rsh $HOST -l $ORACLE $0 $1 ORA_DB
exit
fi
fi
#
LOG=$ORACLE_HOME/startup.log
touch $LOG
chmod a+r $LOG
#
case $1 in
'start')
echo "$0: starting up" >> $LOG
date >> $LOG
# Start Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ; then
echo "starting Oracle Net Listener"
$ORACLE_HOME/bin/lsnrctl start >> $LOG 2>&1 &
fi
echo "Starting Oracle databases"
$ORACLE_HOME/bin/dbstart >> $LOG 2>&1 &
;;
'stop')
echo "$0: shutting down" >> $LOG
date >> $LOG
# Stop Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ; then
echo "stopping Oracle Net Listener"
$ORACLE_HOME/bin/lsnrctl stop >> $LOG 2>&1 &
fi
echo "stopping Oracle databases"
$ORACLE_HOME/bin/dbshut >> $LOG 2>&1 &
;;
Automating Startup and Shutdown
Starting and Stopping Oracle Software 2-13
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
5. Change the group of the dbora file to the OSDBA group (typically dba) and set
the permissions to 750:
# chgrp dba dbora
# chmod 750 dbora
6. Create symbolic links to the dbora script in the appropriate run-level script
directories, as follows:
Note: This script works only if a password has not been set for the
Oracle Net listener. If a password has been set for the listener, this
script cannot stop the listener. Also, if the listener name is not the
default name LISTENER, you must specify the listener name in the
stop and start commands:
$ORACLE_HOME/bin/lsnrctl {start|stop} listener_name
Platform Symbolic Links Commands
AIX # ln -s /etc/dbora /etc/rc.d/rc2.d/S99dbora
# ln -s /etc/dbora /etc/rc.d/rc2.d/K01dbora
HP-UX # ln -s /sbin/init.d/dbora /sbin/rc3.d/S990dbora
# ln -s /sbin/init.d/dbora /sbin/rc3.d/K001dbora
Linux # ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
Solaris # ln -s /etc/init.d/dbora /etc/rc3.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
Tru64 UNIX # ln -s /sbin/init.d/dbora /sbin/rc3.d/S99dbora
# ln -s /sbin/init.d/dbora /sbin/rc3.d/K01dbora
目录
相关文章
|
7月前
|
SQL Oracle 关系型数据库
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database (
96 2
|
7月前
|
Oracle 关系型数据库
19c 开启Oracle Database Vault
19c 开启Oracle Database Vault
166 1
|
7月前
|
SQL Oracle 关系型数据库
Connect to Autonomous Database Using Oracle Database Tools
Connect to Autonomous Database Using Oracle Database Tools
62 1
|
6月前
|
Oracle 关系型数据库 Linux
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
51 0
|
7月前
|
人工智能 Oracle 关系型数据库
一篇文章弄懂Oracle和PostgreSQL的Database Link
一篇文章弄懂Oracle和PostgreSQL的Database Link
|
7月前
|
SQL Oracle 安全
Oracle Database Vault Access Control Components
Oracle Database Vault Access Control Components
57 0
|
7月前
|
Oracle 安全 关系型数据库
What Is Oracle Database Vault?
The Oracle Database Vault security controls protect application data from unauthorized access, and helps you to comply with privacy and regulatory requirements. You can deploy controls to block privileged account access to application data and control sensitive operations inside the database using
42 0
|
7月前
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
282 0
|
7月前
|
Oracle 关系型数据库 数据库
windows Oracle Database 19c 卸载教程
打开任务管理器 ctrl+Shift+Esc可以快速打开任务管理器,找到oracle所有服务然后停止。 停止数据库服务 在开始卸载之前,确保数据库服务已经停止。你可以使用以下命令停止数据库服务: net stop OracleServiceORCL Universal Installer 卸载Oracle数据库程序 一般情况运行Oracle自带的卸载程序,如使用Universal Installer 工具卸载。 点击开始菜单找到Oracle,然后点击Oracle安装产品,再点击Universal Installer。 点击之后稍等一会然后会进入进入下图界面,点击卸载产品。 选中要删除的Orac
667 1
|
存储 Oracle 关系型数据库
windows 使用 Oracle Database 19c
Oracle数据库是由美国Oracle Corporation(甲骨文公司)开发和提供的一种关系型数据库管理系统,它是一种强大的关系型数据库管理系统(RDBMS)。它使用表格(表)组织和存储数据,通过SQL语言进行数据管理。数据以表格形式存储,表之间可以建立关系。支持事务处理、多版本并发控制、安全性和权限控制。具有高可用性、容错性,支持分布式数据库和可扩展性。Oracle Corporation提供全面的支持和服务,使其成为企业级应用的首选数据库系统。
132 0

推荐镜像

更多