Wednesday, May 28, 2014

Difference between Table MOVE and Table SHRINK

Move:  Moves the WaterMark for a segment, no change in no. of blocks
Shrink: Shrinks the segment, i.e. frees the unused blocks and extents.

Code:
SQL>
SQL> create table t ( x number )
  2  tablespace users
  3  storage ( initial 10M next 10M )
  4  /

Table created.

SQL> analyze table t compute statistics;

Table analyzed.

SQL> select blocks, extents from user_segments where segment_name = 'T';

    BLOCKS    EXTENTS
---------- ----------
      1280         10

SQL> select blocks, empty_blocks from user_tables where table_name = 'T';

    BLOCKS EMPTY_BLOCKS
---------- ------------
         0         1280
So, I started creating a table named T and requested initially 10mb allocated, which turned out to be 1280 blocks and 10 extents. From there you can see:
- table T has 1280 blocks allocated (blocks in user_segment)
- none of which are *formatted* to receive data (blocks in user_tables)

Then, I insert some data
Code:
SQL> insert into t
  2  select rownum
  3    from dual
  4  connect by level <= 100000;

100000 rows created.

SQL> analyze table t compute statistics;

Table analyzed.

SQL> select blocks, extents from user_segments where segment_name = 'T';

    BLOCKS    EXTENTS
---------- ----------
      1280         10

SQL> select blocks, empty_blocks from user_tables where table_name = 'T';

    BLOCKS EMPTY_BLOCKS
---------- ------------
       186         1094
I inserted 100,000 rows, from there you can see:
- allocated blocks/extents for the table did not change
- however, blocks formated to receive data were raised by 186 and the remaining blocks are empty

186 blocks are the HWM now, because those are the blocks that sometime were formatted to receive data. Blocks above 186 are allocated blocks which have never been formatted to receive data.

I will delete some data now to show you it will not raise empty_blocks nor it will lower the blocks that are formatted to receive data (that is, the HWM).
Code:
SQL> delete from t where rownum <= 90000;

90000 rows deleted.

SQL> analyze table t compute statistics;

Table analyzed.

SQL> select blocks, empty_blocks from user_tables where table_name = 'T';

    BLOCKS EMPTY_BLOCKS
---------- ------------
       186         1094
See, the delete did nothing to change the HWM, but..
Code:
SQL> select count(distinct dbms_rowid.rowid_block_number(rowid)) used_blocks from t;

USED_BLOCKS
-----------
         16
tells me only 16 of those 186 contains data. The rest blocks belong to the segment's freelist to be used for inserts/updates.

Now, I will *move* the table to show you how it will re-adjust the HWM.
Code:
SQL> alter table t move tablespace users;

Table altered.

SQL> analyze table t compute statistics;

Table analyzed.

SQL> select blocks, empty_blocks from user_tables where table_name = 'T';

    BLOCKS EMPTY_BLOCKS
---------- ------------
        20         1260
See, it shrinked down the HWM to just 20 from 86 and raised the empty_blocks, but..
Code:
SQL> select blocks, extents from user_segments where segment_name = 'T';

    BLOCKS    EXTENTS
---------- ----------
      1280         10
tells you it did nothing to *shrink* the allocated space asigned to the segment, meaning that at this stage the segment will still be using, at the operating system level, the same kind of storage. Now, to *reclaim* that space we will use shrink.
Code:
SQL> alter table t enable row movement;

Table altered.

SQL> alter table t shrink space;

Table altered.

SQL> analyze table t compute statistics;

Table analyzed.

SQL> select blocks, extents from user_segments where segment_name = 'T';

    BLOCKS    EXTENTS
---------- ----------
       128          1

SQL> select blocks, empty_blocks from user_tables where table_name = 'T';

    BLOCKS EMPTY_BLOCKS
---------- ------------
        20          108

SQL>
There, you see the table actually shrinked down from 1280 blocks allocated and 10 extents, to its minimum, 128 blocks and just 1 extent

Tuesday, May 27, 2014

How To Clear Caches (Apache/iAS, Cabo, Modplsql, Browser, Jinitiator, Java, Portal, WebADI) for E-Business Suite?



