ITPub博客

首页 > 数据库 > Oracle > 保姆级教程-麒麟arm环境下部署oracle19c并设置开机自启

保姆级教程-麒麟arm环境下部署oracle19c并设置开机自启

原创 Oracle 作者:pingdanorcale 时间:2025-08-28 21:34:32 0 删除 编辑

1. 修改 oracle 的启动脚本配置

vi /etc/oratab

root@localhost ~]# cat /etc/oratab 

#

# This file is used by ORACLE utilities.  It is created by root.sh

# and updated by either Database Configuration Assistant while creating

# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates

# the entry.  Lines beginning with a pound sign, '#', are comments.

#

# Entries are of the form:

#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:

#

# The first and second fields are the system identifier and home

# directory of the database respectively.  The third field indicates

# to the dbstart utility that the database should , "Y", or should not,

# "N", be brought up at system boot time.

#

# Multiple entries with the same $ORACLE_SID are not allowed.

#

#

orcl:/u01/app/oracle/product/19.0.0/dbhome_1:Y

[root@localhost ~]# 

2.新增一个关于oracle19c的服务

[root@localhost ~]# cat  /etc/systemd/system/oracle.service

[Unit]

Description=Oracle Database and Listener

After=network.target

[Service]

Type=forking

User=oracle

Group=oinstall

Environment="ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1"

Environment="ORACLE_SID=orcl"

Environment="PATH=/usr/local/bin:/usr/bin:/bin:/u01/app/oracle/product/19.0.0/dbhome_1/bin"


ExecStartPre=/bin/bash -c "/u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl status || /u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl start"

ExecStart=/bin/bash -c "/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbstart u01/app/oracle/product/19.0.0/dbhome_1"

ExecStop=/bin/bash -c "/u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl stop && /u01/app/oracle/product/19.0.0/dbhome_1/bin/dbshut /u01/app/oracle/product/19.0.0/dbhome_1"


Restart=on-abort

TimeoutSec=300


[Install]

WantedBy=multi-user.target

3.# 重新加载并启动服务

sudo systemctl daemon-reload

sudo systemctl stop oracle.service   # 确保停止残留进程

# sudo pkill -9 -u oracle -f "ora_"   # 强制清理Oracle相关进程

sudo systemctl start oracle.service

sudo systemctl enable oracle.service   # 设置开机自启

sudo systemctl status oracle.service


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10201716/viewspace-3094473/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-01-02

  • 博文量
    158
  • 访问量
    221183