Hurriyet

31 Mart 2014 Pazartesi

Oracle Veritabanı: Regular Expressions - Düzenli İfadeler

Regular Expression'lar Nedir?

Regular expression'lar  string ifadeler içerisinde aramak oluşturulan şablonlardır. Bu şekilde kompleks şablonlar oluşturulabilinir.

Örnek:

 select * from apps.fnd_user where regexp_like(user_name,'B');

İçinde B harfi bulunan kullanıcıları görmek için regexp_like fonksiyonunda user_name sütununda B harfini aratabiliriz.

select * from apps.fnd_user where regexp_like(user_name,'B(E|C)');

İçerisinde B harfi olup da bu B harfini E veya C ile takip eden kullanıcıları görmek için 'B(E|C)'  ifadesini kullanırız. Böylece ismi içerisinde BE veya BC olan kullanıcıları görebiliriz.

Veritabanındaki Regexp SQL Fonksiyonları:

Regexp_like: Bir tablonun kolonunda bir karakter dizisi aramak için where ifadesinden sonra kullanılır. Yukarıdaki örnekteki gibi regexp içerisinde şartlar sıralandıktan sonra kullanılır.

Syntax:http://docs.oracle.com/cd/B12037_01/server.101/b10759/conditions018.htm#SQLRF00501

Regexp_replace: Regexp_like gibi çalışan ama karşılaştığı her ifadeyi fonksiyon içerisinde belirtilen başka bir ifadeyle değiştirir.

Syntax:http://docs.oracle.com/cd/B12037_01/server.101/b10759/functions115.htm#SQLRF06302

Regexp_instr:  Aranacak karakter şablonunun nereden itibaren aranmaya başlanacağını gösterir.

Syntax:http://docs.oracle.com/cd/B12037_01/server.101/b10759/functions114.htm#SQLRF06300

Regexp_substr: Substr fonksiyonuyla karşılaşılan kelime dizilerini sütunların içindeki verilerden çıkarabiliriz.

Syntax:http://docs.oracle.com/cd/B12037_01/server.101/b10759/functions116.htm#SQLRF06303

Regular Expression Oluşturan Karakter Şablonları:


Syntax Operatör İsmi Tanımı:
. Nokta Herhangi bir karakter
+ Artı öncesinde gelen ifadeden bir veya birden fazla karşılaşılması
? Soru işareti Sıfır ya da bir kere öncesinde gelen ifadeyle karşılaşılması
* Yıldız Sıfır ya da birden fazla  öncesindeki ifadeyle karşılaşılması
{m} Aralık öncesinde gelen ifadeden m tane karşılaşılması durumu
{m,} Aralık öncesinde gelen ifadeden en az m tanesi ile karşılaşılması durumu
{m,n} Aralık öncesinde gelen ifadeden en az m en fazla n tanesi ile karşılaşılması durumu
[...] Köşeli parantez Parantezler içerisindeki kısımları eşler.
[^...] Köşeli parantez Parantezler içerisindekilerin dışındakileri eşler

Örnekler:

[a.z]: içinde a'dan z'ye kadar olaran bütün karakterler eşlenir.

[^0-9] :içinde sayı olmayanların örneği

Regular Expression'lar Oluşturmak:
Dizilerimizi oluşturmak için ihtiyaçlarımıza göre ifadelerimizi oluştururuz. Örneğin arayacağımız sütunda "abc" dizilerini bulmak istiyorsak "abc"  şeklinde arama yapabiliriz.

Nokta Karakteri:

Nokta karakteri arama dizisi içerisindeki herhangi bir  karakteri ifade eder. Yani  "a.c" ile ifade edilen bir dizi ile "aac","abc","acc" vb bütün diziler aranır. Kısaca a ile başlayıp c ile biten bütün diziler aranır.

+ Karakteri:

+ ile öncesinde gelen ifadeden bir veya birden fazla defa karşılaşılması durumunda o değeri geri döndürür. Örnek olarak "a+" şeklinde arama yaparsak içinde "a","aa","aaa",... gibi bütün örnekleri eşler.


? Karakteri:

? ile bir karakterin hiç olmadığı ya da bir kere karşılaşıldığı durumları ararız.
Örneğin "ab?c"  şeklinde arama yaptığımız aranacak olanlar kelime dizileri "ac" veya "abc"'dir.

* Karakteri:

* bize öncesinde gelen karakterin 0 ya da daha fazla karşılaşılma durumunu gösterir.


Referanslar:

http://psoug.org/reference/regexp.html
http://docs.oracle.com/cd/B12037_01/appdev.101/b10795/adfns_re.htm
http://turkceoracle.com/2011/03/oracle%E2%80%99da-duzenli-ifadeler-regular-expressions.html

28 Mart 2014 Cuma

Oracle E-Business Suite: Concurrent Request'in Bağlı Olduğu Sorumluluklar ve Request Group'lar

Concurrent Request'in Bağlı Olduğu Sorumluluklar ve Request Group'lar:

 SELECT fcp.concurrent_program_name "Prog Short Name",  
     fcpt.user_concurrent_program_name "Program Name",  
     fcpt.description "Program desc",  
     frg.request_group_name "Request Group",  
     frg.description "Request group desc",  
     frt.responsibility_name "Responsibility Name",  
     frt.description "Responsibility desc"  
  FROM fnd_responsibility fr,  
     fnd_responsibility_tl frt,  
     fnd_request_groups frg,  
     fnd_request_group_units frgu,  
     fnd_concurrent_programs_tl fcpt,  
     fnd_concurrent_programs fcp  
  WHERE frt.responsibility_id = fr.responsibility_id  
   AND fr.request_group_id = frg.request_group_id  
   AND frg.request_group_id = frgu.request_group_id  
   AND frgu.request_unit_id = fcpt.concurrent_program_id  
   AND fcpt.concurrent_program_id = fcp.concurrent_program_id  
   AND frgu.request_unit_type = 'P'  
   AND fcpt.LANGUAGE = frt.LANGUAGE  
   AND frt.LANGUAGE = 'US'  
   AND fcpt.user_concurrent_program_name = 'Active Users'  



Oracle Veritabanı: Storage Clauses - Depolama Seçenekleri

Veritabanı Yönetimi:

Veritabanının başlangıcından itibaren yaratılan nesnelerde nasıl depolama yapılacağının seçenekleri belirtilir. Bunu yarattığımız tablolarda, index'lerde, tablespace'lerde uygulayabiliriz. Ertesinde de, create ve alter komutlarıyla değişiklikler uygulanabilinir.

Storage İfadesi:

Storage ifadesinde değerlerin nasıl ve hangi değerlerle tutulacağını belirtiriz. Storage altında belirli parametreler vardır. Bu parametreleri aşağıdaki örnekte inceleyeceğiz.

 CREATE TABLE APPS.AMS_ACT_METRICS_MONTHLY_MV  
 (  
  TIME_ID    NUMBER             NOT NULL,  
  START_DATE  DATE,  
  END_DATE   DATE,  
  OBJECT_TYPE  VARCHAR2(30 BYTE),  
  OBJECT_ID   NUMBER,  
  METRIC_VALUE NUMBER,  
  METRIC_ID   NUMBER             NOT NULL  
 )  
 TABLESPACE APPS_TS_SUMMARY  
 RESULT_CACHE (MODE DEFAULT)  
 PCTUSED  0  
 PCTFREE  10  
 INITRANS  10  
 MAXTRANS  255  
 STORAGE  (  
       INITIAL     16K  
       NEXT       128K  
       MINEXTENTS    1  
       MAXEXTENTS    UNLIMITED  
       PCTINCREASE   0  
       BUFFER_POOL   DEFAULT  
       FLASH_CACHE   DEFAULT  
       CELL_FLASH_CACHE DEFAULT  
       )  
 LOGGING   
 NOCOMPRESS   
 NOCACHE  
 PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT )  
 MONITORING; 

