Thinking Out Loud

May 20, 2013

RAC KISS on VirtualBox

Filed under: 11g,oracle,RAC — mdinh @ 4:52 am

Practice makes perfect, but it does not have to be difficult. Please don’t short yourself by not trying to understand what is going on.

This is my third RAC install and I got tired of doing it the hard manual way; hence, decided to script what I can.

ASM will still need to be configured after rackiss:

oracleasm configure -i
oracleasm init
oracleasm createdisk asm01 /dev/sdb1 ...
oracleasm scandisks
oracleasm listdisks

Tested Configuration: Linux rac01.localdomain 2.6.39-200.24.1.el6uek.x86_64 using V33411-01.iso on Virtual Box 4.2.12r84980

Modify script based on network configuration for the following:

/etc/resolv.conf
/etc/hosts
/etc/dnsentries.txt

CUSTOMIZE MINIMAL INSTALL

Base System
> Base
> Client Management Tools
Desktops
> Desktop
> Desktop Platform
> Graphical Administration Tools
> X Window System
Applications
> Internet Browser
740 packages
NTP not configured
KDUMP not enabled

Using GUI from VirtualBox Guest OS

Disaable Software Updates:
System > Preferences > System > Software Updates

Install Guest Additions
Devices > Install Guest Additions (ISO)

SCRIPT:  rackiss.sh

#/bin/sh
{
echo -e "\n******** Disable packagekit refresh ********"
sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/refresh-packagekit.conf
grep enabled /etc/yum/pluginconf.d/refresh-packagekit.conf

echo -e "\n******** Disable avahi-daemon 1501093.1 ********"
/etc/init.d/avahi-daemon stop
chkconfig avahi-daemon off
chkconfig avahi-daemon --list

echo -e "\n******** Silent Install oracle-rdbms-server-11gR2-preinstall ********"
yum install oracle-rdbms-server-11gR2-preinstall -q -y

echo -e "\n********* Silent Install dnsmaq, oracleasm, kernel *********"
yum install dnsmasq oracleasm-support oracleasmlib kernel-uek-devel-2.6.39-200.24.1.el6uek.x86_64 -q -y

echo -e "\n******** Download oracleasmlib ********"
wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm

echo -e "\n******** Install oracleasmlib ********"
yum localinstall oracleasmlib-2.0.4-1.el6.x86_64.rpm -y

echo -e "\n******** Verify yum install ********"
yum install oracle-rdbms-server-11gR2-preinstall -q -y
yum install dnsmasq oracleasm-support oracleasmlib kernel-uek-devel-2.6.39-200.24.1.el6uek.x86_64 -q -y
yum list install oracleasmlib-2.0.4-1.el6.x86_64

echo -e "\n******** Update rp_filter Note 1501093.1 ********"
sed -i 's/rp_filter = 1/rp_filter = 0/g' /etc/sysctl.conf
grep rp_filter  /etc/sysctl.conf

echo -e "\n******** Disable Firewall ********"
service iptables save
service iptables stop
chkconfig iptables off
chkconfig iptables --list

echo -e "\n******** AutoStart dnsmasq ********"
chkconfig dnsmasq on
chkconfig dnsmasq --list

echo -e "\n******** Update /etc/sysconfig/network ********"
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
cat /etc/sysconfig/network

echo -e "\n******** Update /etc/grub.conf ********"
sed -i 's/quiet/quiet divider=10/g' /etc/grub.conf
grep divider /etc/grub.conf

echo -e "\n******** Update /etc/pam.d/login ********"
echo "session    required     pam_limits.so" >> /etc/pam.d/login
grep pam_limits.so /etc/pam.d/login

echo -e "\n******** Disable SELINUX ********"
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config

echo -e "\n******** Rename /etc/ntp.conf"
mv /etc/ntp.conf /etc/ntp.conf.org
ls -l /etc/ntp.conf.org
chmod 0444 /etc/ntp.conf.org

echo -e "\n******** Rename /etc/dnsmasq.conf ********"
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.org
chmod 0444 /etc/dnsmasq.conf.org
ls -l /etc/dnsmasq.conf.org

echo -e "\n******** Configure /etc/hosts ********"
echo "192.168.56.11  rac01 rac01.localdomain" >> /etc/hosts
echo "192.168.56.12  rac02 rac02.localdomain" >> /etc/hosts
echo "192.168.56.13  rac03 rac03.localdomain" >> /etc/hosts
echo "192.168.56.21  rac01-vip rac01-vip.localdomain" >> /etc/hosts
echo "192.168.56.22  rac02-vip rac02-vip.localdomain" >> /etc/hosts
echo "192.168.56.23  rac03-vip rac03-vip.localdomain" >> /etc/hosts
echo "10.10.10.11    rac01-priv rac02-priv.localdomain" >> /etc/hosts
echo "10.10.10.12    rac02-priv rac02-priv.localdomain" >> /etc/hosts
echo "10.10.10.13    rac03-priv rac03-priv.localdomain" >> /etc/hosts
chmod 0444 /etc/hosts
cat /etc/hosts

echo -e "\n******** Configure /etc/dnsentries.txt for dnsmasq ********"
echo "192.168.56.11  rac01.localdomain"      > /etc/dnsentries.txt
echo "192.168.56.12  rac02.localdomain"     >> /etc/dnsentries.txt
echo "192.168.56.13  rac03.localdomain"     >> /etc/dnsentries.txt
echo "192.168.56.31  dinh-scan.localdomain" >> /etc/dnsentries.txt
echo "192.168.56.32  dinh-scan.localdomain" >> /etc/dnsentries.txt
echo "192.168.56.33  dinh-scan.localdomain" >> /etc/dnsentries.txt
chmod 0444 /etc/dnsentries.txt
cat /etc/dnsentries.txt

echo -e "\n******** Configure /etc/dnsmasq.conf for dnsmasq ********"
echo "listen-address=127.0.0.1"        > /etc/dnsmasq.conf
echo "strict-order"                   >> /etc/dnsmasq.conf
echo "domain-needed"                  >> /etc/dnsmasq.conf
echo "bogus-priv"                     >> /etc/dnsmasq.conf
echo "no-poll"                        >> /etc/dnsmasq.conf
echo "no-hosts"                       >> /etc/dnsmasq.conf
echo "local=/localdomain/"            >> /etc/dnsmasq.conf
echo "addn-hosts=/etc/dnsentries.txt" >> /etc/dnsmasq.conf
echo "cache-size=150"                 >> /etc/dnsmasq.conf
chmod 0444 /etc/dnsmasq.conf
cat /etc/dnsmasq.conf

echo -e "\n******** Configure /etc/resolv.conf for dnsmasq ********"
echo "nameserver 127.0.0.1"   > /etc/resolv.conf
echo "nameserver 172.16.0.1" >> /etc/resolv.conf
echo "nameserver 8.8.8.8"    >> /etc/resolv.conf
echo "search localdomain"    >> /etc/resolv.conf
chattr +i /etc/resolv.conf
cat /etc/resolv.conf

echo -e "\n******** Start dnsmasq ********"
service dnsmasq start

echo -e "\n******** Test nslookup ********"
nslookup rac01
nslookup rac02
nslookup rac03
nslookup dinh-scan
nslookup dinh-scan
nslookup dinh-scan
nslookup www.google.com

echo -e "\n******** Install Guest Additions ********"
/media/VBOXADDITIONS_4.2.12_84980/VBoxLinuxAdditions.run

echo -e "\n******** Add asmadmin asmdba ********"
groupadd -g 54325 asmadmin
groupadd -g 54326 asmdba

echo -e "\n******** Update Oracle's group ********"
usermod -g dba -G dba,asmadmin,asmdba,vboxsf oracle
id oracle

echo -e "\n******** Create directories ********"
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/11.2.0.3/grid
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/cfgtoollogs
mkdir -p /u01/app/oracle/product/11.2.0.3/dbhome_1
chown -R oracle:dba /u01
chmod -R 775 /u01
find /u01 -type d -ls
} > /tmp/rackiss.log 2>&1
echo -e "\n******** Check /tmp/rackiss.log for errors ********"
exit