Apache / iAS 
For 11i and earlier versions:
- shutdown iAS server
- go to $OA_HTML (for 11.5.9) or $COMMON_TOP (for 11.5.10.x) directory
- backup the directory _pages and delete its contents by running for instance:

  rm -rf $COMMON_TOP/_pages/*

- for modplsql caches remove contents of  $IAS_ORACLE_HOME/Apache/modplsql/cache directory
- restart iAS server


To clear middle tier cache in release 12:

- go to "Functional Administrator" responsibility
- select Core Services => Caching Framework => Global Configuration => Clear cache
(please review Note 759038.1 for details).

In case you have login issue after accidentally cleared the _pages instead of using the method above for r12
please review Note 433386.1 to recompile jsp files.

Cabo
Images and style sheets can be corrupted or out of sync in the cabo caches,
you may need to clear the related directories after backup:

$OA_HTML/cabo/images/cache
$OA_HTML/cabo/styles/cache


Web Browser


for Internet Explorer:
- go to menu Tools => Internet Options,
- select 'General' tab,
- click on button 'Delete Files' in 'Temporary Internet files' area
  or
- click on button 'Delete...' then in 'Delete Browsing History' pop-up window click on 'Delete Files...'
- close all IE windows and restart new browser session.

for Mozilla Firefox:
- go to menu Tools
- select 'Clear Private Data...' or 'Clear Recent History...' then check 'Cache'
  or
- go to menu Edit or Tools
- select Preferences or Options.
- expand the 'Advance' options and choose 'Cache' or Privacy
- click the button called 'Clear Cache'.

for Safari:
- go to Safari menu
- select Empty Cache => Click 'Empty' in the dialogue box

for Netscape:
- go to menu Edit => Preferences,
- choose 'Cache' in 'Advanced' category,
- click on buttons 'Clear Memory Cache' and 'Clear Disk Cache'.
- close all Netscape windows and restart new browser session.

Jinitiator

Two possibilities depending of the Jinitiator version:

for 1.1.8.x versions:- delete all files in directory:

C:\Program Files\Oracle\Jinitiator <version>\jcache\

for 1.3.1.x versions:
- go to Start => Parameters => Control Panel
- double-click on "Jinitiator <version>" icon
- in the new pop-up window, click on "Cache" tab
- click on "Clear Jar Cache " button. On prompt, click Yes.

(you can also delete directly all files under directory:
C:\Documents and Settings\<your user name>\Oracle Jar Cache)


Java

Java/JRE plug-in (Windows)- go to Start => Parameters => Control Panel
- double-click on 'Java' icon
- in the new pop-up window, click on 'General' tab
- click on 'Setting...' button in 'Temporary Internet files' area then click on 'Delete Files...' button
  (you can select Applets, Applications or other files)

JVM

- go to responsibility "Functional Administrator"
- click on "Core Services" tab then the "Caching Framework" sub-tab
- click on "Global Configuration" link then click on "Clear all cache" button to clear all of the Java Cache's


Portal
- go to the url: http://<host.domain>:<port>/pls/admin_/gateway.htm or cache.htm
- click on "Cache Settings" option and note the "Cache Directory"
- go to this directory and delete all the cache files in the directory and sub directories

See also modplsql caches in Apache/iAS section above.


WebADI / BNE cache
For instance when enabling BNE log
- go to url: http://<host.domain>:<port>/oa_servlets/oracle.apps.bne.framework.BneAdminServlet
- click on the "clear-cache" link
- at the bottom of the page you should see 'Cache Cleared'



Oracle Application Server OAS

All about Oracle Application Server:

http://applicationsdba.blogspot.com/2008/01/r12-ebiz-and-application-server-10g.html

Oracle Application Server with Oracle E-Business Suite Release 12 FAQ (Doc ID 415007.1)


Thursday, May 22, 2014

Wednesday, May 21, 2014

Oracle online learning


 Oracle Specializations:

https://competencycenter.oracle.com/opncc/glp_list.cc

PreSales:EBS
https://competencycenter.oracle.com/opncc/full_glp.cc?group_id=9844

Sales:EBS
https://competencycenter.oracle.com/opncc/full_glp.cc?group_id=9824