oracle怎么自動運行 oracle啟動后立馬自動關(guān)閉

如何啟動oracle

1、打開服務(wù)窗口:使用 win+r 快捷鍵打開運行窗口,輸入命令?services.msc?按回車。

成都創(chuàng)新互聯(lián)專業(yè)做網(wǎng)站、網(wǎng)站建設(shè),集網(wǎng)站策劃、網(wǎng)站設(shè)計、網(wǎng)站制作于一體,網(wǎng)站seo、網(wǎng)站優(yōu)化、網(wǎng)站營銷、軟文平臺等專業(yè)人才根據(jù)搜索規(guī)律編程設(shè)計,讓網(wǎng)站在運行后,在搜索中有好的表現(xiàn),專業(yè)設(shè)計制作為您帶來效益的網(wǎng)站!讓網(wǎng)站建設(shè)為您創(chuàng)造效益。

2、在標(biāo)準(zhǔn)視圖下找到 oracle 的 7個服務(wù)。

3、可以看到 7 個服務(wù)中有四個服務(wù)的啟動方式是自動運行的(綠線標(biāo)注的)。把這幾個服務(wù)的啟動方式改成手動。

注:(1)以O(shè)racleDBConsoleorcl 服務(wù)為例:右擊服務(wù)– 屬性。

(2)修改完成之后的效果,除 OracleJobSchedulerORCL 是禁用外,其他的都是手動啟動。

4、按照先后順序依次啟動服務(wù)”O(jiān)racle ServiceORCL“,”O(jiān)racleOraDb11g-home1TNSListener“。啟動方式:右擊服務(wù)–啟動,如下圖所示,即可成功啟動。

OracleJob不自動運行解決辦法

ORACLE有一種定時調(diào)度機制 用dbms_job包來管理

設(shè)置的JOB就是不運行 搞得的郁悶

最好執(zhí)行了這個才搞定 exec dbms_ijob set_enabled(true);

下面提供一個checklist用于檢查job異常的原因

) Instance in RESTRICTED SESSIONS mode?

Check if the instance is in restricted sessions mode:

select instance_name logins from v$instance;

If logins=RESTRICTED then:

alter system disable restricted session;

^– Checked!

) JOB_QUEUE_PROCESSES=

Make sure that job_queue_processes is

show parameter job_queue_processes

^– Checked!

) _SYSTEM_TRIG_ENABLED=FALSE

Check if _system_enabled_trigger=false

col parameter format a

col value format a

select a ksppinm parameter b ksppstvl value from x$ksppi a x$ksppcv b

where a indx=b indx and ksppinm= _system_trig_enabled ;

If _system_trig_enabled=false then

alter system set _system_trig_enabled =TRUE scope=both;

^– Checked!

) Is the job BROKEN?

select job broken from dba_jobs where job=job_number;

If broken then check the alert log and trace files to diagnose the issue

^– Checked! The job is not broken

) Is the job MITted?

Make sure a mit is issued after submitting the job:

DECLARE X NUMBER;

BEGIN

SYS DBMS_JOB SUBMIT

(

job = X

what = dbms_utility *** yze_schema

( SCOTT PUTE NULL NULL NULL);

next_date = to_date( / / : : ′ dd/mm/yyyy hh :mi:ss )

no_parse = FALSE

);

MIT;

END;

/

If the job executes fine if forced (i e exec dbms_jobs run(job_no);) then likely a mit

is missing

^– Checked! The job is mitted after submission

) UPTIME days

Check if the server (machine) has been up for more than days:

For SUN use uptime OS mand

If uptime and the jobs do not execute automatically then you are hitting unpublished bug

(Jobs may stop running after days uptime) which is fixed in and A

^– Checked! The server in this case has been up days only

) DBA_JOBS_RUNNING

Check dba_jobs_running to see if the job is still running:

select * from dba_jobs_running;

^– Checked! The job is not running

LAST_DATE and NEXT_DATE