Verify mount for VBOXADDITIONS exist

[root@rac01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg01-lv_root
                       28G  1.8G   25G   7% /
tmpfs                1004M  100K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/sr0               57M   57M     0 100% /media/VBOXADDITIONS_4.2.12_84980

Create and Run rackiss.sh

[root@rac01 ~]# vi rackiss.sh
[root@rac01 ~]# chmod 755 rackiss.sh
[root@rac01 ~]# time ./rackiss.sh

******** Check /tmp/rackiss.log for errors ********

real    33m43.730s
user    0m49.952s
sys     0m33.525s

Review Log

[root@rac01 ~]# cat /tmp/rackiss.log

******** Disable packagekit refresh ********
enabled=0

******** Disable avahi-daemon 1501093.1 ********
Shutting down Avahi daemon:                                [  OK  ]
avahi-daemon    0:off   1:off   2:off   3:off   4:off   5:off   6:off

******** Silent Install oracle-rdbms-server-11gR2-preinstall ********
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Importing GPG key 0xEC551F03:
 Userid: "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
 From  : http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6

********* Silent Install dnsmaq, oracleasm, kernel *********

******** Download oracleasmlib ********
--2013-05-19 20:35:49--  http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.4-1.el6.x86_64.rpm
Resolving download.oracle.com... 63.141.192.73, 63.141.192.10
Connecting to download.oracle.com|63.141.192.73|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13300 (13K) [application/x-redhat-package-manager]
Saving to: âoracleasmlib-2.0.4-1.el6.x86_64.rpmâ

2013-05-19 20:35:50 (234 KB/s) - âoracleasmlib-2.0.4-1.el6.x86_64.rpmâ

******** Install oracleasmlib ********
Loaded plugins: security
Setting up Local Package Process
Examining oracleasmlib-2.0.4-1.el6.x86_64.rpm: oracleasmlib-2.0.4-1.el6.x86_64
Marking oracleasmlib-2.0.4-1.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracleasmlib.x86_64 0:2.0.4-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch     Version       Repository                          Size
================================================================================
Installing:
 oracleasmlib   x86_64   2.0.4-1.el6   /oracleasmlib-2.0.4-1.el6.x86_64    27 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total size: 27 k
Installed size: 27 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : oracleasmlib-2.0.4-1.el6.x86_64                              1/1
  Verifying  : oracleasmlib-2.0.4-1.el6.x86_64                              1/1

Installed:
  oracleasmlib.x86_64 0:2.0.4-1.el6

Complete!

******** Verify yum install ********
Package oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64 already installed and latest version
Package dnsmasq-2.48-13.el6.x86_64 already installed and latest version
Package oracleasm-support-2.1.8-1.el6.x86_64 already installed and latest version
Package kernel-uek-devel-2.6.39-200.24.1.el6uek.x86_64 already installed and latest version
Loaded plugins: security
Installed Packages
oracleasmlib.x86_64        2.0.4-1.el6         @/oracleasmlib-2.0.4-1.el6.x86_64

******** Update rp_filter Note 1501093.1 ********
net.ipv4.conf.default.rp_filter = 0

******** Disable Firewall ********
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off

******** AutoStart dnsmasq ********
dnsmasq         0:off   1:off   2:on    3:on    4:on    5:on    6:off

******** Update /etc/sysconfig/network ********
NETWORKING=yes
HOSTNAME=rac01.localdomain
NOZEROCONF=yes

******** Update /etc/grub.conf ********
        kernel /vmlinuz-2.6.39-200.24.1.el6uek.x86_64 ro root=/dev/mapper/vg01-lv_root rd_LVM_LV=vg01/lv_swap rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg01/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet divider=10 numa=off
        kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/mapper/vg01-lv_root rd_LVM_LV=vg01/lv_swap rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg01/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet divider=10 numa=off

******** Update /etc/pam.d/login ********
session    required     pam_limits.so

******** Disable SELINUX ********
SELINUX=disabled

******** Rename /etc/ntp.conf
-rw-r--r--. 1 root root 1917 Jul  6  2010 /etc/ntp.conf.org

******** Rename /etc/dnsmasq.conf ********
-r--r--r--. 1 root root 21214 May 19 20:35 /etc/dnsmasq.conf.org

******** Configure /etc/hosts ********
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.11  rac01 rac01.localdomain
192.168.56.12  rac02 rac02.localdomain
192.168.56.13  rac03 rac03.localdomain
192.168.56.21  rac01-vip rac01-vip.localdomain
192.168.56.22  rac02-vip rac02-vip.localdomain
192.168.56.23  rac03-vip rac03-vip.localdomain
10.10.10.11    rac01-priv rac02-priv.localdomain
10.10.10.12    rac02-priv rac02-priv.localdomain
10.10.10.13    rac03-priv rac03-priv.localdomain

******** Configure /etc/dnsentries.txt for dnsmasq ********
192.168.56.11  rac01.localdomain
192.168.56.12  rac02.localdomain
192.168.56.13  rac03.localdomain
192.168.56.31  dinh-scan.localdomain
192.168.56.32  dinh-scan.localdomain
192.168.56.33  dinh-scan.localdomain

******** Configure /etc/dnsmasq.conf for dnsmasq ********
listen-address=127.0.0.1
strict-order
domain-needed
bogus-priv
no-poll
no-hosts
local=/localdomain/
addn-hosts=/etc/dnsentries.txt
cache-size=150

******** Configure /etc/resolv.conf for dnsmasq ********
nameserver 127.0.0.1
nameserver 172.16.0.1
nameserver 8.8.8.8
search localdomain

******** Start dnsmasq ********
Starting dnsmasq:                                          [  OK  ]

******** Test nslookup ********
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   rac01.localdomain
Address: 192.168.56.11

Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   rac02.localdomain
Address: 192.168.56.12

Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   rac03.localdomain
Address: 192.168.56.13

Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   dinh-scan.localdomain
Address: 192.168.56.33
Name:   dinh-scan.localdomain
Address: 192.168.56.31
Name:   dinh-scan.localdomain
Address: 192.168.56.32

Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   dinh-scan.localdomain
Address: 192.168.56.31
Name:   dinh-scan.localdomain
Address: 192.168.56.32
Name:   dinh-scan.localdomain
Address: 192.168.56.33

Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   dinh-scan.localdomain
Address: 192.168.56.32
Name:   dinh-scan.localdomain
Address: 192.168.56.33
Name:   dinh-scan.localdomain
Address: 192.168.56.31

Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
Name:   www.google.com
Address: 74.125.224.177
Name:   www.google.com
Address: 74.125.224.178
Name:   www.google.com
Address: 74.125.224.179
Name:   www.google.com
Address: 74.125.224.180
Name:   www.google.com
Address: 74.125.224.176

******** Install Guest Additions ********
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.12 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-uek-devel-2.6.39-200.24.1.el6uek.x86_64

Building the main Guest Additions module                   [  OK  ]
Building the shared folder support module                  [  OK  ]
Building the OpenGL support module                         [  OK  ]
Doing non-kernel setup of the Guest Additions              [  OK  ]
Starting the VirtualBox Guest Additions                    [  OK  ]
Installing the Window System drivers
Installing X.Org Server 1.10 modules                       [  OK  ]
Setting up the Window System to use the Guest Additions    [  OK  ]
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services componen[  OK  ]

******** Add asmadmin asmdba ********

******** Update Oracle's group ********
uid=54321(oracle) gid=54322(dba) groups=54322(dba),54323(vboxsf),54325(asmadmin),54326(asmdba)

******** Create directories ********
654346    4 drwxrwxr-x   3 oracle   dba          4096 May 19 21:06 /u01
654347    4 drwxrwxr-x   5 oracle   dba          4096 May 19 21:06 /u01/app
654349    4 drwxrwxr-x   3 oracle   dba          4096 May 19 21:06 /u01/app/11.2.0.3
654350    4 drwxrwxr-x   2 oracle   dba          4096 May 19 21:06 /u01/app/11.2.0.3/grid
654351    4 drwxrwxr-x   4 oracle   dba          4096 May 19 21:06 /u01/app/oracle
654352    4 drwxrwxr-x   2 oracle   dba          4096 May 19 21:06 /u01/app/oracle/cfgtoollogs
654353    4 drwxrwxr-x   3 oracle   dba          4096 May 19 21:06 /u01/app/oracle/product
654354    4 drwxrwxr-x   3 oracle   dba          4096 May 19 21:06 /u01/app/oracle/product/11.2.0.3
654355    4 drwxrwxr-x   2 oracle   dba          4096 May 19 21:06 /u01/app/oracle/product/11.2.0.3/dbhome_1
654348    4 drwxrwxr-x   2 oracle   dba          4096 May 19 21:06 /u01/app/oraInventory
[root@rac01 ~]#

May 19, 2013

Connecting to RAC DB with SQL*Plus

Filed under: 11g,oracle,RAC — mdinh @ 2:05 am

Download

Instant Client Package – Basic Lite
Instant Client Package – SQL*Plus
http://www.oracle.com/technetwork/topics/winsoft-085727.html

Modify hosts file

C:\Windows\System32\drivers\etc>more hosts
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost
192.168.56.31  dinh-scan1
192.168.56.32  dinh-scan2
192.168.56.33  dinh-scan3
192.168.56.21  rac01-vip
192.168.56.22  rac02-vip
192.168.56.23  rac03-vip

Modify tnsnames

D:\instantclient_11_2>more tnsnames.ora
jay =
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = dinh-scan1)(PORT = 1551))
  (ADDRESS = (PROTOCOL = TCP)(HOST = dinh-scan2)(PORT = 1551))
  (ADDRESS = (PROTOCOL = TCP)(HOST = dinh-scan3)(PORT = 1551))
   (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = jay)
   )
)

