linux下數(shù)據(jù)庫實例監(jiān)聽開機自啟動設(shè)置
2018年8月1日 zhanky
揚州網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)自2013年創(chuàng)立以來到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)。
測試介紹
系統(tǒng)版本:Oracle linux 7.2 x64
數(shù)據(jù)庫版本: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
一、設(shè)置監(jiān)聽和CDB開機自啟
通過使用rc.local開機自動運行腳本,調(diào)用Oracle自帶的dbstart和lsnrct啟動。但調(diào)用dbstart需要在oratab中允許
1、修改oratab
[root@zhanky ~]# vi /etc/oratab
[root@zhanky ~]# 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.
#
#
2、編輯rc.local
因為Oracle linux 7.2默認rc.local是沒有執(zhí)行權(quán)限,需執(zhí)行chmod自己增加
dbstart默認將oratab中參數(shù)為Y的所有庫啟動
[root@zhanky ~]# vi /etc/rc.d/rc.local
[root@zhanky ~]# 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用戶登錄,運行l(wèi)snrctl start 腳本啟用監(jiān)聽。
su - oracle -c "/u01/app/oracle/product/12.2.0/db_1/bin/lsnrctl start"
##用oracle用戶登錄,運行dbstart啟動數(shù)據(jù)庫
su - oracle -c "/u01/app/oracle/product/12.2.0/db_1/bin/dbstart"
[root@zhanky ~]# chmod +x /etc/rc.d/rc.local
二、設(shè)置PDB自動啟動
通過觸發(fā)器來啟東PDB,下列觸發(fā)器中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;
/
三、測試驗證,重啟數(shù)據(jù)庫服務(wù)器即可。
分享名稱:ORACLE12C開機自動啟動監(jiān)聽、CDB、PDB
本文地址:http://m.rwnh.cn/article44/jipshe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、靜態(tài)網(wǎng)站、虛擬主機、品牌網(wǎng)站制作、定制網(wǎng)站、網(wǎng)頁設(shè)計公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)