Check if the last_date and next_date for the job are proper:

select Job Next_date Last_date from dba_jobs where job=job_number;

^– NEXT_DATE is porper however LAST_DATE is null since the job never executes automatically

) NEXT_DATE and INTERVAL

Check if the Next_date is changing properly as per the interval set in dba_jobs:

select Job Interval Next_date Last_date from dba_jobs where job=job_number;

^– This is not possible since the job never gets executed automatically

) Toggle value for JOB_QUEUE_PROCESSES

Stop and restart CJQ process(es)

alter system set job_queue_processes= ;

–Wait for some time to ensure CJQ process stopped

alter system set job_queue_processes= ;

Ref: Bug (fixed by: )

^– Done but did not help

) DBMS_IJOB(Non documented):

Last ditch effort

Either restart the database or try the following:

exec dbms_ijob set_enabled(true);

Ref: Bug (Closed Not a Bug)

Done but did not help

These are the most mon causes for this behavior

Solution

The solution ended up to be the server (machine) uptime

Even though it was up for only days after the server was rebooted all jobs were able to execute automatically

To implement the solution please execute the following steps:

Shutdown all applications including databases

Shutdown the server (machine)

Restart all applications including databases

Check that jobs are executing automatically

lishixinzhi/Article/program/Oracle/201311/16944

oracle開機自動啟動方法

以redhat 和oracle g為例 安裝過程參考官方文檔 以下是實現(xiàn)oracle自啟動的方法

配置dbstart和dbshut

在$ORACLE_HOME/bin中 有dbstart和dbshut這兩個腳本 more dbstart看一下可以看到

QUOTE:

#

# $Id: dbstart sh pp may : : vikrkuma Exp $

# Copyright (c) Oracle All rights reserved

#

###################################

#

# usage: dbstart

#

# This is used to start ORACLE from /etc/rc( local)

# It should ONLY be executed as part of the system boot procedure

#

# This will start all databases listed in the oratab file

# whose third field is a Y If the third field is set to Y and

# there is no ORACLE_SID for an entry (the first field is a *)

# then this will ignore that entry

#

# This requires that ASM ORACLE_SID s start with a + and

# that non ASM instance ORACLE_SID s do not start with a +

#

# If ASM instances are to be started with this it cannot

# be used inside an rc* d directory and should be invoked from

# rc local only Otherwise the CSS service may not be available

# yet and this will block init from pleting the boot

# cycle

#

# Note:

# Use ORACLE_TRACE=T for tracing this

#

# The progress log for each instance bringup plus Error and Warning message[s]

# are logged in file $ORACLE_HOME/startup log The error messages related to

# instance bringup are also logged to syslog (system log module)

# The Listener log is located at $ORACLE_HOME_LISTNER/listener log

可以看出這個腳本是用來啟動oracle服務(wù)的 包括listener instance a *** instances 并且可以放到/etc/rc( local) 同樣dbshut也是起到關(guān)閉服務(wù)的作用

配置系統(tǒng)使這個腳本起作用

) 以root編輯/etc/oratab 類似 orcl:/u /product/ /db_ :N 這種格式 其中orcl是你的ORACLE_SID /u /product/ /db_ 是ORACLE_HOME 這里需要把N改為Y 即orcl:/u /product/ /db_ :Y這樣

) 以oracle編輯$ORACLE_HOME/bin/dbstart 找到其中第 行:ORACLE_HOME_LISTNER=改為你自己的路徑 或者可以改成ORACLE_HOME_LISTNER=$ORACLE_HOME

保存腳本 以oracle用戶運行dbshut和dbstart看是否能關(guān)閉 啟動數(shù)據(jù)庫 如果不能 一般是參數(shù)設(shè)置 根據(jù)報錯找到對應(yīng)位置更改

把dbstart和dbshut加到redhat啟動服務(wù)中