jay1 =
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = rac01-vip)(PORT = 1521))
   (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = jay)
   )
)

jay2 =
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = rac02-vip)(PORT = 1521))
   (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = jay)
   )
)

jay3 =
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = rac03-vip)(PORT = 1521))
   (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = jay)
   )
)

Modify login.sql

D:\instantclient_11_2>more login.sql
--
-- Copyright (c) 1988, 2011, Oracle and/or its affiliates.
-- All rights reserved.
--
-- NAME
--   glogin.sql
--
-- DESCRIPTION
--   SQL*Plus global login "site profile" file
--
--   Add any SQL*Plus commands here that are to be executed when a
--   user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE
--   This script is automatically run
--
set termout off
define _pr="SQL> "
column pr new_value _pr
select UPPER(SYS_CONTEXT('USERENV','SERVER_HOST'))||':(&_USER@&_CONNECT_IDENTIFIER):'||SYS_CONTEXT('USERENV','DATABASE_ROLE')||'> '
pr from dual;
set sqlprompt "&_pr"
column pr clear
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
define _editor=D:\PortableApps\npp.6.3.2.bin.minimalist\notepad++
set editfile E:\TMP
set termout on

Modify environment variables

D:\instantclient_11_2>set TNS_ADMIN
TNS_ADMIN=D:\instantclient_11_2

