Steps To Take FRD Trace in 11.5.10 & R12 [ID 867943.1]

Applies to:
Oracle Inventory Management - Version: 11.5.10.0 and later   [Release: 11.5.10 and later ]
Information in this document applies to any platform.
This note includes all versions of Oracle E-Business Suite 11i and Release 12
Goal
Steps to take FRD Trace in 11.5.10 and R12 ?
Solution
In 11i
------
1.   Login to your Instance Unix session as Apps.

2.   Login to System Administrator Responsibility in Oracle Applications.

3.   Add the following profile to the USER LEVEL as follows

(e.g.)  ICX: Forms Launcher = http://celalnx32.us.oracle.com:10403/dev60cgi/f60cgi?&record=collect&log=ABC.log

4.    Logout and Log back in again, for this profile to take effect. When you login again, a message box pops up, which alerts you that Diagnostics is enabled.

5.    Reproduce the Forms-Issue.

6.    Exit the application.

7.    Locate the file in the directory set by variable $FORMS_TRACE_PATH.


In R12
------
1. Login to your Instance Unix session as Apps.

2.Make the USER value for profile option 'ICX: Forms Launcher' the same as the SITE value.

3. Append the USER value of ICX: Forms Launcher with the "?record=collect" and save this at the user level.
(Eg):http://celalnx20.us.oracle.com:10106/forms/frmservlet?record=collect

4. Logout and Log back in again, for this profile to take effect. When you login again, a message box pops up, which alerts you that Diagnostics is enabled.

5. Go to Help->About Oracle Applications, go to the section 'Forms Server Environment Variables'
There you should see a value in FORMS_TRACE_DIR. Note down the value.
 
6. Reproduce the Forms-Issue.
 
7. Locate the file in the directory noted in FORMS_TRACE_DIR.

Note: By default, this directories named as forms_.trc where pid is the process identifier.
Collect _

API to make invalid objects to valid in any instance

I would like to share you one standard API of making invalid objects valid in any instance.  This API will check the inter-dependencies between the objects and make them valid sequentially.  The below code needs to be run in apps schema which makes all the objects valid.  This info. I got from DBA who made 3600+ objects valid within half an hour.

BEGIN
exec sys.utl_recomp.recomp_parallel(20);
END;

REF CURSORS

A REF CURSOR is basically a data type.  A variable created based on such a data type is generally called a cursor variable.  A cursor variable can be associated with different queries at run-time.  The primary
advantage of using cursor variables is their capability to pass result sets between sub programs (like stored
procedures, functions, packages etc.).
Let us start with a small sub-program as follows:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  en emp.ename%type;
begin
  open c_emp for select ename from emp;
  loop
      fetch c_emp into en;
      exit when c_emp%notfound;
      dbms_output.put_line(en);
  end loop;
  close c_emp;
end;
Let me explain step by step.  The following is the first statement you need to understand:
  type r_cursor is REF CURSOR;
The above statement simply defines a new data type called "r_cursor," which is of the type REF CURSOR.  We declare a cursor variable named "c_emp" based on the type "r_cursor" as follows:
  c_emp r_cursor;
Every cursor variable must be opened with an associated SELECT statement as follows:
  open c_emp for select ename from emp;
To retrieve each row of information from the cursor, I used a loop together with a FETCH statement as follows:
  loop
      fetch c_emp into en;
      exit when c_emp%notfound;
      dbms_output.put_line(en);
  end loop;
I finally closed the cursor using the following statement:
  close c_emp;
%ROWTYPE with REF CURSOR
In the previous section, I retrieved only one column (ename) of information using REF CURSOR.  Now I would like to retrieve more than one column (or entire row) of information using the same.  Let us consider the following example:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  er emp%rowtype;
begin
  open c_emp for select * from emp;
  loop
      fetch c_emp into er;
      exit when c_emp%notfound;
      dbms_output.put_line(er.ename || ' - ' || er.sal);
  end loop;
  close c_emp;
end;
In the above example, the only crucial declaration is the following:
  er emp%rowtype;
The above declares a variable named "er," which can hold an entire row from the "emp" table.  To retrieve the
values (of each column) from that variable, we use the dot notation as follows:
      dbms_output.put_line(er.ename || ' - ' || er.sal);