經(jīng)過上一步的配置 可以直接用dbstart命令啟動數(shù)據(jù)listener instance a *** instances 但是還沒有啟動oracle g的EM ORACLE利用web頁面管理數(shù)據(jù)庫相當(dāng)方便 也是 g的一個特色 所以應(yīng)該一并啟動起該服務(wù)來

QUOTE:

$ORACLE_HOME/bin/emctl start dbconsole

因此我們可以用rc local或者redhat服務(wù)都可以實現(xiàn)要求的開機啟動 下面分別說一下

) 利用rc local 直接把dbstart加到rc local中 實現(xiàn)開機自動啟動 這里需要注意的是必須以oracle啟動該腳本

用root編輯/etc/rc local 添加下面一行

QUOTE:

su oracle c /u /product/ /db_ /bin/dbstart

su oracle c /u /product/ /db_ /bin/emctl start dbconsole

這里/u /product/ /db_ 需要替換成實際的ORACLE_HOME

保存并退出后 reboot服務(wù)器測試一下 可以看到 當(dāng)系統(tǒng)啟動以后oracle監(jiān)聽 實例和em都已經(jīng)起來了

) 如果我們不用rc local 也可以加到redhat服務(wù)中 在/etc/rc d/init d中添加如下腳本文件 命名為oracle

QUOTE:

#!/bin/sh

#cconfig:

#deion: ORACLE g Server

ORACLE_HOME=/u /product/ /db_

if [ ! f $ORACLE_HOME/bin/dbstart ]

then

echo ORACLE cannot start

exit

fi

case $ in

start )

echo Starting Oracle Database

su oracle c $ORACLE_HOME/bin/dbstart

su oracle c $ORACLE_HOME/bin/emctl start dbconsole

;;

stop )

echo Stoping Oracle Database

su oracle c $ORACLE_HOME/bin/emctl stop dbconsole

su oracle c $ORACLE_HOME/bin/dbshut

;;

esac

注意其中兩行注釋 網(wǎng)上很多腳本因為少了這兩行不能使服務(wù)自啟動

QUOTE:

#cconfig:

#deion: ORACLE g Server

其中cconfig 是指腳本將為運行級 啟動oracle g服務(wù) 啟動優(yōu)先級為 關(guān)閉優(yōu)先級為

然后以root權(quán)限:

QUOTE:

# cd /etc/rc d

# ln s /etc/rc d/init d/oracle S oracle

# cconfig list oracle

# cconfig level on

重啟系統(tǒng) 就可以在啟動的過程中看到 Starting oracle 因為我們設(shè)置的優(yōu)先級為 一般是最后啟動 [OK]以后就可以了 因為要啟動emctl 可能有點慢 等待的時間要稍微長一點

lishixinzhi/Article/program/Oracle/201311/16863

如何在WINDOWS下讓ORACLE自動啟動

參考:

Oracle中 NLS_DATE_FORMAT的設(shè)置方法

Oracle日期格式默認(rèn)為:DD-MON-YY,以下是3種方法可以修改使之永久生效;

1、修改glogin.sql文件,這個文件的路徑為:

Windows下:

%ORACLE_HOME\sqlplus\admin\

Unix下:

$ORACLE_HOME/sqlplus/admin/

在文件中加入:

alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';

2、修改注冊表(windows平臺)

開始--運行--regedit--HKEY_LOCAL_MACHINE--SOFTWARE--ORACLE--KEY_ORADb10g_home1

新建字符串值:

NLS_DATE_FORMAT,并設(shè)置其值為:YYYY-MM-DD:HH24:MI:SS

3、修改用戶環(huán)境變量(Unix平臺)

export NLS_DATE_FORMAT =AMERICAN

export NLS_DATE_FORMAT ='YYYY-MM-DD HH24:MI:SS'

RMAN會話中設(shè)置NLS_DATE_FORMAT 和NLS_LANG

