Thursday, August 23, 2012

How to unlock the Super User Account on OAS 10g (on Windows server) ?


Question :
How to unlock the Super User Account on OAS 10g (Windows server) ?

Answer:
Connect to OAS server
from Oracle home directory issue following statement:

oidpasswd connect='oas db name' unlock_su_acct=true

where 'oas db name' is OAS'es database name

Change super user's password by :
log-in to Oracle Directory Manager

go to

Entry Management >> dc=domain >> dc=company >> cn=users >> cn='super user' >> properties >> orclpassword

Oracle AS 10g : how to change schema account from EXPIRED(GRACE) to OPEN ?


Question :
Oracle AS 10g : how to change schema account from EXPIRED(GRACE) to OPEN ?

Answer :
1. find all users with account status equals EXPIRED(GRACE) 
  SELECT s.username,
        s.password
    FROM dba_users s
   WHERE s.account_status LIKE '%GRACE%'
     AND s.account_status NOT LIKE '%LOCKED%'

2. Using values from previous select statement, issue following commands for each user:

alter user username profile DEFAULT;
alter user username identified by values 'password'

BEGIN
  FOR u_rec IN (SELECT s.username,
                       s.password
                  FROM dba_users s
                 WHERE s.account_status LIKE '%GRACE%'
                   AND s.account_status NOT LIKE '%LOCKED%')
  LOOP
    EXECUTE immediate 'alter user '||u_rec.username||' profile DEFAULT';
    EXECUTE immediate 'alter user '||u_rec.username||' IDENTIFIED BY VALUES '''|| u_rec.password ||'''';
  END LOOP;
END;

REP-56048 When Generating Large PDF Using Font Subsetting And UTF8 Character Set


Generating a PDF file from a large report, causes engine crash:

REP-56048: Engine rwEng-0 crashed job id xxThe issue occurs in the following environment:

1.Server Platform : Microsoft Windows Server 2003 
2.Oracle Reports 10.1.2.3 
3.PDF font subsetting is used 
4.NLS_LANG=_.UTF8 
Checking the option "Install files for complex script and right-to-left language" in Regional and Language Options > Languages does not help

Trying different values for jvmOptions does not help:

-Xmx512M -Xms128M -Xss512k 
-Xmx1024M -Xms128M -Xss512k 
......

When PDF subsetting is commented out, the issue does not reproduce. 
When using different NLS_LANG rather UTF8, the issue does not reproduce.

Cause
Bug 7133555 - REPORTS SERVER(ENGINE) HANGS WHEN RUNNING PDF REPORT WITH MANY PAGES ON WIN2003

Solution
Download and Apply one-off Patch 7133555 on top of reports 10.1.2.3


Source : Oracle Metalink: Doc ID 888222.1

PDF Report Output Fails with REP-56048 when Using a GIF Image


Running a PDF report that includes a GIF image file in the layout model and using the Oracle Reports parameter "outputimageformat=gif" is causing the report engine to crash and the following error is being displayed:

REP-56048: Engine rwEng-0 crashed., job Id

Cause
GIF Image format file not being recognized or is corrupted. 

Solution
If the original GIF image file is available, then open it with an Image Editor and save it as JPG image format file and then replace the GIF image in the report definition file with the new JPG image format one.

If the original GIF image file is not available, then following steps can be done to retrieve the image from the original report and then save it as JPG image format.

1.Open the report in Reports Builder.
2.Go to Paper Layout where you can see the image.
3.Type on keyboard shift+PrtScn.
4.Open mspaint.exe (Microsoft Paint - Windows Image Editor).
5.Paste the screenshot from step 3 with ctrl+v.
6.Select the image area and do ctrl+c.
7.Open a new mspaint.exe and do ctrl+v and resize image if needed.
8.Save the image as JPG format.
9.Now you can insert the new image in your report to replace the GIF one.


Source : ORacle Metalink Doc ID: 987009.1

Executing a Query in Forms 10g Fails With Frm-41838 Unable To Open Temporary Record File


A query executed in a Forms application fails giving the following error:

FRM-41838 Unable to open temporary record file

Cause

Oracle Forms tries to create a temporary file if a query is issued and the number of records returned exceeds the block property 'Records Buffered' value. When using OracleAS Forms Services, the temporary file will be written by default to the directory specified for the TMP variable in:

$ORACLE_HOME/opmn/conf/opmn.xml.

If this directory does not exist, has insufficient space or has restricted read / write privileges the FRM-41838 error can occur.
Solution

Solution A:

1. Edit the Forms Listener Servlet env file. This will be the file referenced by the formsweb.cfg applet parameter envFile. By default, envFile = default.env, default.env is located in $ORACLE_HOME/forms90/server or in $ORACLE_HOME/forms/server

2. Add the line e.g.

TMP=/tmp

(assuming that the directory specified e.g. /tmp has sufficient space and read/write privileges)

3. Stop and restart the OC4J_BI_Forms component for the change to take effect

Solution B:

Change the value for the TMP variable setting in opmn.xml by following all the steps below:

1. Edit $ORACLE_HOME/opmn/conf/opmn.xml where $ORACLE_HOME corresponds to the Oracle Application Server middle tier home (BI & Forms)

2. Look for the line e.g. on Unix

3. Check that the directory specified exists, has sufficient space and read/write privileges. If necessary, change the TMP value e.g.

4. If the directory has been changed in opmn.xml, stop and restart all the middle tier components for the change to take effect.

Source : Oracle Metalink Doc ID: 304004.1

Wednesday, August 22, 2012

How to Automate Splitting OC4J log Files for Web Sites (default-web-access.log)


How to Automate Splitting OC4J log Files for Web Sites (default-web-access.log) [ID 764085.1]

Applies to:
Oracle Containers for J2EE - Version: 10.1.3.0.0 to 10.1.3.4.0
Oracle Containers for J2EE - Version: 10.1.2.0.0 to 10.1.2.3.0

Goal
How to automate log file splitting on text-based OC4J log file default-web-access.log located in $ORACLE_HOME/j2ee//log/_default_group_1 in Oracle Application Server based on period of time?

Solution
To automate log file splitting on default-web-access.log, add the "split" attribute to element in $ORACLE_HOME/j2ee//config/default-web-site.xml

This "split" attribute specifies how often to begin a new access log, supported values are "none" (equivalent to "never", which is the default), "hour", "day", "week", and "month".

To implement this solution:

1. Change the following line in default-web-site.xml
<access-log path="../log/default-web-access.log"/> 

to:
<access-log path="../log/default-web-access.log" split="week"/>

2. OC4J instance restart is required for these changes to take effect.
$ORACLE_HOME/opmn/bin/opmnctl stopproc process-type=home
$ORACLE_HOME/opmn/bin/opmnctl startproc process-type=home

Source : Oracle Metalink Doc Id: 764085.1

Limit the Size of the default-web-access.log


Applies to: Oracle Application Server 10g Enterprise Edition - Version: 10.1.2.0.0

Out of the box, the default-web-access.log will continue to grow until it is removed.

The default-web-site.xml file can be modified to allow for the logs to be cycled automatically and prevent default-web-access.log from growing too large and exhausting the disk storage.

Solution

To allow for the default-web-access.log file to be automatically cycled add the "split" variable to the default-web-site.xml logging parameter.

split: Specifies how often to begin a new access log. Supported values are "none" (never, which is the default), "hour", "day", "week", or "month". For a value other than "none", logs are named according to the suffix attribute. NOTE: the values are case sensitive and must be contained within double quotes. The suffix attribute is not needed if default naming is acceptable.

To make the change, change the final line in your default-web-site.xml

From:
access-log path="../log/default-web-access.log" /

to
access-log path="../log/default-web-access.log" split ="week"/

Note: all greater than and less than symbols have been removed in the example. Please be sure to leave them intact in the file mentioned.

This change will cause a new file to be created each week for the default-web-access.log. Old files can be removed from the directory and archived. Feel free to use the "month" parameter instead, if this meets your needs.

Source : Oracle Metalink Doc ID 572213.1

Opmnctl Startall fails with Failed To Start a Process Because A Dependency Check Failed


OID is not running or unavailable

Subject: opmnctl Startall fails with Failed To Start a Process Because A Dependency Check Failed

Cause

A midtier attached to an infrastructure has by default the dependency of OID declared in opmn.xml, but it can be removed without any risk if OID is not used by these OC4J instances.

The OID dependency is just needed if JAZN-LDAP or SSO authentication methods have been setup.

Solution
-- To implement the solution, please execute the following steps::

1) Backup the file $ORACLE_HOME/opmn/conf/opmn.xml
2) Edit $ORACLE_HOME/opmn/conf/opmn.xml and locate the lines:


<ias-component id="OC4J">
<dependencies>
<OID infrastructure="true"/>
</dependencies>
<process-type id="home" module-id="OC4J" status="disabled">
<module-data>
<category id="start-parameters">


3) Remove the lines:


<dependencies>
<OID infrastructure="true"/>
</dependencies&gt


i.e. the section will become:

<ias-component id="OC4J">

<process-type id="home" module-id="OC4J" status="disabled">
<module-data>
<category id="start-parameters">;


4) Save the file
5) Run the commands:

$ORACLE_HOME/opmn/bin/opmnctl stopall
$ORACLE_HOME/opmn/bin/opmnctl startall

Source : Oracle Metalink Doc ID: Note:401882.1

Monday, April 2, 2012

ORA 4021 - time-out occurred while waiting to lock object


Problem Description
-------------------

Trying to recreate a package, procedure or function (CREATE OR REPLACE ...) or dropping a the same (DROP PACKAGE ...) causes the application to hang (ie: SQL*Plus hangs after submitting the statement). Eventually ORA-4021 errors occur after the timeout (usually 5 minutes).

Solution Description

Verify that the package is not locked by another user by selecting from V$ACCESS view.  To do this, run:

SELECT * FROM v$access WHERE object = '';

Where is the package name (usually in all uppercase).  If there is a row returned, then the package is already locked and cannot be dropped until the lock is released.  Returned from  he query above will be the SID that has this locked. You can then use this to find out which session has obtained the lock.

In some cases, that session might have been killed and will not show up.  If this happens, the lock will not be release immediately.  Waiting for PMON to clean up the lock might take some time. The fastest way to clean up the lock is to recycle the database instance.

If an ORA-4021 error is not returned and the command continues to hang after issuing the CREATE OR REPLACE or DROP statment, you will need to do further analysis see where the hang is occuring. A starting point is to have a look in v$session_wait, see the referenced Note 61552.1 for how to analyze hang situations in general

Solution Explanation

Consider the following example:

Session 1:

create or replace procedure lockit(secs in number) as
shuttime date;
begin
shuttime := sysdate + secs/(24*60*60);
while sysdate <= shuttime loop
null;
end loop;
end;
/
show err

begin
-- wait 10 minutes
lockit(600);
end;
/

Session 2:

SQL> create or replace procedure ops$hnapel.lockit as
2  begin
3     null;
4  end;
5  /

Result: hang and eventually (the timeout is 5 minutes):

create or replace procedure ops$hnapel.lockit as
*
ERROR at line 1:
ORA-04021: timeout occurred while waiting to lock object OPS$HNAPEL.LOCKIT

Session 3:

SQL> connect  / as sysdba
Connected.
SQL> col owner for a10
SQL> col object for a15
SQL> select * from v$access where object = 'LOCKIT';

SID OWNER      OBJECT          TYPE
---------- ---------- --------------- ------------------------
9 OPS$HNAPEL LOCKIT          PROCEDURE

SQL> select sid, event from v$session_wait;

SID EVENT
---------- ----------------------------------------------------------------
9 null event
...
12 library cache pin

As you can see, the blocking sid 9 waits for nothing while session 2, the hanging session, is waiting for event library cache pin.

Source : Oracle Metalink

Wednesday, March 7, 2012

Database Links: Troubleshooting ORA-2085 "database link %s connects to %s"


  
To explain database link naming rules in an effort to avoid the error ORA-2085 "database link %s connects to %s"

When the source database initialization parameter GLOBAL_NAMES is set to true, the database link name must match the target database global name as it exists in the GLOBAL_NAME view in the data dictionary.

The GLOBAL_NAME can be determined by logging in to the database with system privileges and issuing the following command:

SQL>Select * from global_name;

Additionally, if you do not specify the domain portion of the dblink name in the create statement, Oracle automatically qualifies the link name with the domain of the SOURCE database global name view.

Check the contents of ALL_DB_LINKS for the fully qualified link name.

For example, if you defined a database link in PROD.ORACLE.COM to connect to target instance TEST.WORLD.COM in the following manner:

SQL>Create public database link TEST connect to userid identified by password using test;

SQL>select * from tablename@TEST;

This select would yield the following error:

ORA-2085 "database link TEST.ORACLE.COM connects to TEST.WORLD.COM"

The correct syntax for defining the link would be:

SQL>Create public database link TEST.WORLD.COM connect to userid identified by password using test;

SQL>select * from tablename@TEST.WORLD.COM;

Would yield desired result.

It is possible to alter the GLOBAL_NAME table so that the domain portion of both SOURCE and TARGET global names are identical. This would eliminate the need to include the domain in the create database link statement.

In the above example, we could alter the GLOBAL_NAME of TEST.WORLD.COM in the following manner:

Login to TEST with system privileges and issue:

SQL>alter database rename global_name to TEST.ORACLE.COM;

Now, the create database link statement could also be changed.

Login to PROD.

SQL>create public database link TEST connect to userid identified by password using test;

A database link would be defined in ALL_DB_LINKS as TEST.ORACLE.COM.

SQL>select * from tablename@TEST;

This would yield the desired result.


Sunday, February 5, 2012

PDF Printing slovenian characters problem


PDF Printing slovenian characters problem :

http://www.dba-village.com/village/dvp_forum.OpenThread?ThreadIdA=11031

As I understand the limitation of reports 6i is due to the fact that Reports 6i has builtin support for an older PDF standard V1.1.

It's a documented limitation, see Metalink Note 222663.1.

"PDF output is only supported for latin 1 code pages (US7ASCII, WE8ISO8859P1 and WE8MSWIN1252). "

Tuesday, January 10, 2012

ORA-12154 ORA-12162 calling SQL*Loader / SQL*Plus


Problem Description 

Running SQL*Loader as: 

sqlload userid=... control=... data=... log=... 

HOSTSTR logical has been set to same value as your connection string but without domain name. 

When you have specified connect string (ie. SCOTT/TIGER@DATABASE) but no domain you receive these errors: 

SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0] 
ORA-12154: TNS:could not resolve service name 

When you have not specified connect string (ie. SCOTT/TIGER) you receive these errors: 

SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0] 
ORA-12162: TNS:service name is incorrectly specified 

Your sqlnet.ora has: 

names.default_domain entry = world 

The syntax in your tnsnames.ora entry is correct. 

Your entry in tnsnames.ora does not include the .WORLD extension (default domain from sqlnet.ora). 

Solution Description 

Specify the .WORLD in your tnsnames.ora and also in your connect string. This will remove the error. 

Also, ensure you are not hitting [BUG:893290].   

Source : Oracle Metalink Note:116852.1

Tuesday, December 20, 2011

ORA-00439 When Trying To Create Materialized View With Enable Query Rewrite


ORA-00439 When Trying To Create Materialized View With Enable Query Rewrite

1. When trying to create a materialized view in SQL*Plus an error is returned:

  CREATE MATERIALIZED VIEW store_sales_mv
  PCTFREE 0 TABLESPACE mviews
  STORAGE (INITIAL 16k NEXT 16k PCTINCREASE 0)
  PARALLEL
  BUILD DEFERRED
  REFRESH COMPLETE
  ENABLE QUERY REWRITE
  AS
  SELECT
   s.store_name,
   SUM(dollar_sales) AS sum_dollar_sales
   FROM store s, fact
   WHERE f.store_key = s.store_key
   GROUP BY s.store_name;

  ORA-00439: feature not enabled: %s
     Cause: The specified feature is not enabled.
     Action: Do not attempt to use this feature.

3. The ENABLE QUERY REWRITE option is removed from the above statement and the error goes away and the statement processes successfully.

Solution Description:

The proper options must be installed to use some features of the materialized views. The query 'select * from V$option' will show what options are installed. The options needed to use enable query rewrite and refresh capabilities are:

Parameter                                              Value
Materialized view rewrite                        TRUE     -> For ENABLE QUERY REWRITE
Materialized view warehouse refresh     TRUE     -> For REFRESH

In addition, the following initialization parameters must also be set:

QUERY_REWRITE_ENABLED = default is set to FALSE, can change to TRUE
QUERY_REWRITE_INTEGRITY = ENFORCED, STALE_TOLERATED, TRUSTED

Source : Oracle Metalink 

Wednesday, November 9, 2011

ORA-29540: class oracle/plsql/net/TCPConnection does not exist


Problem Description

When attempting to run the packages UTL_SMTP, and UTL_TCP, an error is returned indicating that the class oracle/plsql/net/TCPConnection does not exist.  This class, along with others that support SQLJ functionality, should normally be loaded when the "initjvm.sql" script is run. 
However, that script has already been run successfully, to completion.

ORA-29540: class oracle/plsql/net/TCPConnection does not exist

Solution Description

The initjvm.sql script (located in the ORACLE_HOME/javavm/install directory) is run automatically during normal installation of the database, except during custom installation.  In any event, thescript can be run manually (as SYS) at a later time. When this script is run, approximately 8000+ java classes are loaded into the database. 

Unfortunately, there is another script, initplsj.sql (located in ORACLE_HOME/rdbms/admin) which is supposed to be called by the initjvm.sql script. This does not occur. To fix the problem, runthe initplsj.sql script (as SYS).  You will note that 200+ classes get loaded into the database as a result of this script. 

This should then allow you to use the UTL_SMTP and UTL_TCP packages.

This script also needs to be run:

$ORACLE_HOME/javavm/install/init_security.sql

Source: Oracle Metalink

Monday, October 3, 2011

Oracle Reports background engine stopping


In Forms 6i when a report is run, a background process called Reports Background Engine is created. Sometimes we want  this process to be terminated automatically when a report is completed and we exit from report.

Here is the PL/SQL code for this:

DECLARE
  pl_id ParamList;
BEGIN
  pl_id := Create_Parameter_List('dummy');
  Add_Parameter(pl_id,'ORACLE_SHUTDOWN',TEXT_PARAMETER,'Yes');
  Add_Parameter(pl_id,'PARAMFORM',TEXT_PARAMETER,'NO');
  Run_product(REPORTS,'<>',SYNCHRONOUS,     RUNTIME,FILESYSTEM,pl_id,NULL);
END;

Wednesday, September 21, 2011

How to Use ROLLUP and CUBE Operators in a GROUP BY Operation


The ROLLUP operator can be used in a the GROUP BY clause of a SELECT statement to group the selected rows based on the values of expressions, thus returning a single row summary for each group.  Thus, a SELECT statement using the ROLLUP operator returns both 'regular rows' and 'super-aggregate rows'.  Super-aggregate rows are rows that are derived by applying the same set of function(s) that were used to obtain the grouped rows.  In other words, super-aggregate rows contain sub-total values. 

The CUBE operator can be used to produce cross-tabulation values, thus produces totals in all possible dimensions. Thus CUBE produces both the line item totals (which can be produced by ROLLUP) in addition to column totals. 

A NULL value in a super-aggregate row represents 'all values'.  The GROUPING() function can be used to distinguish between a singular row with a null value in a column and a null value that represents the set of all values.  The expression in GROUPING() must match one of the expressions in the GROUP BY clause. GROUPING() returns 1 only if the value of expr in the row is a null representing the set of all values, else a 0 (zero) is returned.  

ROLLUP and CUBE operators can both be used in CREATE MATERIALIZED VIEW. 

The examples are based on the following table and data: 

SQL> desc test 
 Name                 Null?    Type 
 --------------------------------------- 
 YEAR                          NUMBER(4) 
 REGION                        CHAR(7) 
 DEPT                          CHAR(2) 
 PROFIT                        NUMBER 

SQL> select * from test; 

      YEAR REGION  DE     PROFIT 
---------- ------- -- ---------- 
      1995 West    A1        100 
      1995 West    A2        100 
      1996 West    A1        100 
      1996 West    A2        100 
      1995 Central A1        100 
      1995 East    A1        100 
      1995 East    A2        100 

7 rows selected. 

Example 1: ROLLUP 

SQL> select year, region, sum(profit), count(*) 
  2  from test 
  3  group by rollup(year, region); 

      YEAR REGION  SUM(PROFIT)   COUNT(*) 
---------- ------- ----------- ---------- 
      1995 Central         100          1 
      1995 East            200          2 
      1995 West            200          2 
      1995                 500          5 
      1996 West            200          2 
      1996                 200          2 
                           700          7 

7 rows selected. 


A summary of the above information in tabular form: 

Year Central(A1+A2)  East(A1+A2)  West(A1+A2)      
1995 (100+NULL)      (100+100)    (100+100)    500 
1996 (NULL+NULL)     (NULL+NULL)  (100+100)    200 
                                               700 


Example 2: ROLLUP and GROUPING() 

SQL> select year, region, sum(profit), 
  2         grouping(year) "Y", grouping(region) "R" 
  3  from test 
  4  group by rollup (year, region); 

      YEAR REGION  SUM(PROFIT)          Y          R 
---------- ------- ----------- ---------- ---------- 
      1995 Central         100          0          0 
      1995 East            200          0          0 
      1995 West            200          0          0 
      1995                 500          0          1 
      1996 West            200          0          0 
      1996                 200          0          1 
                           700          1          1 

7 rows selected. 

Note, GROUPING(expr) function returns 1 for super-aggregate rows if the null value for expr represents the set of all values.  


Example 3: CUBE 

SQL> select year, region, sum(profit), count(*) 
  2  from test 
  3  group by cube(year, region); 

      YEAR REGION  SUM(PROFIT)   COUNT(*) 
---------- ------- ----------- ---------- 
      1995 Central         100          1 
      1995 East            200          2 
      1995 West            200          2 
      1995                 500          5 
      1996 West            200          2 
      1996                 200          2 
           Central         100          1 
           East            200          2 
           West            400          4 
                           700          7 

Thus, in addition to the subtotals produced by ROLLUP, the CUBE operator  
completes all possible entries in a crosstab report. 

A summary of the above information in tabular form: 

Year Central(A1+A2)  East(A1+A2)  West(A1+A2)      
1995 (100+NULL)      (100+100)    (100+100)    500 
1996 (NULL+NULL)     (NULL+NULL)  (100+100)    200 
      100             200          400         700 


Example 4: CUBE and GROUPING() 

SQL> select year, region, sum(profit), 
  2         grouping(year) "Y", grouping(region) "R" 
  3  from test 
  4  group by cube (year, region); 

      YEAR REGION  SUM(PROFIT)          Y          R 
---------- ------- ----------- ---------- ---------- 
      1995 Central         100          0          0 
      1995 East            200          0          0 
      1995 West            200          0          0 
      1995                 500          0          1 
      1996 West            200          0          0 
      1996                 200          0          1 
           Central         100          1          0 
           East            200          1          0 
           West            400          1          0 
                           700          1          1 

10 rows selected. 

Note, GROUPING(expr) function returns 1 for super-aggregate rows if the null  
value for expr represents the set of all values.  

Important: 

The GROUP BY clause must contain all SELECT expressions that are not group function arguments or an ORA-979 (not a GROUP BY expression) will results.  

GROUPING(expr) will result in an ORA-909 (invalid number of arguments) if greater than one expression specified. 

Source : Oracle Metalink

Thursday, November 25, 2010

Index skip scan hint explained


Index skip scan Hint Usage

 
Index skip scans improve index scans by nonprefix columns since it is often faster to scan index blocks than scanning table data blocks.
 
In this case a composite index is split logically into smaller subindexes. The number of logical subindexes depends on the cardinality of the initial column. Hence it is now possible to use the index even if the leading column is not used in a where clause.
 
Example:

SQL> create table t1(a number,b number);

Table created.

SQL> begin 
  2  for i in 1..1000
  3  loop
  4  insert into t1 values(i, 56);
  5  end loop;
  6  end;
  7  /

PL/SQL procedure successfully completed.

SQL> create index t1_i on t1(a,b);

Index created.

SQL> analyze table t1 compute statistics;

Table analyzed.

SQL> explain plan for select /*+ index_ss(t1 t1_i) */ * from t1 where b=56;

Explained.

SQL> start ?\rdbms\admin\utlxpls.sql

-----------------------------------------------------------------
| Operation  |  Name    |  Rows | Bytes|  Cost  | Pstart| Pstop |
-----------------------------------------------------------------
| SELECT STATEMENT      |     1K|    4K|   1001 |       |       |
|   INDEX SKIP SCAN T1_I|     1K|    4K|   1001 |       |       |-----------------------------------------------------------------

Tuesday, November 9, 2010

Compiling all the Forms and Reports modules residing in a directory



For Windows

Forms/Reports 6i

REM WINDOWS COMPILE FORMS 
::compile_forms.bat 
cls 
Echo compiling Forms....
for %%f IN (*.fmb) do ifcmp60 userid=scott/tiger@v817  module=%%f batch=yes 
    module_type=form compile_all=yes window_state=minimize 
ECHO FINISHED COMPILING 

REM WINDOWS COMPILE REPORT 
::compile_report.bat 
cls 
Echo compiling Report .....
for %%f IN (*.rdf) do RWCON60 userid=scott/tiger@v817 batch=yes source=%%f 
    stype=rdffile DTYPE=REPFILE  OVERWRITE=yes  logfile=log.txt
ECHO FINISHED COMPILING
Forms/Reports 9.0.X

REM WINDOWS COMPILE FORMS 
::compile_forms.bat 
cls 
Echo compiling Forms....
for %%f IN (*.fmb) do ifcmp90 userid=scott/tiger@v817  module=%%f batch=yes 
    module_type=form compile_all=yes window_state=minimize 
ECHO FINISHED COMPILING 

REM WINDOWS COMPILE REPORT 
::compile_report.bat 
cls 
Echo compiling Report .....
for %%f IN (*.rdf) do rwconverter userid=scott/tiger@v817 batch=yes 
    source=%%f stype=rdffile DTYPE=REPFILE  OVERWRITE=yes  logfile=log.txt
ECHO FINISHED COMPILING
For UNIX

Forms/Reports 6i

#UNIX Forms Compile 
#compile_forms.sh 
for i in `ls *.fmb`
do
echo Compiling Form $i ....
f60genm userid=scott/tiger@bs817 batch=yes module=$i module_type=form 
    compile_all=yes window_state=minimize
done

#UNIX COMPILE REPORTS
#compile_rep.sh
for i  in `ls  *.rdf`
do
echo Compiling Report $i  ...
rwcon60 userid=scott/tiger@bs817 batch=yes source=$i  stype=rdffile 
    dtype=repfile overwrite=yes
done
Forms/Reports 9.0.X

#UNIX Forms Compile 
#compile_forms.sh 
for i in `ls *.fmb`
do
echo Compiling Form $i ....
f90genm userid=scott/tiger@bs817 batch=yes module=$i module_type=form 
    compile_all=yes window_state=minimize
done

( For 10g = forms 9.0.4.x, you can use f90gen also)

#UNIX COMPILE REPORTS
#compile_rep.sh
for i  in `ls  *.rdf`
do
echo Compiling Report $i  ...
rwconverter.sh userid=scott/tiger@bs817 batch=yes source=$i  
    stype=rdffile dtype=repfile overwrite=yes
done

Tuesday, October 12, 2010

At which situation IN is better than EXIST ?



Well, the two are processed very differently

Select * from T1 where x in ( select y from T2 )

is typically processed as:

select * 
  from t1, ( select distinct y from t2 ) t2
 where t1.x = t2.y;

Sub query is evaluated, distinct'ed, indexed (or hashed or sorted) and then joined to the original table - typically.

As opposed to:

select * from t1 where exists (select null from t2 where y = x)

That is processed more like:

   for x in (select * from t1)
   loop
      if (exists (select null from t2 where y = x.x)
      then 
         OUTPUT THE RECORD
      end if
   end loop

It always results in a full scan of T1 whereas the first query can make use of an index on T1(x).

So, when is where exists appropriate and in appropriate?  Lets say the result of the sub query:

    (select y from T2)

is "huge" and takes a long time.  But the table T1 is relatively small and executing ( select null from t2 where y = x.x ) is very very fast (nice index on t2(y)).  Then the exists will be faster as the time to full scan T1 and do the index probe into T2 could be less then the time to simply full scan T2 to build the subquery we need to distinct on.

Let’s say the result of the sub query is small -- then IN is typically more appropriate.

If both the sub query and the outer table are huge -- either might work as well as the other -- depends on the indexes and other factors.

The ROT (rule of thumb) here is :

BIG outer query and SMALL inner query = IN. SMALL outer query and BIG inner query = WHERE EXISTS.