Oracle12c+启动pdb监听,ORACLE 12C 开机自动启动监听、CDB、PDB

linux下数据库实例监听开机自启动设置

2018年8月1日 zhanky

测试介绍

系统版本:Oracle linux 7.2 x64

数据库版本:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

实例名:orcl CDP:orcl PDB:orcl1、orcl2

ORACLE_HOME:/u01/app/oracle/product/12.2.0/db_1

一、设置监听和CDB开机自启

通过使用rc.local开机自动运行脚本,调用Oracle自带的dbstart和lsnrct启动。但调用dbstart需要在oratab中允许

1、修改oratab

[[email protected] ~]# vi /etc/oratab

[[email protected] ~]# 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::

#

# 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.

#

#

2、编辑rc.local

因为Oracle linux 7.2默认rc.local是没有执行权限,需执行chmod自己增加

dbstart默认将oratab中参数为Y的所有库启动

[[email protected] ~]# vi /etc/rc.d/rc.local

[[email protected] ~]# cat /etc/rc.d/rc.local

!/bin/bash

THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES

It is highly advisable to create own systemd services or udev rules

to run scripts during boot instead of using this file.

In contrast to previous versions due to parallel execution during boot

this script will NOT be run after all other services.

Please note that you must run ‘chmod +x /etc/rc.d/rc.local‘ to ensure

that this script will be executed during boot.

touch /var/lock/subsys/local

##用oracle用户登录,运行lsnrctl start 脚本启用监听。

su - oracle -c "/u01/app/oracle/product/12.2.0/db_1/bin/lsnrctl start"

##用oracle用户登录,运行dbstart启动数据库

su - oracle -c "/u01/app/oracle/product/12.2.0/db_1/bin/dbstart"

[[email protected] ~]# chmod +x /etc/rc.d/rc.local

二、设置PDB自动启动

通过触发器来启东PDB,下列触发器中ALTER PLUGGABLE DATABASE ALL OPEN代表将所有PDB启动,

如果只需

CREATE OR REPLACE TRIGGER open_pdbs

AFTER STARTUP ON DATABASE

BEGIN

EXECUTE IMMEDIATE ‘ALTER PLUGGABLE DATABASE ALL OPEN‘;

END open_pdbs;

/

三、测试验证,重启数据库服务器即可。

原文:http://blog.51cto.com/zhanky/2153245

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值