Let us consider that a table contains forty columns and would like to retrieve fifteen columns.  In such
scenarios, it is a bad idea to retrieve all forty columns of information.  At the same time, declaring and
working with fifteen variables would be bit clumsy.
Until now, we have been working either with %TYPE or %ROWTYPE. This means we are working with either one value
or one complete record. How do we create our own data type, with our own specified number of values to hold?
This is where TYPE and RECORD come in.  Let us consider the following example:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  type rec_emp is record
  (
    name  varchar2(20),
    sal   number(6)
  );
  er rec_emp;
begin
  open c_emp for select ename,sal from emp;
  loop
      fetch c_emp into er;
      exit when c_emp%notfound;
      dbms_output.put_line(er.name || ' - ' || er.sal);
  end loop;
  close c_emp;
end;
The most confusing aspect from the above program is the following:
  type rec_emp is record
  (
    name  varchar2(20),
    sal   number(6)
  );
The above defines a new data type named "rec_emp" (just like %ROWTYPE with limited specified fields) which can
hold two fields, namely "name" and "sal."
  er rec_emp;
The above statement declares a variable "er" based on the datatype "rec_emp."  This means that "er" internally
contains the fields "name" and "job."
      fetch c_emp into er;
The above statement pulls out a row of information (in this case "ename" and "sal") and places the same into
the fields "name" and "sal" of the variable "er."  Finally, I display both of those values using the following
statement:
      dbms_output.put_line(er.name || ' - ' || er.sal);
As defined earlier, a REF CURSOR can be associated with more than one SELECT statement at run-time.  Before
associating a new SELECT statement, we need to close the CURSOR.  Let us have an example as follows:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  type rec_emp is record
  (
    name  varchar2(20),
    sal   number(6)
  );
  er rec_emp;
begin
  open c_emp for select ename,sal from emp where deptno = 10;
  dbms_output.put_line('Department: 10');
  dbms_output.put_line('--------------');
  loop
      fetch c_emp into er;
      exit when c_emp%notfound;
      dbms_output.put_line(er.name || ' - ' || er.sal);
  end loop;
  close c_emp;
  open c_emp for select ename,sal from emp where deptno = 20;
  dbms_output.put_line('Department: 20');
  dbms_output.put_line('--------------');
  loop
      fetch c_emp into er;
      exit when c_emp%notfound;
      dbms_output.put_line(er.name || ' - ' || er.sal);
  end loop;
  close c_emp;
end;
In the above program, the skeleton looks like the following:
declare
.
.
Begin
.
.
  open c_emp for select ename,sal from emp where deptno = 10;
.
.
      fetch c_emp into er;
.
.
  close c_emp;
.
.
  open c_emp for select ename,sal from emp where deptno = 20;
.
.
      fetch c_emp into er;
.
.
  close c_emp;
.
.
end;
From the above skeleton, you can easily understand that every CURSOR is opened, used and closed before opening
the same with the next SELECT statement.
Working with REF CURSOR inside loops
Sometimes, it may be necessary for us to work with REF CURSOR within loops.  Let us consider the following
example:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  type rec_emp is record
  (
    name  varchar2(20),
    sal   number(6)
  );
  er rec_emp;
begin
  for i in (select deptno,dname from dept)
  loop
    open c_emp for select ename,sal from emp where deptno = i.deptno;
    dbms_output.put_line(i.dname);
    dbms_output.put_line('--------------');
    loop
      fetch c_emp into er;
      exit when c_emp%notfound;
      dbms_output.put_line(er.name || ' - ' || er.sal);
    end loop;
    close c_emp; 
  end loop;
end;
As you can observe from the above program, I implemented a FOR loop as follows:
  for i in (select deptno,dname from dept)
  loop
      .
      .
  end loop;
The above loop iterates continuously for each row of the "dept" table.  The details of each row in "dept" (like deptno, dname etc.) will be available in the variable "i."  Using that variable (as part of the SELECT statement), I am working with REF CURSOR as follows:
    open c_emp for select ename,sal from emp where deptno = i.deptno;