Parametreler sırasıyla:

Initial: Yaratılacak nesnenin ilk  extent'inin ne kadar büyüklükte olacağını gösterir. Default değeri 5 Oracle block'udur. 8kb'lık blocksize'ı olan bir veritabanı için 40kb normal değerdir.

Next: Nesnenin initial block'tan sonraki ilk extent'inin boyutunu belirler. Bunun da default değeri 5  block'tur.
Bu değerin kullanılması için PCTINCREASE adlı parametre 0 olmalıdır. Eğer bu parametre 0'dan büyükse initial'dan sonraki extent Next ile belirlenen extent olur. Next ile belirlenen extent'den sonraki extent yani 3.extent Next ile belirlenen boyutun PCTINCREASE ile çarpılıp  Next ile toplanmış halidir. Yani PCTINCREASE 10 olsaydı 3. extent 128kb +(128*10)kb boyutunda olacaktı.

Minextents: Yaratılacak nesne için initial extent sayısını belirler.

Maxextents: Nesnenin sahip olabilieceği maksimum sayıdaki extent'i belirler. Unlimited olarak belirlenmesi tavsiye edilir.

Pctincrease: İnitial extent'den sonraki artış miktarını belirler.

Pctfree: Bir database bloğunda ileride gelebilecek update'ler için ne kadar boşluk bırakılması gerektiğini gösteren parametredir. Bu parametre sayesinde bir block belirtilen değere kadar doldurulur sonra da pctfree oranına göre yeni gelen datalar eklenmez. Ancak bu sütunlara yapılacak yeni değişiklikler(update'ler) bu alana yansıtılır.

select pct_free from dba_tables; sorgusuyla istenen tablonun alanı görülebilinir.


Referanslar:

http://docs.oracle.com/cd/B19306_01/server.102/b14200/clauses009.htm


Oracle E-Business Suite: Bir Kullanıcının Sahip Olduğu Request Set'ler - Var Olan Bütün Request Set'ler

Bir kullanıcıya ait bütün concurrent request'ler:

  SELECT frt.responsibility_name,  
      frg.request_group_name,  
      frgu.request_unit_type,  
      frgu.request_unit_id,  
      fcpt.user_request_set_name  
   FROM apps.fnd_Responsibility fr,  
      apps.fnd_responsibility_tl frt,  
      apps.fnd_request_groups frg,  
      apps.fnd_request_group_units frgu,  
      apps.fnd_request_Sets_tl fcpt  
   WHERE   frt.responsibility_id = fr.responsibility_id  
      AND frg.request_group_id = fr.request_group_id  
      AND frgu.request_group_id = frg.request_group_id  
      AND fcpt.request_set_id = frgu.request_unit_id  
      AND frt.LANGUAGE = USERENV ('LANG')  
      AND fcpt.LANGUAGE = USERENV ('LANG')  
      AND fcpt.user_request_set_name LIKE '%'  
      AND frt.responsibility_name IN  
         (SELECT b.responsibility_name NAME  
           FROM apps.fnd_user_resp_groups a,  
             apps.fnd_responsibility_vl b,  
             apps.fnd_user u  
          WHERE   a.user_id = u.user_id  
             AND u.user_id = (SELECT user_id  
                       FROM apps.FND_USER  
                      WHERE user_name = :User_name)  
             AND a.responsibility_id = b.responsibility_id  
             AND a.responsibility_application_id = b.application_id  
             AND SYSDATE BETWEEN a.start_date  
                     AND NVL (a.end_date, SYSDATE + 1)  
             AND b.end_date IS NULL  
             AND u.end_date IS NULL)  
 ORDER BY 1,  
      2,  
      3,  
      4; 

Uygulamada bulunan bütün concurrent request'ler:

  SELECT frt.responsibility_name, frg.request_group_name,  
   frgu.request_unit_type,frgu.request_unit_id,  
   fcpt.user_request_set_name  
   FROM apps.fnd_Responsibility fr, apps.fnd_responsibility_tl frt,  
   apps.fnd_request_groups frg, apps.fnd_request_group_units frgu,  
   apps.fnd_request_Sets_tl fcpt  
   WHERE frt.responsibility_id = fr.responsibility_id  
   AND frg.request_group_id = fr.request_group_id  
   AND frgu.request_group_id = frg.request_group_id  
   AND fcpt.request_set_id = frgu.request_unit_id  
   AND frt.LANGUAGE = USERENV('LANG')  
   AND fcpt.LANGUAGE = USERENV('LANG')  
   AND fcpt.user_request_set_name like '%'  
   ORDER BY 1,2,3,4  





26 Mart 2014 Çarşamba

Oracle Veritabanı: Bash Script İçerisinde SQL*PLUS ile Değer Girmek - Prompting For Input In Bash Script With SQL*Plus

Önceki yazımızda(Oracle Veritabanı: SQL*PLUS ve Script Etkileşimi - Interaction Between SQL*PLUS and Bash Shell Scripts - Execution of SQL Scripts) Bash Shell'de, SQL script'leriyle nasıl etkileşim haline geçebileceğimizi belirttik. Bu yazımızda da yazdığımız bir Bash Shell script'inin içinde çağırdığımız sql script'ine bir değer atamanın nasıl yapıldığını göstereceğiz.

--------------
#!/bin/bash
ls
sqlplus -s berke/berke <set serveroutput on;
declare
x char;
z char;
begin
select '&x' into z from dual;
dbms_output.put_line(z);
end;
/
exit;
EOF
ls
--------------

Yukarıdaki script içeriğimizde dual tablosundan bir select çekip orada da hangi değeri istediğimizi x değişkenine atıyoruz. Bu script'i çalıştırdığımızda ise bunu başaramıyoruz çünkü bize declare ile başlattığımız programımızın sonundaki yani "/" işaretinden sonraki ilk kelimeyi kendisine değer olarak almaktadır. Bu durumda x değişkenine exit kelimesi atanır.(x=exit)  Biz burada kendimize bir değer sorulmasını istiyorsak bunu yapmanın 2 yolu vardır. İlki sql kodunu burada yazmaktansa bir script olarak çalıştırmaktır.  2'si ise dışardan değer olarak almaktır.

1- SQL Script'ini Shell Script İçerisinden Çağırmak:

İlk aşamada bash script'imizi aşağıdaki gibi oluştururuz.

------------
#!/bin/bash
ls
sqlplus -s apps/apps @deneme.sql
-----------

Deneme.sql adlı SQL script'imizi bize girdi(input) sorması için aşağıdaki gibi oluştururuz.

------------------
set serveroutput on;
select '&x' from dual;
exit;
-----------------

Örnek çıktısı aşağıdaki gibidir.

------------------------
Enter value for x: 10
old   1: select '&x' from dual
new   1: select '10' from dual

'1
--
10
------------------------

2- Dışardan Değer Atamak:

Buradaki mantığımızda script'imizin içerisinde kullanacağımız değeri script'e girmeden önce belirleriz. sonrasında SQL*Plus'a bağlandıktan sonra "$"'ı kullanaraktan o parametremizin değerini işleyebiliriz.

