~ampelbein/ubuntu/oneiric/heartbeat/lp-770743

« back to all changes in this revision

Viewing changes to resources/OCF/oracle

  • Committer: Bazaar Package Importer
  • Author(s): Ante Karamatic
  • Date: 2009-08-10 19:29:25 UTC
  • mfrom: (5.2.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090810192925-9zy2llcbgavbskf7
Tags: 2.99.2+sles11r9-5ubuntu1
* New upstream snapshot
* Adjusted heartbeat.install and rules for documentation path

Show diffs side-by-side

added added

removed removed

Lines of Context:
178
178
<action name="start" timeout="120" />
179
179
<action name="stop" timeout="120" />
180
180
<action name="status" timeout="5" />
181
 
<action name="monitor" depth="0" timeout="30" interval="120" start-delay="10" />
 
181
<action name="monitor" depth="0" timeout="30" interval="120" start-delay="0" />
182
182
<action name="validate-all" timeout="5" />
183
183
<action name="methods" timeout="5" />
184
184
<action name="meta-data" timeout="5" />
261
261
#       Run commands in the oracle admin sqlplus...
262
262
#
263
263
dbasql() {
264
 
        typeset func
 
264
        local func
265
265
        (
266
266
        echo "connect / as sysdba"
267
267
        echo "set feedback off"
317
317
        [ x"${clear_backupmode}" = x"true" ]
318
318
}
319
319
is_instance_in_backup_mode() {
320
 
        typeset count
 
320
        local count
321
321
        count="`dbasql db_backup_mode | sed 's/COUNT//'`"
322
322
        [ x"$count" != x"0" ]
323
323
}
324
324
clear_backup_mode() {
325
 
        typeset output
 
325
        local output
326
326
        output="`dbasql dbendbackup`"
327
327
        ocf_log info "Oracle instance $ORACLE_SID alter database end backup: $output"
328
328
}
341
341
 
342
342
# Part 1: Oracle
343
343
dumpinstipc() {
344
 
        typeset dumpdest=`dbasql getdumpdest`
 
344
        local dumpdest=`dbasql getdumpdest`
345
345
        [ "x$dumpdest" != x -a -d "$dumpdest" ] || return 1
346
 
        typeset -i fcount=`ls -rt $dumpdest | wc -l`
 
346
        local -i fcount=`ls -rt $dumpdest | wc -l`
347
347
        dbasql getipc >/dev/null 2>&1
348
 
        typeset lastf=`ls -rt $dumpdest | grep -v '^\.*$' | tail -1`
349
 
        typeset -i fcount2=`ls -rt $dumpdest | wc -l`
 
348
        local lastf=`ls -rt $dumpdest | grep -v '^\.*$' | tail -1`
 
349
        local -i fcount2=`ls -rt $dumpdest | wc -l`
350
350
        [ $((fcount+1)) -eq $fcount2 ] || return 1  # more than one file created
351
351
        echo $dumpdest/$lastf
352
352
}
353
353
parseipc() {
354
 
        typeset inf=$1
 
354
        local inf=$1
355
355
        test -f "$1" || return 1
356
356
        awk '
357
357
                $3 == "Shmid" {n=1;next}
377
377
        grep -w $ORACLE_OWNER | awk '{print $2}'
378
378
}
379
379
ipcdesc() {
380
 
        typeset what=$1
 
380
        local what=$1
381
381
        case $what in
382
382
        m) echo "shared memory segment";;
383
383
        s) echo "semaphore";;
385
385
        esac
386
386
}
387
387
rmipc() {
388
 
        typeset what=$1 id=$2
 
388
        local what=$1 id=$2
389
389
        ipcs -$what | filteroraipc | grep -w $id >/dev/null 2>&1 ||
390
390
                return
391
391
        ocf_log info "Removing `ipcdesc $what` $id."
392
392
        ipcrm -$what $id
393
393
}
394
394
ipcrm_orauser() {
395
 
        typeset what id
 
395
        local what id
396
396
        for what in m s q; do
397
397
                for id in `ipcs -$what | filteroraipc`; do
398
398
                        rmipc $what $id
400
400
        done
401
401
}
402
402
ipcrm_instance() {
403
 
        typeset ipcobj
 
403
        local ipcobj
404
404
        for ipcobj; do
405
405
                rmipc `echo $ipcobj | sed 's/:/ /'`
406
406
        done
449
449
#
450
450
 
451
451
oracle_start() {
452
 
        typeset status output
 
452
        local status output
453
453
        if is_oracle_up; then
454
454
                status="`dbasql dbstat`"
455
455
                case "$status" in
512
512
# oracle_stop: Stop the Oracle instance
513
513
#
514
514
oracle_stop() {
515
 
        typeset status output ipc=""
 
515
        local status output ipc=""
516
516
        if is_oracle_up; then
517
517
                [ "$IPCRM" = "instance" ] && ipc=$(parseipc `dumpinstipc`)
518
518
                output=`dbasql dbstop`
535
535
# kill the database processes (if any left)
536
536
# give them 30 secs to exit cleanly (6 times 5)
537
537
killprocs() {
538
 
        typeset sig=$1
 
538
        local sig=$1
539
539
        shift 1
540
540
        kill -$sig $* >/dev/null 2>&1
541
541
}