The rest of the program is quite commonplace.
Sub-programs can also be called sub-routines.  These are nothing but the divisions of the main program.  These divisions are named and are executed when they are called by name from the main program.  They will not get executed unless they are called. 
The following is an example:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  type rec_emp is record
  (
    name  varchar2(20),
    sal   number(6)
  );
  er rec_emp;
  procedure PrintEmployeeDetails is
  begin
    loop
      fetch c_emp into er;
      exit when c_emp%notfound;
      dbms_output.put_line(er.name || ' - ' || er.sal);
    end loop;
  end;
begin
  for i in (select deptno,dname from dept)
  loop
    open c_emp for select ename,sal from emp where deptno = i.deptno;
    dbms_output.put_line(i.dname);
    dbms_output.put_line('--------------');
    PrintEmployeeDetails;
    close c_emp; 
  end loop;
end;
In the above program, the sub-routine is named "PrintEmployeeDetails."  You can observe that I am executing (or calling) the sub-routine from within the loop as follows:
  for i in (select deptno,dname from dept)
  loop
      .
      .
      PrintEmployeeDetails;
      .
      .
  end loop;
According to the above loop, the sub-routine gets executed for every iteration, which displays the employee
information for the respective department.  Passing REF CURSOR as parameters to sub-programs
In the previous section, we already started working with sub-programs (or sub-routines).  In this section, I
shall extend the same with the concept of "parameters" (or arguments).  Every sub-program (or sub-routine) can accept values passed to it in the form of "parameters" (or arguments).  Every parameter is very similar to a variable, but gets declared as part of a sub-program.
Let us consider the following program:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  type rec_emp is record
  (
    name  varchar2(20),
    sal   number(6)
  );
  procedure PrintEmployeeDetails(p_emp r_cursor) is
    er rec_emp;
  begin
    loop
      fetch p_emp into er;
      exit when p_emp%notfound;
      dbms_output.put_line(er.name || ' - ' || er.sal);
    end loop;
  end;
begin
  for i in (select deptno,dname from dept)
  loop
    open c_emp for select ename,sal from emp where deptno = i.deptno;
    dbms_output.put_line(i.dname);
    dbms_output.put_line('--------------');
    PrintEmployeeDetails(c_emp);
    close c_emp; 
  end loop;
end;
From the above program, you can observe the following declaration:
  procedure PrintEmployeeDetails(p_emp r_cursor) is
In the above declaration, "PrintEmployeeDetails" is the name of the sub-routine which accepts "p_emp" as a
parameter (of type "r_cursor") and we can use that parameter throughout that sub-routine.

Working with REF CURSOR in PL/SQL

SQL & PLSQL Interview Questions