------------------------
#!/bin/bash
echo "Deger giriniz: \c"
read y
echo "Degerimiz: "$y
sqlplus -s apps/apps << EOF
set heading off;
set feedback off;
select $y from dual;
exit;
EOF
------------------------


Örnek Çıktı:
------------------------
Deger giriniz \c
10
Degerimiz: 10

        10
------------------------
Modülerliği Arttırmak:

Script'imizi modüler yapmak içinse programımız tam bittiği anda değerlerimizi yerleştirebiliriz. Örneğin aşağıdaki programımızda 2 kere değer isteyen sonra da bu değerleri kullanan algoritma bulunmaktadır. Değişkenleri sürekli değiştirmektense programımızın sonuna program içerisinde herhangi bir yerde kullanılacak "a" ve "b" parametreleri için değerleri yerleştirebiliriz. Bu durumda a parametresinin değeri C  ve b parametresini değeri D olur.(a='C' ve b='D')

---------------
ls
sqlplus -s apps/apps <set serveroutput on;
declare
d varchar2(10);
f varchar2(10);
begin
select '&a' into f  from dual;
DBMS_OUTPUT.PUT_LINE(f);
select '&b' into d from dual;
dbms_output.put_line(d);
end;
/
C
D
exit;
EOF
---------------

Yukarıdaki script ile bash shell script'imizin içine değerlerde yapacağımız küçük değişikliklerle programımızın yönünü değiştirebiliriz.

Scriptimizin sonucu aşağıdaki gibidir.
---------------
Enter value for a: old   7: select '&a' into f  from dual;
new   7: select 'C' into f  from dual;
Enter value for b: old   9: select '&b' into d from dual;
new   9: select 'D' into d from dual;
C
D

PL/SQL procedure successfully completed.
---------------


Referanslar:


http://www.unix.com/shell-programming-scripting/24394-sqlplus-here-document-eof-vs-eof.html
http://www.oracle-base.com/articles/misc/oracle-shell-scripting.php

http://www.java2s.com/Tutorial/Oracle/0540__Function-Procedure-Packages/OutputtotheSQLplus.htm

20 Mart 2014 Perşembe

Oracle Veritabanı: SQL*PLUS ve Script Etkileşimi - Interaction Between SQL*PLUS and Bash Shell Scripts - Execution of SQL Scripts

-Bir bash script'i içerisinden prosedür çağırmak için:

ls
sqlplus berke/berke << eof

select sysdate from dual;

declare
begin
dbms_output.put_line('abcde');
end;
/
exit;
/
eof
ls

Bu script'i çağırdığımızda aşağıdaki gibi bir sonucun çıktığını görebiliriz.  


 ./abcd.sh  
 abcd.sh     addm      awr       db_control.sh  
 abcd.sh1    addmrpt.sql   awrrpt.sql   db_control.sql  
   
 SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 20 15:22:32 2014  
   
 Copyright (c) 1982, 2010, Oracle. All rights reserved.  
   
   
 Connected to:  
 Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production  
 With the Partitioning, Automatic Storage Management, OLAP, Data Mining  
 and Real Application Testing options  
   
 SQL> SQL> SQL>   
 SYSDATE  
 ---------  
 20-MAR-14  
   
 SQL>  2  3  4  5 abcde  
   
 PL/SQL procedure successfully completed.  
   
 SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production  
 With the Partitioning, Automatic Storage Management, OLAP, Data Mining  
 and Real Application Testing options  
 abcd.sh     addm      awr       db_control.sh  
 abcd.sh1    addmrpt.sql   awrrpt.sql   db_control.sql  

Bu script'in amacı bir bash script içerisinden sql ile sonuç çıkartıp gerekli cevapları alıp devamında işletim sistemi komutlarını girebiliriz. Böyle bir durumla maintenance script'i yazarken karşılaşmıştım. RAM'de hafıza durumu, cpu durumu gibi kontrolleri yaptıktan sonra SQL ile SQL*PLUS'a bağlanıp oradan çeşitli komutlar çalıştırıp yine tekrar işletim sistemine geri dönmek için bu şekilde komut yazmam gerekmişti.

-Klasör içerisindeki SQL script'ini çalıştırmak için  kısaca script'imizin başına  '@' işaretini ekleyerek devam edebiliriz.

sqlplus berke/berke @abcd.sql  

-Sysadmin olarak sql script'inin bash'ten çalıştırılması için aşağıdaki örneğimizi kullanabiliriz. 


 sqlplus -s "/ as sysdba" @$ORACLE_HOME/rdbms/admin/awrrpt.sql 

-Sh içerisinden yani terminalden çok satırlı SQL çalışması:

Yukarıdaki örneğimizden farklı olarak  bu sefer terminalden giriş yapmak istediğimizde aşağıdaki kodu kullanabiliriz. Diğer örneğimizde kodumuzu bir text'e yazmaktaydık.


sqlplus berke/berke << -eof
select sysdate from dual;
exit;
/
eof

-SQL*PLUS'ta çalıştırdığımız bir sorgunun sonucunu  alıp bir değişkene atamak içinse aşağıdaki örneği kullanabiliriz. Burada "code" adlı değişkenimize değerimizi atamak için değerimizi sqlplus'tan gönderdiğimiz sorguyla atarız.


code=""
code=$(sqlplus -s berke/berke <set heading off;
select sysdate from dual where 1=2;
EOF)

a=$(code)
if [ "$a" == "no rows selected" ]; then
echo "Tarih çıkmadı"
else
echo "Tarih $a"

17 Mart 2014 Pazartesi

Oracle Veritabanı: External Tables - Harici Tablolar

Harici tablolar ile Oracle veritabanı dışında bulunan dosyalar okunabilinir ve sorgulanabilinir. Oracle_Loader driver'ı  dışarıdaki dosyaların formatlarının düzenlenmesiyle birlikte içerideki dataların okunmasını sağlar. Harici dosyalar üzerine DML gerçekleştirilemez. Bu tablolara veri eklenip çıkartılamaz. Üzerlerine index tanımlanamaz. Harici dosyalar üzerine view ve synonym'ler yaratılabilinir; çünkü daha önceden bu tabloların tanımları yapılmıştır.

Harici tabloların oluşturulmasından önce bu tabloların bulunduğu klasörün belirtilmesi gerekir. Yerleştirilecek klasör veritabanında metadata olarak belirtilmelidir. Bunu da aşağıdaki klasör yaratma komutuyla yaratabiliriz.

create or replace directory temp_dir as '/home/users/oracle';

Silmek için de drop directory klasör_ismi;

Harici tabloları depolayacağımız klasörler belirtildikten sonra bu tabloların veritabanındaki eşleniklerini yaratırız. Yani tablomuzun tanımını veritabanında oluştururuz.

 CREATE TABLE emp (  
  name   VARCHAR2(50),  
  surname VARCHAR2(50)  
 )  
 ORGANIZATION EXTERNAL (  
  TYPE ORACLE_LOADER  
  DEFAULT DIRECTORY temp_dir  
  ACCESS PARAMETERS (  
   RECORDS DELIMITED BY NEWLINE  
   FIELDS TERMINATED BY ','  
   MISSING FIELD VALUES ARE NULL  
   (  
    name   CHAR(50),  
    surname CHAR(50)  
   )  
  )  
  LOCATION ('emp.txt')  
 ) 

Tablomuzun oluşturulmasındaki adımlar şöyledir.