run {

...........

sql 'alter session set NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS";

sql 'alter session set NLS_LANG ="AMERICAN";

如何設(shè)置Oracle的EM管理器自動運行

root登錄,執(zhí)行以下命令進入init.d目錄并創(chuàng)建oracle文件:

vim/etc/rc.d/init.d/oracle

#!/bin/bash

# chkconfig:345 99 10

#description: Startup Script for Oracle Databases

#/etc/rc.d/init.d/dbstart

exportORACLE_BASE=/u01/app/oracle/

exportORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home1

exportORACLE_SID=orcl

exportPATH=$PATH:$ORACLE_HOME/bin

ORA_OWNR="oracle"

# if theexecutables do not exist -- display error

if [ ! -f$ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]

then

echo"Oracle startup: cannot start"

exit 1

fi

# dependingon parameter -- startup, shutdown, restart

# of theinstance and listener or usage display

case"$1" in

start)

# Oraclelistener and instance startup

echo -n"Starting Oracle: "

su -$ORA_OWNR -c "$ORACLE_HOME/bin/dbstart"

touch/var/lock/Oracle

#su -$ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"

#su -$ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl start"

echo"OK"

;;

stop)

# Oraclelistener and instance shutdown

echo -n"Shutdown Oracle: "

#su -$ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"

#su -$ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl stop"

su -$ORA_OWNR -c "$ORACLE_HOME/bin/dbshut"

su -$ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"

rm -f/var/lock/Oracle

echo"OK"

;;

reload|restart)

$0 stop

$0 start

;;

*)

echo"Usage: `basename $0` start|stop|restart|reload"

exit 1

esac

exit 0

######################################################

chmod 775/etc/rc.d/init.d/oracle

chkconfig--add oracle

看上面加了注釋的su開頭的行,dbconsole那行就是em管理器自動啟動的配置

oracle12c定時任務(wù)怎么自動執(zhí)行

1.引言

定制定時執(zhí)行的任務(wù)有兩種形式,系統(tǒng)級別和數(shù)據(jù)庫級別,

從操作系統(tǒng)級別來講,

windows系統(tǒng)我們可以使用任務(wù)計劃來實現(xiàn),

對于winXP系統(tǒng),設(shè)置步驟如下,開始---設(shè)置---控制面板---任務(wù)計劃,然后添加任務(wù)計劃,按向?qū)瓿膳渲眉纯?

對于win7系統(tǒng),設(shè)置步驟如下,點擊開始,然后在 搜索程序和文件 框中輸入 [任務(wù)計劃],然后點擊出來的任務(wù)計劃程序,創(chuàng)建一個基本任務(wù)即可;

linux系統(tǒng)我們可以使用crontab命令來是實現(xiàn),

關(guān)于crontab命令的使用可以見之前的博客

從數(shù)據(jù)庫級別來講,我們可以采用數(shù)據(jù)庫的job來實現(xiàn);

本節(jié)主要介紹通過oracle數(shù)據(jù)庫的job來定制一個簡單的定時執(zhí)行任務(wù)。本節(jié)會采用oracle定制一個定時向一個表中插入語句。

這里聊一下我做這個oracle定時任務(wù)的緣由:

項目中要在固定的時間,把一個數(shù)據(jù)庫中某些表的數(shù)據(jù)同步到另外一個數(shù)據(jù)庫,顯然這些工作我不能每次都自己去做,

那么,我要怎么來做呢?這個時候oracle的定時執(zhí)行任務(wù)JOB無疑是我的最佳選擇。我把同步的腳本放在一個存儲過程中,

然后在固定的時間去執(zhí)行這個存儲過程就OK了。

注意:以下所有的操作都是在sytem用戶下執(zhí)行。采用PL/SQL做的客戶端登陸。

分享文章:oracle怎么自動運行 oracle啟動后立馬自動關(guān)閉
轉(zhuǎn)載來源:http://muchs.cn/article24/hggoje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、營銷型網(wǎng)站建設(shè)、服務(wù)器托管網(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)

成都定制網(wǎng)站網(wǎng)頁設(shè)計