D:\instantclient_11_2>set SQLPATH
SQLPATH=D:\instantclient_11_2

D:\instantclient_11_2>set PATH
Path=D:\Program Files\Oracle\VirtualBox;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\sys
tem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Eng
ine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management
 Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SD
K\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;D:\instantclient_11_2
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

D:\>sqlplus sys@\”dinh-scan1:1551/jay\” as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat May 18 18:32:31 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

RAC01:(SYS@dinh-scan1:1551/jay):PRIMARY> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

D:\>sqlplus sys@jay2 as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat May 18 18:32:43 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

RAC02:(SYS@jay2):PRIMARY> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

D:\>sqlplus sys@\”dinh-scan1:1551/jay\” as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat May 18 18:32:50 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

RAC03:(SYS@dinh-scan1:1551/jay):PRIMARY> exit

May 18, 2013

Where’s my RAC dbconsole

Filed under: 11g,Grid Control,RAC — mdinh @ 11:33 pm

[oracle@rac01 ~]$ tail /etc/oratab

# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed 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.
#
#
+ASM1:/u01/app/11.2.0.3/grid:N          # line added by Agent
jay:/u01/app/oracle/product/11.2.0.3/dbhome_1:N         # line added by Agent
[oracle@rac01 ~]$ . oraenv
ORACLE_SID = [oracle] ? jay
The Oracle base has been set to /u01/app/oracle
[oracle@rac01 ~]$ emctl stsatus dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
[oracle@rac01 ~]$ export ORACLE_UNQNAME=jay
[oracle@rac01 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
https://rac01:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.3/dbhome_1/rac01_jay/sysman/log
[oracle@rac01 ~]$ nslookup rac01
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   rac01.localdomain
Address: 192.168.56.11

[oracle@rac01 ~]$

https://192.168.56.11:1158/em <--

May 7, 2013

Live, Learn and Share

Filed under: linux — mdinh @ 3:28 am

Live, Learn and Share is the signature from a friend that I used to work with – Chau Vu

Today, I learned something new because I was shared something by a colleague – Jing Han

If you know part of filename for what you are looking for but don’t know where it resides, then you can use locate to find it.

$ uname -an
Linux lax.localdomain 2.6.39-200.24.1.el6uek.x86_64 #1 SMP Sat Jun 23 02:39:07 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
[oracle@lax:db01]/home/oracle
$ ll /u01/app/oracle/diag/rdbms/lax_db01/db01/trace/alert_db01.log
-rw-r----- 1 oracle oinstall 29046 May 6 20:14 /u01/app/oracle/diag/rdbms/lax_db01/db01/trace/alert_db01.log

[oracle@lax:db01]/home/oracle
 $ locate alert_db01.log
 /u01/app/oracle/diag/rdbms/lax_db01/db01/trace/alert_db01.log

[oracle@lax:db01]/home/oracle
 $ locate alert
 /home/oracle/rda/modules/DBalert.def
 /home/oracle/rda/modules/TSTalert.cfg
 /home/oracle/rda/modules/TSTalert.def
 /u01/app/oracle/diag/rdbms/lax_db01/db01/alert
 /u01/app/oracle/diag/rdbms/lax_db01/db01/alert/log.xml
 /u01/app/oracle/diag/rdbms/lax_db01/db01/trace/alert_db01.log
 /u01/app/oracle/product/11.2.0.3/db_1/apex/images/alert.gif
 /u01/app/oracle/product/11.2.0.3/db_1/apex/images/alert_error.gif
 /u01/app/oracle/product/11.2.0.3/db_1/apex/images/alert_info.gif
 /u01/app/oracle/product/11.2.0.3/db_1/apex/images/alert_warning.gif
 /u01/app/oracle/product/11.2.0.3/db_1/apex/images/htmldb/icons/alert_warning.gif
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/ecm/patch/cpf/remedies_alerts.jspf
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/ecm/patch/cpf/lov/alertLov.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/ip/render/elem/alertsParam.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/ip/render/elem/webapps/summary/alertParam.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/monitoring/alertAcknowledgeConfirm.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/monitoring/alertClearConfirm.uix
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/monitoring/alertDetails.uix
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/monitoring/em2go/alertDetails.uix
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert/alert_help.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert/alert_help_ja.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_de.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_es.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_fr.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_it.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_ja.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_ko.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_pt_BR.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_zh_CN.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/online_help/alert_cs/alert_cs_help_zh_TW.jar
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/sdk/alertsInclude.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/sdk/em2go/alertsInclude.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/sdk/em2go/webappalertsInclude.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/sdk/em2go/webapprelatedalertsInclude.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/j2ee/OC4J_EM/applications/em/em/target/groups/alerts.jsp
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/database/instance/alertlog
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/database/instance/alertlog/archivepurge
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/database/instance/alertlog/archivepurge/netUtil.js
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/database/monitoring/alertLogContent.uix
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/database/monitoring/alertLogEntries.uix
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/monitoring/alertClearConfirm.uix
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/monitoring/alertDetails.uix
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert/alert_help.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert/alert_help_ja.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_de.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_es.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_fr.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_it.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_ja.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_ko.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_pt_BR.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_zh_CN.jar
 /u01/app/oracle/product/11.2.0.3/db_1/oc4j/j2ee/oc4j_applications/applications/em/em/online_help/alert_cs/alert_cs_help_zh_TW.jar
 /u01/app/oracle/product/11.2.0.3/db_1/owb/wf/demo/wfalertb.sql
 /u01/app/oracle/product/11.2.0.3/db_1/owb/wf/demo/wfalertd.sql
 /u01/app/oracle/product/11.2.0.3/db_1/owb/wf/demo/wfalerts.sql
 /u01/app/oracle/product/11.2.0.3/db_1/owb/wf/java/oracle/apps/fnd/wf/icons/alert.gif
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/emdrep/sql/core/10.2.0.4/severity/alert_schema_upgrade.sql
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/alertlog.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/alertlogAdr.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/alertlogAdrViewer.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/alertlogAdr_util.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/alertlogViewer.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/alertlog_find.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/alertlog_util.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/archivealertlog.pl
 /u01/app/oracle/product/11.2.0.3/db_1/sysman/admin/scripts/purgealertlog.pl
 /usr/share/icons/gnome/16x16/status/weather-severe-alert.png
 /usr/share/icons/gnome/22x22/status/weather-severe-alert.png
 /usr/share/icons/gnome/24x24/status/weather-severe-alert.png
 /usr/share/icons/gnome/32x32/status/weather-severe-alert.png
 /usr/share/icons/gnome/scalable/status/weather-severe-alert.svg
 /usr/share/sounds/gnome/default/alerts
 /usr/share/sounds/gnome/default/alerts/bark.ogg
 /usr/share/sounds/gnome/default/alerts/drip.ogg
 /usr/share/sounds/gnome/default/alerts/glass.ogg
 /usr/share/sounds/gnome/default/alerts/sonar.ogg
 [oracle@lax:db01]/home/oracle
 $

Go Live, Learn and Share

May 4, 2013

It’s a dirty job

Filed under: oracle — mdinh @ 9:50 pm

Before, I worked for organization that frowned upon database jobs and only uses cron job.
Now, it’s just the opposite and I get to learn about dbms_scheduler job.

Create job to run PLSQL_BLOCK every 5 minutes at: 21,22,23 (24 hour format)

LAX:(MDINH@db01)> @createjob

SYSDATE
-------------------
2013-05-04 12:29:55

LAX:(MDINH@db01)> begin
  2   dbms_scheduler.create_job (
  3    job_name => 'DIRTY_JOB',
  4    job_type => 'PLSQL_BLOCK',
  5    job_action => 'BEGIN NULL; END;',
  6    start_date => trunc(sysdate)+21/24,
  7    repeat_interval => 'FREQ=minutely; BYHOUR=21,22,23; INTERVAL=5',
  8    end_date => NULL,
  9    enabled => TRUE);
 10  end;
 11  /

PL/SQL procedure successfully completed.

LAX:(MDINH@db01)> @@checkjob dirty
LAX:(MDINH@db01)> set lines 200 veri off echo off
-- dba_scheduler_jobs

JOB_NAME                       REPEAT_INTERVAL                                              NEXT_RUN_DATE
------------------------------ ------------------------------------------------------------ ----------------------------------------
DIRTY_JOB                      FREQ=minutely; BYHOUR=21,22,23; INTERVAL=5                   04-MAY-13 09.00.00.000000 PM -07:00

-- dba_scheduler_job_run_details

no rows selected

-- FORCE RUN_JOB
LAX:(MDINH@db01)> exec dbms_scheduler.RUN_JOB('DIRTY_JOB');

PL/SQL procedure successfully completed.

LAX:(MDINH@db01)> @@checkjob dirty
LAX:(MDINH@db01)> set lines 200 veri off echo off
-- dba_scheduler_jobs

JOB_NAME                       REPEAT_INTERVAL                                              NEXT_RUN_DATE
------------------------------ ------------------------------------------------------------ ----------------------------------------
DIRTY_JOB                      FREQ=minutely; BYHOUR=21,22,23; INTERVAL=5                   04-MAY-13 09.00.00.000000 PM -07:00

-- dba_scheduler_job_run_details

LOG_DATE                            JOB_NAME                       STATUS     ACTUAL_START_DATE                   RUN_DURATION
----------------------------------- ------------------------------ ---------- ----------------------------------- ---------------
04-MAY-13 12.29.55.112836 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.29.55.111618 PM -07:00 +000 00:00:00

!!! Shoot – do not want to wail until 21:00 to know results !!!
— CHANGE START_DATE & REPEAT_INTERVAL

LAX:(MDINH@db01)> exec dbms_scheduler.SET_ATTRIBUTE(name=>'DIRTY_JOB',attribute=>'start_date',value=>SYSDATE);

PL/SQL procedure successfully completed.

LAX:(MDINH@db01)> exec dbms_scheduler.SET_ATTRIBUTE(name=>'DIRTY_JOB',attribute=>'repeat_interval',value=>'FREQ=minutely;BYHOUR=12,13;INTERVAL=5');

PL/SQL procedure successfully completed.

LAX:(MDINH@db01)> @@checkjob dirty
LAX:(MDINH@db01)> set lines 200 veri off echo off
-- dba_scheduler_jobs

JOB_NAME                       REPEAT_INTERVAL                                              NEXT_RUN_DATE
------------------------------ ------------------------------------------------------------ ----------------------------------------
DIRTY_JOB                      FREQ=minutely;BYHOUR=12,13;INTERVAL=5                        04-MAY-13 12.34.55.000000 PM -07:00

-- dba_scheduler_job_run_details

LOG_DATE                            JOB_NAME                       STATUS     ACTUAL_START_DATE                   RUN_DURATION
----------------------------------- ------------------------------ ---------- ----------------------------------- ---------------
04-MAY-13 12.29.55.112836 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.29.55.111618 PM -07:00 +000 00:00:00

Back from lunch and looks good.

Job did not run after 14:00 as expected.

LAX:(MDINH@db01)> select sysdate from dual;
-------------------
2013-05-04 14:10:43

LAX:(MDINH@db01)> @checkjob dirty
-- dba_scheduler_jobs

JOB_NAME                       REPEAT_INTERVAL                                              NEXT_RUN_DATE
------------------------------ ------------------------------------------------------------ ----------------------------------------
DIRTY_JOB                      FREQ=minutely;BYHOUR=12,13;INTERVAL=5                        05-MAY-13 12.04.55.000000 PM -07:00

-- dba_scheduler_job_run_details

LOG_DATE                            JOB_NAME                       STATUS     ACTUAL_START_DATE                   RUN_DURATION
----------------------------------- ------------------------------ ---------- ----------------------------------- ---------------
04-MAY-13 12.29.55.112836 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.29.55.111618 PM -07:00 +000 00:00:00
04-MAY-13 12.34.55.045811 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.34.55.038072 PM -07:00 +000 00:00:00
04-MAY-13 12.39.55.050034 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.39.55.040566 PM -07:00 +000 00:00:00
04-MAY-13 12.44.55.079379 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.44.55.057040 PM -07:00 +000 00:00:00
04-MAY-13 12.49.55.132232 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.49.55.124111 PM -07:00 +000 00:00:00
04-MAY-13 12.54.55.238525 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.54.55.230027 PM -07:00 +000 00:00:00
04-MAY-13 12.59.55.046174 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.59.55.037725 PM -07:00 +000 00:00:00
04-MAY-13 01.04.55.057574 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.04.55.049089 PM -07:00 +000 00:00:00
04-MAY-13 01.09.55.043001 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.09.55.038407 PM -07:00 +000 00:00:00
04-MAY-13 01.14.55.058771 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.14.55.053925 PM -07:00 +000 00:00:00
04-MAY-13 01.19.55.048791 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.19.55.039703 PM -07:00 +000 00:00:00
04-MAY-13 01.24.55.038104 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.24.55.029655 PM -07:00 +000 00:00:00
04-MAY-13 01.29.55.046963 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.29.55.041092 PM -07:00 +000 00:00:00
04-MAY-13 01.34.55.063285 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.34.55.055247 PM -07:00 +000 00:00:00
04-MAY-13 01.39.55.050528 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.39.55.041886 PM -07:00 +000 00:00:00
04-MAY-13 01.44.55.042718 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.44.55.023271 PM -07:00 +000 00:00:00
04-MAY-13 01.49.55.056224 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.49.55.051302 PM -07:00 +000 00:00:00
04-MAY-13 01.54.55.046269 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.54.55.037763 PM -07:00 +000 00:00:00
04-MAY-13 01.59.55.059423 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.59.55.051539 PM -07:00 +000 00:00:00

19 rows selected.

LAX:(MDINH@db01)> @dropjob

LAX:(MDINH@db01)> exec dbms_scheduler.DISABLE ('DIRTY_JOB',TRUE);

PL/SQL procedure successfully completed.

LAX:(MDINH@db01)> exec dbms_scheduler.STOP_JOB('DIRTY_JOB',TRUE);
BEGIN dbms_scheduler.STOP_JOB('DIRTY_JOB',TRUE); END;

*
ERROR at line 1:
ORA-27366: job "MDINH.DIRTY_JOB" is not running
ORA-06512: at "SYS.DBMS_ISCHED", line 199
ORA-06512: at "SYS.DBMS_SCHEDULER", line 557
ORA-06512: at line 1

LAX:(MDINH@db01)> exec dbms_scheduler.DROP_JOB('DIRTY_JOB',TRUE);

PL/SQL procedure successfully completed.

LAX:(MDINH@db01)> @@checkjob dirty
LAX:(MDINH@db01)> set lines 200 veri off echo off
-- dba_scheduler_jobs

no rows selected

-- dba_scheduler_job_run_details

LOG_DATE                            JOB_NAME                       STATUS     ACTUAL_START_DATE                   RUN_DURATION
----------------------------------- ------------------------------ ---------- ----------------------------------- ---------------
04-MAY-13 12.29.55.112836 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.29.55.111618 PM -07:00 +000 00:00:00
04-MAY-13 12.34.55.045811 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.34.55.038072 PM -07:00 +000 00:00:00
04-MAY-13 12.39.55.050034 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.39.55.040566 PM -07:00 +000 00:00:00
04-MAY-13 12.44.55.079379 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.44.55.057040 PM -07:00 +000 00:00:00
04-MAY-13 12.49.55.132232 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.49.55.124111 PM -07:00 +000 00:00:00
04-MAY-13 12.54.55.238525 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.54.55.230027 PM -07:00 +000 00:00:00
04-MAY-13 12.59.55.046174 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 12.59.55.037725 PM -07:00 +000 00:00:00
04-MAY-13 01.04.55.057574 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.04.55.049089 PM -07:00 +000 00:00:00
04-MAY-13 01.09.55.043001 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.09.55.038407 PM -07:00 +000 00:00:00
04-MAY-13 01.14.55.058771 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.14.55.053925 PM -07:00 +000 00:00:00
04-MAY-13 01.19.55.048791 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.19.55.039703 PM -07:00 +000 00:00:00
04-MAY-13 01.24.55.038104 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.24.55.029655 PM -07:00 +000 00:00:00
04-MAY-13 01.29.55.046963 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.29.55.041092 PM -07:00 +000 00:00:00
04-MAY-13 01.34.55.063285 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.34.55.055247 PM -07:00 +000 00:00:00
04-MAY-13 01.39.55.050528 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.39.55.041886 PM -07:00 +000 00:00:00
04-MAY-13 01.44.55.042718 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.44.55.023271 PM -07:00 +000 00:00:00
04-MAY-13 01.49.55.056224 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.49.55.051302 PM -07:00 +000 00:00:00
04-MAY-13 01.54.55.046269 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.54.55.037763 PM -07:00 +000 00:00:00
04-MAY-13 01.59.55.059423 PM -07:00 DIRTY_JOB                      SUCCEEDED  04-MAY-13 01.59.55.051539 PM -07:00 +000 00:00:00

19 rows selected.

LAX:(MDINH@db01)> exec dbms_scheduler.PURGE_LOG();

PL/SQL procedure successfully completed.

LAX:(MDINH@db01)> @checkjob dirty
-- dba_scheduler_jobs

no rows selected

-- dba_scheduler_job_run_details

no rows selected

LAX:(MDINH@db01)>

 

SCRIPTS Used:

$ cat checkjob.sql

set lines 200 veri off echo off
set pages 1000
col JOB_NAME for a30
col NEXT_RUN_DATE for a40
col REPEAT_INTERVAL for a60
col ACTUAL_START_DATE for a35
col LOG_DATE for a35
col RUN_DURATION for a15
col STATUS for a10
pro -- dba_scheduler_jobs
select job_name,repeat_interval,next_run_date from dba_scheduler_jobs where regexp_like(job_name,'&1','i');
pro -- dba_scheduler_job_run_details
select log_date,job_name,status,actual_start_date,run_duration
from dba_scheduler_job_run_details
where regexp_like(job_name,'&1','i')
order by actual_start_date asc;

$ cat createjob.sql

select sysdate from dual;
set echo on
begin
 dbms_scheduler.create_job (
  job_name => 'DIRTY_JOB',
  job_type => 'PLSQL_BLOCK',
  job_action => 'BEGIN NULL; END;',
  start_date => trunc(sysdate)+21/24,
  repeat_interval => 'FREQ=minutely; BYHOUR=21,22,23; INTERVAL=5',
  end_date => NULL,
  enabled => TRUE);
end;
/
@@checkjob dirty
pro -- FORCE RUN_JOB
set echo on
exec dbms_scheduler.RUN_JOB('DIRTY_JOB');
@@checkjob dirty
pro !!! Shoot - do not want to wail until 21:00 to know results !!!
pro -- CHANGE START_DATE REPEAT_INTERVAL
set echo on
exec dbms_scheduler.SET_ATTRIBUTE(name=>'DIRTY_JOB',attribute=>'start_date',value=>SYSDATE);
exec dbms_scheduler.SET_ATTRIBUTE(name=>'DIRTY_JOB',attribute=>'repeat_interval',value=>'FREQ=minutely;BYHOUR=12,13;INTERVAL=5');
@@checkjob dirty

$ cat dropjob.sql

set echo on
exec dbms_scheduler.DISABLE ('DIRTY_JOB',TRUE);
exec dbms_scheduler.STOP_JOB('DIRTY_JOB',TRUE);
exec dbms_scheduler.DROP_JOB('DIRTY_JOB',TRUE);
@@checkjob dirty

exec dbms_scheduler.PURGE_LOG();

What kind of jobs are you doing or using?

Create a free website or blog at WordPress.com.