1-Veritabanında sorgulayacağımız kolonları belirleriz.
2-"Organization External ile harici tablomuzun özelliklerini belirleriz.
   -Tablomuzun bulunduğu klasör
   -Access Parameters yani kayıtların nasıl formatlandığı
   -Verilerin text dosyasından nasıl okunacağını belirten kısım
   -Harici tablonun bulunduğu işletim sistemindeki dosya adı. (Bu örneğimizdeki adı 'emp.txt'. Bu dosya /home/users/oracle altındadır.)

Örnek olarak aşağıdaki resimden de görebiliriz.



Dosyamız veritabanında yaratıldığı anda harici dosyamızın bulunduğu klasördeki log dosyası oluşturulur.

 more EMP_20250962.log   
   
   
  LOG file opened at 03/17/14 14:42:03  
   
 Field Definitions for table EMP  
  Record format DELIMITED BY NEWLINE  
  Data in file has same endianness as the platform  
  Rows with all null fields are accepted  
   
  Fields in Data Source:   
   
   NAME              CHAR (20)  
    Terminated by ","  
    Trim whitespace same as SQL Loader  
   SURNAME             CHAR (20)  
    Terminated by ","  
    Trim whitespace same as SQL Loader  
 EMP_20250962.log: END  

Harici tablomuzun bulunduğu yeri ve içeriğini aşağıdan görebiliriz.

 >pwd  
 /home/users/oracle  
 >more emp.txt   
 berke,oz  
 ali,veli  
 mehmet,ahmet 

Harici tablomuzun bulunduğu dosyayı silersek ya da yerini değiştirirsek ORA-29913 hatasını alırız.

 ORA-29913: ODCIEXTTABLEOPEN başvurusunu yürütme hatası  
 ORA-29400: veri kartuşu hatası  
 KUP-04040: file emp.txt in TEMP_DIR not found  

Bu hatayla dosyamızın bulunamadığını anlayabiliriz.

Harici dosyadan okunamayan veriler "bad file" adı verilen bir dosyaya yazılırlar. Bununla ilgili bir parametre de vardır. Aynı şekilde "log file"'ın nereye çıkarılabileceğini gösteren bir parametre de yer alır. Aşağıdaki gibi örneğimizde görebiliriz.

  CREATE TABLE emp (   
  name  VARCHAR2(50),   
  surname VARCHAR2(50)   
  )   
  ORGANIZATION EXTERNAL (   
  TYPE ORACLE_LOADER   
  DEFAULT DIRECTORY temp_dir   
  ACCESS PARAMETERS (   
   RECORDS DELIMITED BY NEWLINE   
  BADFILE bdump:'%a_%p.bad'  
  LOGFILE bdump:'%a_%p.log'  
   FIELDS TERMINATED BY ','   
   MISSING FIELD VALUES ARE NULL   
   (   
   name  CHAR(50),   
   surname CHAR(50)   
   )   
  )   
  LOCATION ('emp.txt')   
  ) 


Access Parametreleri:

Access parametreleri içerisinde harici tablo dosyasının nasıl formatlandığı yazılır. Harici dosyadan her sütun alınamayabilinir ya da data tipleri farklı olabilir.

 create table apps.emp   
 (name varchar2(20)  
 )  
  organization external  
  (  
  type ORACLE_LOADER  
  Default Directory temp_dir  
  Access Parameters   
  (  
   Records Delimited By Newline  
   Fields terminated by ','  
   Missing Field values are null  
   (name char(20),  
   surname char(20)  
   )  
  )  
  Location ('emp.txt')  
  )  
    
  ;  
  select * from emp; 

Tablonun sütun tanım kısmından "surname" tablosunu çıkartırsak dosyadan "surname " bilgileri alınmaz. Ancak aşağıdaki gibi bir örnek yaratırsak hata alırız. Çünkü tablodaki 2. sütunu belirtmememize rağmen 2.sütunu veritabanına tanımlayınca okunamayan sütun bilgisi hatası alırız.

 create table apps.emp   
 (name varchar2(20),surname  varchar2(20)  
 )  
  organization external  
  (  
  type ORACLE_LOADER  
  Default Directory temp_dir  
  Access Parameters   
  (  
   Records Delimited By Newline  
   Fields terminated by ','  
   Missing Field values are null  
   (name char(20)  
   )  
  )  
  Location ('emp.txt')  
  )  
    
  ;  

Delimited By:

"Delimited by" ile tablonun içerisindeki satırların nasıl ayrıldığını gösteririz. Bu satırlar çeşitli karakter ifadeleriyle ayrılabilinirler.

Referanslar:
External Tables: http://docs.oracle.com/cd/E11882_01/server.112/e25494/tables.htm#ADMIN12898

14 Mart 2014 Cuma

Oracle Veritabanı: ADDM Raporunun Otomatikleştirilmesi - Automating ADDM Report

Oracle veritabanı için yaptığımız günlük kontrollerde AWR raporunu otomatikleştirdikten sonra aynı şekilde ADDM raporunu da otomatikleştirmek istedim. Temelde aynı olmakla birlikte ADDM raporu çıkartıldığında CLOB kolonuna yazmaktadır. O yüzden CLOB kolonundan dosya yazdırmamız gerekmektedir.

Script'imizin ana hatları AWR raporunu otomatikleştirirkenki kullandığımız script'ten oluşmaktadır. Bununla beraber ADDM raprunun oluşturulması için task yaratılması, instance analizinin yapılması sonrasında da bunun bir dosyaya yazılması bulunmaktadır.