1.    I want to write a function which inserts a row into a table and I want to get the rowid of the inserted row in the return statement. Is it feasible? Justif.
2.    I have 2 different databases. I don't have db links between them. I want to transfer the data from one database to the other. What will ou do?
3.    What is a materialized view? What is the refresh techniques used?
4.    If I have a MV which contains the data from different tables which are in different databases. Which approach (refresh) will be feasible for this scenario.
5.    Are you saying that MVs will store the local copy of the data?
6.    I have a partition P1 in which two more partitions are there P2 and P3. If I am exchanging data from one partition to the other, what will happen?
7.    In the above scenario, is it feasible to use global indexes or partition indexes?
8.    In a select query, will you write the joins and filter conditions in any specific order or we can write them in any order?
9.    How the sql SELECT will be parsed?
10.    How you will do the debugging in PLSQL
11.    I have a procedure running remotely. I want to see what is happening while its running. What is the method?
12.    What will you do in that log package which will log the errors?(PRAGMA AUTONOMOUS TRANSACTION)
13.    What are the new features of 9i/10g? 
14.    What is the representation of 'g' in 10g?
15.    What is the feature you like most in oracle plsql.
16.    What is explain plan? How you will analze the quer using explain plan?
17.    What is TKPROF? How you will use the TKPROF?
18.    Write down the steps to generate the trace file.
19.    How will You analze the trace file and how You will use the information in the trace file to tune the queries
20.    What are hints? Did you ever used hints? Name some hints you used.
21.    Unix - Learn
22.    Have you ever interacted with clients
23.    Have you been to onsite?
24.    What is an index? Types of indexes
25.    What do you mean b cardinality in bit map index
26.    When you issue the OPEN cursor command, will the data loaded into cursor already. If not when will it be loaded?
27.    What is a cursor? Types of cursors
28.    What is explain plan? 
29.    How you will tune the sql query?
30.    You did any certification? Is it valid now?
31.    What are the advantages and differences between a PACKAGE, PROCEDURE and a FUNCTION?
32.    Explain the oracle architecture.
33.    When will the DBwr writes the data into a DATA FILE?
34.    When will the REDO log buffer will be written b LGwn
35.    Have you done any data modeling? 
36.    What is normalization?
37.    What are the external tables?
38.    What are the aggregate functions you used?
39.    What are the analtical functions you used?
40.     I am writing a trigger in which I am inserting a value into a table and I am issuing SELECT COUNT(*) FROM the same table. What will happen?
41.    If I write the statement level trigger also, will this mutation happens?
42.    What is the possible solution for it?
43.    I have large amount of data. How will you load the data from other database to our database
44.    What is bulk collect and bulk insert? Explain with syntax.
45.    When I am inserting data using bulk insert, I got an exception. How will you continue the loop without aborting?
46.    How you do the exception handling while using bulk insert and bulk collect?
47.    What are plsql collections? 
48.    What are the things you will be having in a trace file? How you will analze and use this  information to tune your query?
49.    What is a trigger? How many no. of triggers we can write on a table?
50.    I have a table called CUSTOMER. Can I create the trigger with the same name
51.    So, If I can create the trigger with the same name means, the two objects are not stored in the same data page? Then where is the trigger stored?
52.    I have a scenario like, whenever I insert into a table with customer id, it should generate a new id and insert when an event occurs. How will you achieve this?
53.    I have a scenario like, I want to restrict the update of salary values like, one can increase the salary but one can't decrease the salary. How will you achieve this?
54.    Can we create triggers on views?
55.    What type of triggers can we create on views?
56.    Can we create a package specification without package body?
57.    Are the variables and other things declared in package spec are global?
58.    If I declare them in package body then are they global?
59.    Can you tell me some new plsql features of Oracle 10g?
60.    What is an inline view?
61.    What is a hierarchical query?
62.    What is dynamic sql?
63.    How you can execute the dynamic sql (Keyword used)
64.    What is a ref cursor?
65.    How many ways you can open a cursor?
66.    What are collections?
67.    How many collections are there in plsql?
68.    What is the difference between variable array and nested table?
69.    The arguments (parameters) in a procedure are of which type? Are they pass by value or pass by reference?
70.    What is bulk collect?
71.    What is returning into clause?
72.    What is NVL2?
73.    What is a foreign key constraint
74.    A: A FOREIGN KEY in one table points to a PRIMARY KEY in another table.
75.    Did you ever worked on ETL
A: ETL stands for extraction, transformation and loading. Etl is a process that involves the following tasks:
extracting data from source operational or archive systems which are the primary source of data for the data warehouse
transforming the data - which may involve cleaning, filtering, validating and applying business rules
loading the data into a data warehouse or any other database or application that houses data
The ETL process is also very often referred to as Data Integration process and ETL tool as a Data Integration platform.
The terms closely related to and managed by ETL processes are: data migration, data management, data cleansing, data synchronization and data consolidation.

The main goal of maintaining an ETL process in an organization is to migrate and transform data from the source OLTP systems to feed a data warehouse and form data marts.
76.    Did you ever involved in database design
77.    Did you ever did import and export in database
78.    What are the tools you use to access the database
79.    What is a materialized view
80.    Difference between simple view and materialized view
81.    Can we update a materialized view?
82.    What is the difference between function and procedure
83.    How do you do performance tuning
84.    What is SQL trace 
85.    What is TKPROF
86.    What is the structure of a procedure
87.    What is a cursor? How many types of cursors are there
88.    What is a constraint? How many constraints are there in oracle
89.    I have two tables crated. I want to define a foreign key constraint on one column of second table from the first table. What is the syntax to add a foreign key constraint to the existing table
90.    What is the maximum size of varchar2 in a table for a column
91.    If I want to store more than 4000 characters data then what should I do
92.    What is the maximum size of LONG data type in oracle
93.    I want to store an Image file which is very big in size. Which data type I need to use
94.    What is LOB? What are the types?
95.    What can I store in a BLOB?