DECLARE   
  cursor c_instance is   
   SELECT instance_number, instance_name   
   FROM gv$instance   
   ORDER BY 1   
  ;   
     
  v_dir   CONSTANT VARCHAR2(256) := '/home/users/oracle';   
  --v_dir   VARCHAR2(256) ;   
     
  v_dbid  v$database.dbid%TYPE;   
  v_dbname  v$database.name%TYPE;   
  v_inst_num v$instance.instance_number%TYPE := 1;   
  v_begin  NUMBER;   
  v_end   NUMBER;   
  v_start_date VARCHAR2(20);   
  v_end_date VARCHAR2(20);   
  v_options  NUMBER := 8; -- 0=no options, 8=enable addm feature   
  v_file  UTL_FILE.file_type;  -- l_fHandler         UTL_FILE.FILE_TYPE;  
  v_file_name VARCHAR(50);   
  c_chunk          CONSTANT PLS_INTEGER := 32767;  
  l_pos           PLS_INTEGER := 1;  
  p_clob CLOB;  
  tname varchar2(100);  
  BEGIN   
  -- get database id   
  SELECT dbid, name   
   INTO v_dbid, v_dbname   
   FROM v$database;   
     
     
  -- get end snapshot id   
  SELECT MAX(snap_id)   
   INTO v_end   
   FROM dba_hist_snapshot   
   WHERE to_char(begin_interval_time,'HH24') = '18';   
  dbms_output.put_line('end snap_id '||v_end);   
     
  -- get start snapshot id   
  SELECT MAX(snap_id)   
   INTO v_begin   
   FROM dba_hist_snapshot   
   WHERE to_char(begin_interval_time,'HH24') = '07'   
   AND snap_id < v_end;   
  dbms_output.put_line('begin snap_id '||v_begin);   
      
  SELECT to_char(begin_interval_time,'YYMMDD_HH24MI')   
   INTO v_start_date   
   FROM dba_hist_snapshot   
   WHERE snap_id = v_begin   
   AND instance_number = v_inst_num   
  ;   
  dbms_output.put_line('v_start_date '||v_start_date);   
    
  SELECT to_char(begin_interval_time,'HH24MI')   
   INTO v_end_date   
   FROM dba_hist_snapshot   
   WHERE snap_id = v_end   
   AND instance_number = v_inst_num   
  ;    
  dbms_output.put_line('v_end_date '||v_end_date);   
     
     
  execute immediate('create or replace directory TEMP_DIR as '''||v_dir||'''');   
    
  FOR v_instance IN c_instance LOOP   
   dbms_output.put_line('v_instance.instance_name:'||v_instance.instance_name);   
    
  tname := 'ADDM Raporu';   
  DBMS_ADDM.ANALYZE_INST(tname, v_begin, v_end);  
        
  select dbms_addm.get_report(tname) into p_clob from dual;  
      
   clob_to_file('TEMP_DIR', 'addm_' || v_instance.instance_name ||'_'|| v_instance.instance_number || '_' || v_start_date || '_' || v_end_date || '.html',p_clob );  
   
    
   
   END LOOP;   
   
  dbms_addm.delete(tname);  
  execute immediate('drop directory TEMP_DIR');   
  EXCEPTION   
  WHEN OTHERS THEN   
   DBMS_OUTPUT.PUT_LINE(SQLERRM);   
   BEGIN   
   execute immediate('drop directory TEMP_DIR');   
   EXCEPTION   
   WHEN OTHERS THEN   
    null;   
   END;   
  END;   
  /  

v_instance döngüsünün amacı RAC ortamları için instance tespit etmektir.

ADDM raporunun yaratılmasını dbms_addm.analyze_inst ile yapmaktayız. Burada dbms_addm.analyze_inst yerine dbms_addm.analyze_db ya da başka tip addm raporları oluşturabiliriz.

tname := 'ADDM Raporu';   
  DBMS_ADDM.ANALYZE_INST(tname, v_begin, v_end);  
        
  select dbms_addm.get_report(tname) into p_clob from dual;  
      
   clob_to_file('temp_dir', 'addm_' || v_instance.instance_name ||'_'|| v_instance.instance_number || '_' || v_start_date || '_' || v_end_date || '.html',p_clob ); 

Dosya yaratma ve silme haklarını kullanıcımıza vermek için aşağıdaki sorguları kullanabiliriz.

 grant create any directory to (kullanıcı);  
 grant drop any directory to (kullanıcı);  

Buradaki "clob_to_file" prosedürü daha önceden yazdığımız "Oracle Veritabanı: Clob'u Dosyaya Yazdırmak - Writing a Clob Colum To An OS File " adlı yazımızda bulabilirsiniz.


Referans:
ADDM prosedürleri: http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_addm.htm#CACDBJFG

Oracle Veritabanı: Clob'u Dosyaya Yazdırmak - Writing a Clob Colum To An OS File

Clob sütununu işletim sisteminde herhangi bir dosyaya yazdırmak için aşağıdaki prosedürü kullanabiliriz.

 CREATE OR REPLACE PROCEDURE clob_to_file  
 ( p_directory        IN VARCHAR2,  
  p_filename         IN VARCHAR2,  
  p_clob           IN CLOB ) IS  
   
  c_chunk          CONSTANT PLS_INTEGER := 32767;  
  l_fHandler         UTL_FILE.FILE_TYPE;  
  l_pos           PLS_INTEGER := 1;  
   
 BEGIN  
   
  l_fHandler := UTL_FILE.FOPEN(p_directory, p_filename, 'W', c_chunk);  
  WHILE l_pos < DBMS_LOB.GETLENGTH(p_clob) LOOP  
   UTL_FILE.PUT(l_fHandler, DBMS_LOB.SUBSTR(p_clob, c_chunk, l_pos));  
   l_pos := l_pos + c_chunk;  
   UTL_FILE.FFLUSH(l_fHandler);  
  END LOOP;  
  UTL_FILE.FCLOSE(l_fHandler);  
   
 END;  
 /  


Dikkat edilmesi gereken konular ise p_directory olarak belirttiğimiz varchar2 değişkeni veritabanında yarattığımız bir klasör adına denk gelmelidir. "p_clob"'da clob tipinde bir değişkendir. Örnek olarak klasör  böyle yaratılabilinir.

 create or replace directory temp_dir as '/home/users/oracle'; 


13 Mart 2014 Perşembe

Oracle Veritabanı: AWR Raporunun Otomatikleştirilmesi - Automating AWR Report

AWR raporlarının nasıl çalıştırıldığını daha önce de görmüştük. $ORACLE_HOME/rdbms/admin altındaki awrrpt.sql scriptini çalıştırarak raporumuzu oluşturabiliriz. Bununla birlikte raporumuzu oluştururken bizden bazı girdileri isteyecektir. İnteraktif olarak bunları girmek yerine direk bu girdileri verebilirsek işimizi otomatize etmiş oluruz.

Otomatikleştirme işleminin yararı ise snapshot ayarlarından bağımsız olarak istediğimiz kadar raporları tutmuş oluruz. Raporları tutmaklada kalmayıp bunun analiz edilmiş çıktısını da saklamış oluruz. Böylece ileriki zamanlarda raporlara ihtiyaç duyduğumuzda veya çeşitli bilgiler için analiz etmek istediğimizde bu raporlar elimizin altında olacaktır.

Belirtilen script'i damir-vadas.blogspot.com'da bulabilirsiniz. Bu script'e günlük kontrollerim sırasında ihtiyacım olduğu için gerek duydum. Böylece günlük olarak hem iş yükünü hem de karşılaşılan sorunları görebilecektim.

Script'de Neler Yapılmakta?

Script  içerisinde raporumuza koyacağımız bilgileri belirlenmektedir. Örneğin DBID'si, Snapshot id'sini gibi bilgileri alınmaktadır. Snapshot bilgilerini alırken de 07-18 saat dilimleri arası alınmaktadır. Sonrasında v_dir değişkeniyle belirtilen klasörün tanımı veritabanına yapılır. Bu tanım ALL_DIRECTORIES tablosundan görülebilinir.

select * from all_directories  

Ardından da dosya açılır ve rapor dosyanın içine yazdırılır.  Script içine fazladan dbms_output.put_line('1'); gibi komutlar eklenmiştir. Bu script'in ortam değişikliği durumunda debug edilmesi, karşılaşılan hataların hangi aşamada görülmesini sağlamak içi konulmuştur.

Script çalıştırılırken klasör adına, snapshot aralığına ve gerekli yetkilere dikkat edilmelidir.

set serveroutput on  
 set linesize 166  
 set pagesize 600  
 set trimout on  
   
 DECLARE  
  cursor c_instance is  
   SELECT instance_number, instance_name  
   FROM  gv$instance  
   ORDER BY 1  
  ;  
   
  v_dir     CONSTANT VARCHAR2(256) := '/home/users/oracle';  
  --v_dir     VARCHAR2(256) ;  
    
  v_dbid    v$database.dbid%TYPE;  
  v_dbname   v$database.name%TYPE;  
  v_inst_num  v$instance.instance_number%TYPE := 1;  
  v_begin    NUMBER;  
  v_end     NUMBER;  
  v_start_date VARCHAR2(20);  
  v_end_date  VARCHAR2(20);  
  v_options   NUMBER := 8; -- 0=no options, 8=enable addm feature  
  v_file    UTL_FILE.file_type;  
  v_file_name  VARCHAR(50);  
   
 BEGIN  
  -- get database id  
  SELECT dbid, name  
   INTO v_dbid, v_dbname  
   FROM v$database;  
   dbms_output.put_line('1');  
   
  -- get end snapshot id  
  SELECT MAX(snap_id)  
   INTO v_end  
   FROM dba_hist_snapshot  
   WHERE to_char(begin_interval_time,'HH24') = '18';  
  dbms_output.put_line('end snap_id '||v_end);  
  dbms_output.put_line('2');  
  -- get start snapshot id  
  SELECT MAX(snap_id)  
   INTO v_begin  
   FROM dba_hist_snapshot  
   WHERE to_char(begin_interval_time,'HH24') = '07'  
    AND snap_id < v_end;  
  dbms_output.put_line('begin snap_id '||v_begin);  
    dbms_output.put_line('3');  
  SELECT to_char(begin_interval_time,'YYMMDD_HH24MI')  
   INTO v_start_date  
   FROM dba_hist_snapshot  
   WHERE snap_id = v_begin  
    AND instance_number = v_inst_num  
  ;  
  dbms_output.put_line('v_start_date '||v_start_date);  
  dbms_output.put_line('4');  
  SELECT to_char(begin_interval_time,'HH24MI')  
   INTO v_end_date  
   FROM dba_hist_snapshot  
   WHERE snap_id = v_end  
    AND instance_number = v_inst_num  
  ; dbms_output.put_line('5');  
  dbms_output.put_line('v_end_date '||v_end_date);  
    
  -- Thanx to Yu Denis Sun - we must have directory defined as v_dir value!  
  execute immediate('create or replace directory xx_some_temp_dir as '''||v_dir||'''');  
   dbms_output.put_line('6');  
  -- let's go to real work...write awrs to files...   
  FOR v_instance IN c_instance LOOP  
   dbms_output.put_line('v_instance.instance_name:'||v_instance.instance_name);  
   v_file := UTL_FILE.fopen('XX_SOME_TEMP_DIR', 'awr_' || v_instance.instance_name ||'_'|| v_instance.instance_number || '_' || v_start_date || '_' || v_end_date || '.html', 'w', 32767);  
   FOR c_report IN (  
    SELECT output  
     FROM TABLE(dbms_workload_repository.awr_report_html( v_dbid,  
                                v_instance.instance_number,  
                                v_begin,  
                                v_end,  
                                v_options  
                               )  
          )  
   ) LOOP  
    UTL_FILE.PUT_LINE(v_file, c_report.output);  
   END LOOP;  
   UTL_FILE.fclose(v_file);  
   dbms_output.put_line('7');  
  END LOOP;  
   dbms_output.put_line('8');  
  execute immediate('drop directory xx_some_temp_dir');  
  dbms_output.put_line('9');  
 EXCEPTION  
  WHEN OTHERS THEN  
   DBMS_OUTPUT.PUT_LINE(SQLERRM);  
    dbms_output.put_line('10');  
   IF UTL_FILE.is_open(v_file) THEN  
    UTL_FILE.fclose(v_file);  
   END IF;  
   BEGIN  
    execute immediate('drop directory xx_some_temp_dir');  
   EXCEPTION  
    WHEN OTHERS THEN  
     null;  
   END;  
 END;  
 /

Burada günlük olarak çalışma koşulu max(snap_id) ve begin_interval_time koşulu ile sağlanmaktadır. Böylece saat 18 snapshot'ı doğal olarak en son gün için yüksek olacağı hep o günün AWR raporu alınacaktır.

Aşağıda yazdığım kod ise $HOME dizininde raporun bir benzeri varsa çıkmakta, yoksa da awrrpt.sql scriptini çalıştırmaktadır.

 cd ;  
 x=$(date +"%y%m%d");  
 ls *$x* >> /dev/null 2>&1;  
 if [ $? != 0 ];  
 then  
  sqlplus -s "/ as sysdba" @$ORACLE_HOME/rdbms/admin/awrrpt.sql;  
 else  
  exit;  
   
 fi 

Referans:
1-AWR Raporunun Otomatik Çalıştırılması Script :http://damir-vadas.blogspot.com.tr/2009/11/automated-awr-reports-in-oracle-10g11g.html

12 Mart 2014 Çarşamba

Oracle E-Business Suite: Error - JVM Leaked Connections:


"System Administrator > System Administration:Diagnostics > AOL/J Database Connection Pool Status" altında Java bağlantılarıyla ilgili belirli istatistikleri gösteren bir ekran vardır. Bu ekranın önemi veritabanına yapılan JDBC bağlantılarının performans düşüklüklerine neden olabilmesidir.

JDBC bağlantıları Java  programları ile veritabanları arasındaki bağlantıyı sağlamaktadır. Java JDBC bağlantılarıyla çalıştırılan SQL'lerin sonuçları geri döndürülür.




Bu ekranda "leaked connections" bağlantısına tıkladığımızda aşağıdaki gibi bir hata görebiliriz.

oracle.apps.fnd.security.LeakedConnectionException 1, 0x1421fc8, 2010-05-17+14:09:23.745-0700,   
 Thread[AJPRequestHandler-HTTPThreadGroup-12,5,HTTPThreadGroup]  
 at oracle.apps.fnd.security.CallStack.getInstance(CallStack.java:109)  
 at oracle.apps.fnd.security.DBConnObj.setBorrowingThread(DBConnObj.java:990)  
 at oracle.apps.fnd.security.DBConnObj.setBorrowingThread(DBConnObj.java:973)  
 at oracle.apps.fnd.common.Pool.costBasedSelection(Pool.java:1885)  
 at oracle.apps.fnd.common.Pool.selectObject(Pool.java:1686)  
 at oracle.apps.fnd.common.Pool.borrowObject(Pool.java:950)  
 at oracle.apps.fnd.security.DBConnObjPool.borrowObject(DBConnObjPool.java:584)  
 at oracle.apps.fnd.security.AppsConnectionManager.borrowConnection(AppsConnectionManager.java:330)  
 at oracle.apps.fnd.common.Context.borrowConnection(Context.java:1719)  
 at oracle.apps.fnd.common.AppsContext.getPrivateConnectionFinal(AppsContext.java:2314)



Eğer bunlardan çok varsa bir bug'a bağlantılı olarak bunlar çıkıyor olabilir. Eğer durum böyleyse bunlar gerçek olmayan sızmalardır. Bağlantılar pool'a geri döndürüldüğünde ve boş bağlantı kalmadığında oluşmaktadır. Bunun için 9907719 nolu patch indirilmeli ve uygulanmalıdır.

Connection Leakage Nedir?

Bir uygulama aldığı bağlantıyı belirtilen bir sürede geri vermez ise bununla ilgili uyarı burada çıkar.

Connection Lock Nedir?

Eğer DML operasyonları JDBC bağlantıları içerisinde gerçekleştirilip commit edilmiyorlarsa, o connection bu işi gerçekleştirene kadar locked olarak kalır.

Connection Leakage Nasıl Tespit Edilir?

Veritabanına bağlantı yapan modülleri aşağıdaki sorguyla incelemeliyiz. Eğer bu liste sürekli büyüyorsa burada bir sorun olduğunu düşünebiliriz.


 select s.machine, s.username, s.module, s.inst_id, count(*) how_many  
 from (select distinct PROGRAM, PADDR, machine, username, module, inst_id from gV$SESSION) s,  
 gv$process p  
 where s.paddr = p.addr  
 and p.inst_id = s.inst_id  
 group by s.machine,s.username, s.module, s.inst_id;  

Toplam sayıyı görmek için:

 select sum(how_many) from (select s.machine, s.username, s.module, s.inst_id, count(*) how_many  
 from (select distinct PROGRAM, PADDR, machine, username, module, inst_id from gV$SESSION) s,  
 gv$process p  
 where s.paddr = p.addr  
 and p.inst_id = s.inst_id  
 group by s.machine,s.username, s.module, s.inst_id);

Yine v$session tablosunu sorgulayaraktan hangi session'ların 24 saatten fazla açık kaldığına bakabiliriz. Sonrasında bu sessionlar incelenebilir ve kapatılabilinir.

select a.* from v$session a where sysdate-logon_time>24 and type!='BACKGROUND'; 

Referans:
1-http://oracledbascriptsfromajith.blogspot.com.tr/2010/10/how-to-prevent-inactive-jdbc.html
2-Connection Leak: Find LeakedConnectionException Reported in AOLJ Database Connection Pool Test (Doc ID 1177093.1)
3-http://ora-players.blogspot.com.tr/2011/08/jvm-taking-high-cpu-toooooooo-many-jdbc.html
4-Basic troubleshooting of JVM consuming CPU or too many JDBC connections in EBS Apps 11i (Doc ID 370583.1)
5-AOL/J JDBC Connection Pool White Paper (Doc ID 278868.1)

6 Mart 2014 Perşembe

Oracle E-Business Suite: Oracle Application Library SQL Scriipts

Aşağıdaki tabloda E-Business Suite için yer alan SQL scriptleri yer almaktadır. $FND_TOP/sql altında SQL'lerimizi bulabiliriz.

SQL Script11.0.x10.7NCA107SC/16.1Purpose
afchrchk.sql
x
x
Check requested table.columns for invalid trailing spaces and control characters. These characters cause 'FRM-40654: Record has been updated.' Errors when column is queried in a form. Please note that afchrchk.sql SHOULD NOT run against FND_FLEX_VALUES with option 3 (check for control characters) set to Yes, and automatic fix set to Yes. This will strip the control characters from the COMPILED_VALUE_ATTRIBUTES column. Hence, impacting the General Ledger natural account value sets as they lose all their segment qualifiers.
afcmcreq.sql
x
x
x
Prints the Log file names of the managers that can run a given request
afcmrrq.sql
x
x
x
For use by DBA's for quick look of all running requests
afcmstat.sql
x
x
x
Displays all defined Managers and shows current status of manager processes.
afffanld.sql
x
Diagnoses inconsistencies in key flexfield segment delimiters that may be introduced by the 10.7 upgrade because of an AutoInstall bug (492585).
affixcvr.sql
x
x
x
Fixes cross-validation rules and lines by deleting any which refer to non-existent flexfield structures, and by disabling any rules which have no lines. User must manually commit or rollback after execution.
afhlpfix.sql
x
Find data integrity problems in FND_HELP and delete the orphan rows.
afimchk.sql
x
x
x
Checks to see if the Concurrent Manager monitor is actually running
afimlock.sql
x
x
x
Script to detect if the Internal Concurrent Manager is in a gridlock situation with another oracle process. The script will print the user, process id, machine, program and the terminal which is causing the gridlock.
afimpmon.sql
x
x
x
Sets the PMON method based on the argument ( for CONC_PMON_METHOD )
afimveri.sql
x
x
x
Resets the Concurrent Manager monitor
afpub.sql
x
x
x
Grants select privileges and creates synonym for APPLSYS PUBlic account
afqpmex.sql
x
x
x
This script is used for sql tuning. The input is the name of a file containing a sql statement. The output is the execution plan for the statement along with information about the index columns and the sizes of the tables involved. The results are spooled to the file explain.out. This is an elaboration of the old-fashioned results from querying plan_table after running "explain plan for...". This script assumes the file contains a single, bare SQL statement, with no blank lines and no terminating ";" or "/". Also see afqpmexq.slq/explainq.sql
afqpmexq.sql
x
x
x
This script is used for sql tuning. (See description for afqpmex.sql)
afqpmind.sql
x
x
x
This script is used for sql tuning. The input is a table name (without a schema prefix) and the output is information about it's indexes and the total size of the allocated extents. The data for the DISTINCT_KEYS column comes from the analyze command.
afqpminq.sql
x
x
x
This script is used for sql tuning. The input is a table name (without a schema prefix) and the output is information about it's indexes. The data for the DISTINCT_KEYS column comes from the analyze command.Also see afqpmiq.sql/iq.sql.
afqpmiq.sql
x
x
x
This script is used for sql tuning.
afqpmlck.sql
x
x
x
This script is used for sql tuning. It lists all sessions that are waiting for a lock. The process holding the root of the lock tree is the left most process printed. Those printed to the right of it are waiting for locks to the left of it.
afqpmmws.sql
x
x
x
This script is used for performance monitoring. This script analyzes a table of wait samples. The single input parameter for the script is a table of wait samples which has the same columns as fnd_wait_samples.Some ways to create the input table:create or replace view wait_samples_view as select * from fnd_wait_samples; create table temp_wait_samples as select * from fnd_wait_samples;
afqpmmys.sql
x
x
x
This script is used for sql tuning. It lists the session id, user process id, server process id, OS user id, and Oracle user id for the current session.
afqpmmyw.sql
x
x
x
This script is used for sql tuning. It returns the cummulative totals for all wait events for the current session.
afqpmopd.sql
x
x
x
This script is used for sql tuning. The input is the process id of the Oracle server process. The output includes the session id, the user process id, and the OS user id.
afqpmpid.sql
x
x
x
This script is used for sql tuning. The input is an OS process id for the user process. The output includes the session id, server process id, and OS user id for the process.
afqpmrid.sql
x
x
x
This script is used for sql tuning. The input is a concurrent manager request_id, and the output is the operating system process id of the corresponding FNDLIBR process.
afqpmsid.sql
x
x
x
This script is used for sql tuning. The input is the Oracle session id and the output includes the user process id, the server process id, the OS user id, and the program being run.
afqpmsql.sql
x
x
x
This script is used for sql tuning. The input is the user process id and the output is a listing of the sql statement currently in progress.
afqpmsqx.sql
x
x
x
This script is used for sql tuning. The input is the user process id. The output is the execution plan and a description of the tables and their indexes (the same as is produced by qpmex.slq/explain.sql).
afqpmwta.sql
x
x
x
This script is used for sql tuning. It returns a snapshot of all the wait events in the database at this instant.
afqpmwti.sql
x
x
x
This script is used for sql tuning.The input is the user process id and the output includes the table or index name of the last I/O. This is a moderately long-running script. When the DELAY column contains "CPU - recent:" this indicates that the query is currently using CPU and the last non-CPU delay will be reported. When the current (or most recent) delay was not for IO, the TABLE_OR_INDEX_NAME and TYPE columns are null.
afqpmwtp.sql
x
x
x
This script is used for sql tuning. Input is the user process id and the output is a snapshot of the current action of the server process.
afqpmwtr.sql
x
x
x
This script is used for sql tuning. It returns a snapshot of all the wait events, but only for the real-time processes. (compare to afqpmwta.sql/wait_all.sql)
afrqpend.sql
x
x
x
Selects all the Pending Requests with status ‘I’.
afrqrun.sql
x
x
x
Lists all Running, Terminating, Paused Requests
afrqscm.sql
x
x
x
Prints the Log file names of the managers that can run a given request
afrqstat.sql
x
x
x
Summary of concurrent request execution since Date
afrqwait.sql
x
x
x
Selects all the Pending Requests with status Q
afsecchk.sql
x
x
x
Release 7.5 Referential Integrity Display
afsetpri.sql
x
x
x
Used to set Program level priority for concurrent programs
afsetseq.sql
x
x
x
Set ORACLE Sequence
afsetsqx.sql
x
x
x
Set ORACLE Sequence. The difference between this script (afsetsqx.sql) and afsetseq.sql is that this script performs EXIT at the end as it is called directly from driver files.
afsyn01.sql
x
x
x
Drop synonyms for old tables, views and sequences.
afuiddrv.sql
x
x
x
Sets all sequences
afwebdbg.sql
x
x
Print WebServer setup debugging information.
afxpmmws.sql
x
x
x
This script is used for performance monitoring. This script analyzes a table of wait samples. The single input parameter for the script is a table of wait samples which has the same columns as fnd_wait_samples.
fdmchk.sql
x
x
Check menu entry dangling references.
fdmfix.sql
x
x
Check & fix menu entry dangling references.
FNDATPRG.sql
x
x
Purge audit trail tables before a given date
FNDCPDC2.sql
x
x
Delete a concurrent program and SRS definition if needed, calls FNDCPDCP.sql
FNDCPDCP.sql
x
x
Delete a concurrent program and SRS definition if needed
fndfbdpm.sql
x
x
Deletes a flexbuilder parameter.
fndfbfxn.sql
x
x
Generate a list of FlexBuilder functions and parameters for a given application. Some parameters have multiple definitions, but this report lists each parameter only once.
fndfbprm.sql
x
x
Generate a list of FlexBuilder functions and parameters, including detailed information about how the parameter is defined for a given application. This report includes all definitions for each parameter, ordered by sequence number. The information in this report corresponds to information in the Define FlexBuilder Parameters form.
fndffbdd.sql
x
x
x
Finds independant segment values which don't have the default dependant segment value defined for them.
FNDFFCVS.sql
x
x
Copy flexfield value set from one database to another creates a sql script filename.sql which can be run on another database to copy value sets
FNDFFDDS.sql
x
x
Delete a descriptive flexfield definition from AOL tables
FNDFMFXR.sql
x
x
Forms Trigger Exception Report
fndgofpr.sql
x
x
Creates Grants Only for a Full PRivileged Oracle ID. This assumes fndgsspr.sql was run first to create a limited set of SELECT only privileges which are not recreated here.
fndgsnpa.sql
x
x
Revokes all AOL grants and drops all AOL synonyms from a user. Must also revoke synonym GL_CURRENCIES which uses FND_CURRENCIES.
fndgsspr.sql
x
x
Creates Grants and Synonyms for a Select only Privileged Oracle ID.
FNDMDCMR.sql
x
x
Creates a report of all messages for an application in the given language.The report is located in the application's message directory and has the name {language short name}.FDDTMFEXT. For example: /applications/fnd/5.0/mesg/usaeng.msg. The standalone FNDMDCMF (Create Message File) runs this report after creating the binary message file to produce a human-readable version.
fndmncpy.sql
x
x
Copy application menus to another, custom application (Rel. 9 to 10 backup)
FNDNLADD.sql
x
x
x
Add missing translation rows for FND _TL tables.
FNDNLCHK.sql
x
x
Check _TL tables for inconsistent or missing translation data. FNDNLCHK does not fix anything, it only reports bad data. Use FNDNLADD to fix errors found by FNDNLCHK.
fndnlhlp.sql
x
x
Updates fnd_loader_formats
FNDNLICR.sql
x
x
NLS Insert non-ISO currency
FNDNLINS.sql
x
x
x
Update _TL tables to populate rows for new language when a new language is installed.
FNDNLMVL.sql
x
x
Install multi-language versions of _VL views.
fndnmts.sql
x
x
Populate FND%_TL subtables with data from main FND% tables ( In 10.5 this script is superceded by FNDNLADD.sql and should not be used by customers. )
fndnstm.sql
x
x
Populate FND_ main tables with data from subtables.
fndrspfm.sql
x
x
Report on Users who Access a Given Form
FNDRSTST.sql
x
x
SRS Test Program - expects three arguments and prints them
fndscats.sql
x
x
Signon Audit Time Stamp
FNDSCETS.sql
x
x
x
Set end time stamp (FND_LOGINS, FND_LOGIN_RESPONSIBILITIES, FND_LOGIN_RESP_FORMS)
FNDSCGRP.sql
x
x
x
Reports on which applications, sets and programs have been assigned to which responsibility. Accepts application name and responsibility name.
FNDSCPRG.sql
x
x
x
Purge signon audit tables from given date
FNDUDUAL.sql
x
x
x
This script ensures only one record exists in FND_DUAL.
fndutcsq.sql
x
x
Converts rows in FND_UNIQUE_IDENTIFIER_CONTROL to Sequences
srstest.sql
x
x
SRS test script
TSTSQPLS.sql
x
x
x
SQL script to test execution methods for RTs.
wfbkg.sql
x
x
x
WorkFlow BacKGround engine, starts the background engine, running for the indicated number of minutes.
wfbkgchk.sql
x
x
WorkFlow Background Check. It displays a status report on background work waiting to be processed.
wfdirchk.sql
x
x
WorkFlow Directoy Servoices Data Model Check
WFNLADD.sql
x
x
Add missing translation rows for WF _TL tables.
wfnldat.sql
x
Add default language data for standalone Workflow install.
wfnlena.sql
x
Enable/disable an installed language (workflow)
wfntfsh.sql
x
x
x
WorkFlow NoTiFication SHow status
wfprot.sql
x
x
x
WorkFlow PROTection level reset. It resets the protection level for all objects in a specified item type to the supplied value. After resetting the protection level NOTHING in the item type will be customizable by a higher access level.
wfrefchk.sql
x
x
WorkFlow Primary,Unique and Foreign Key constraint checker. It checks for all invalid workflow data that is missing primary key data for a foreign key
wfretry.sql
x
x
x
WorkFlow Handle error'ed activity. It displays a list of errored activities for the indicated item. Type in the name of the activity, and command to skip, retry, or reset.
wfrmall.sql
x
x
WorkFlow ReMove ALL. It DELETES all workflow information. ALL OF IT.
wfrmbref.sql
x
Deletes all invalid workflow data that is missing primary key data for a foreign key
wfrmita.sql
x
x
WorkFlow ReMove ITem Attribute. It deletes all workflow information for the specified item attribute.
wfrmitms.sql
x
x
x
WorkFlow ReMove ITMeS. It removes item status information for items which match the supplied type and key patterns.
wfrmitt.sql
x
x
WorkFlow ReMove ITemType. It deletes ALL workflow information for the specified item type.
wfrmtype.sql
x
x
x
WorkFlow ReMove TYPE. It purges ALL runtime data associated with a given item type.
wfrun.sql
x
x
x
WorkFlow RUN a process. It creates and starts the specified process.
wfstat.sql
x
x
x
WorkFlow item STATUS report. It displays a status report on the indicated item (132 charachter output).
wfstatus.sql
x
x
x
WorkFlow item STATUS report. It displays a status report on the indicated item (132 charachter output).
wfver.sql
x
x
x
WorkFlow VERsion display. It displays version information for all WF source.
wfverchk.sql
x
x
WorkFlow Version Check. It checks all workflow activities for potentially invalid version histories (more than one version of an activity active at any given time). Correct any errors found.