Issues Using Oracle Database File System (DBFS) 12c in Oracle Linux 7

APPLIES TO:

Oracle Database 12c Standard Edition 2 and Enterprise Edition: 12.1.0.2.0, 12.2.0.1.0

Oracle Database Linux Server 7.2, 7.3

ISSUE 1: Missing libfuse.so

When running

$ dbfs_client dbfs_user@pdb1 /mnt/dbfs

Got error:

Fail to load library libfuse.so.

A dynamic linking error occurred: (libfuse.so: cannot open shared object file: No such file or director

SOLUTION

# cd /usr/lib64

# ln -s libfuse.so.2 libfuse.so

# ldconfig

# ldconfig -p | grep fuse

REFERENCES

  • Debugging problems when mounting a DBFS filesystem

http://www.hhutzler.de/blog/debugging-prolbems-when-mounting-a-dbfs/

ISSUE 2: 401 Unauthorized

401 Unauthorized is faced when running https://username:password@machine:port/dbfs

SOLUTION

Change the authentication to Basic execute

SET SERVEROUTPUT ON

DECLARE

l_configxml XMLTYPE;

l_value VARCHAR2(6) := ‘basic’; — (basic/digest)

BEGIN

l_configxml := DBMS_XDB.cfg_get();

IF l_configxml.existsNode(‘/xdbconfig/sysconfig/protocolconfig/httpconfig/authentication/allow-mechanism’) = 0 THEN

— Element should not be missing

dbms_output.put_line (‘ allow-mechanism element is missing ‘);

ELSE

— Update existing element.

SELECT updateXML

(

DBMS_XDB.cfg_get(),

‘/xdbconfig/sysconfig/protocolconfig/httpconfig/authentication/allow-mechanism/text()’,

l_value,

‘xmlns=”http://xmlns.oracle.com/xdb/xdbconfig.xsd”‘

)

INTO l_configxml

FROM dual;

DBMS_OUTPUT.put_line(‘Element updated.’);

END IF;

DBMS_XDB.cfg_update(l_configxml);

DBMS_XDB.cfg_refresh;

END;

/

COMMIT;

 REFERENCES

  • 12c XDB: 401 Unauthorized (Doc ID 1603713.1)
  • Oracle Database File System (DBFS) Enhancements in Oracle Database 12c Release 1 (12.1)

https://oracle-base.com/articles/12c/dbfs-enhancements-12cr1

ISSUE 3: get_dbfs_link/set_dbfs_link API

It looks like the APIs are not accurate in:

SOLUTION

/*

CREATE TABLE TEST_FILE

(

FILE_LOB           BLOB,

FILE_NAME          VARCHAR2(100 CHAR),

FILE_MIMETYPE      VARCHAR2(100 CHAR)

)

*/

—  update blob with dbfs link

DECLARE

blob1   BLOB;

BEGIN

UPDATE test_file

SET file_lob = EMPTY_BLOB ()

WHERE file_name = ‘y’;

SELECT file_lob

INTO blob1

FROM test_file

WHERE file_name = ‘y’

FOR UPDATE;

DBMS_LOB.set_DBFS_LINK (blob1, ‘/staging_area/test.jpg’);

COMMIT;

END;

— get dbfs link

— one row only, getting error when returning more rows

SELECT t.*, DBMS_LOB.GET_DBFS_LINK (t.file_lob)

FROM test_file t

WHERE ROWNUM = 1;

Installing Oracle Database 12c on Oracle Linux 7.3

This article describes the steps to install Oracle Database 12c Enterprise Edition Release 12.1.0.2 on Oracle Linux Server 7 Update 3.

  • 1. Create a Virtual Machine

    I have built an Oracle Linux Sever 7 update 3 VirtualBox virtual machine, details are in:

    https://orasunblog.wordpress.com/2016/11/11/installing-oracle-linux-server-7-3-using-virtualbox/

    I cloned a new virtual machine and change the hostname and IP address using the NetworkManager text user interface (TUI) tool:

    # nmtui

  • 2. Install Oracle Pre-installation RPM

    Oracle preinstall RPM package can simplify the installation of Oracle Database, which automatically performs a number of tasks, such as installing required software packages, resolving package dependencies, and modifying kernel parameters.

    The packages are accessible from Oracle public yum repository.

    • Enable YUM channels

      Review and modify /etc/yum.repos.d/public-yum-ol7.repo, make sure the following channels are enabled.

      [ol7_latest]
      enabled=1
      
      [ol7_UEKR4]
      enabled=1
      
      [ol7_addons]
      enabled=1
    •  Install Oracle preinstall package
    # yum install oracle-rdbms-server-12cR1-preinstall.x86_64
    • Set password for user oracle
      # passwd oracle 
    •  Create directories
      # mkdir -p /u01/app/oracle
      # mkdir -p /u02/oradata
      # mkdir -p /u03/fra
      # chown -R oracle:oinstall /u01
      # chown -R oracle:oinstall /u02
      # chown -R oracle:oinstall /u03
       Add user oracle to vboxsf group
      # usermod -aG vboxsf oracl

      Set a shared folder to share the downloaded Oracle database software between VirtualBox host and guest.

    • 3. Run Oracle runInstaller

      Run as user oracle to install software only, Oracle database software files can be accessed from the share folder /media/sf_ora12c in this case.

      $ /media/sf_ora12c/database/runInstaller
    • 4. Create a Listener
      $ cd /u01/app/oracle/product/12.1.0/dbhome_1/bin
      $ ./netca
    • 5. Run dbca to create a database instance
      $ cd /u01/app/oracle/product/12.1.0/dbhome_1/bin
      $ ./dbca

      Step 1: click Next


      Step 2: Select advanced mode


      Step 3: Click Next


      Step 4: Check “Create As Container Database”, enter CDB name and PDB name


      Step 5: Click Next


      Step 6: Set password, click Next


      Step 7: Select listener, click Next


      Step 8: Set location for database files, click Next


      Step 9: Check “Sample Schemas” or not, click Next


      Step 10: Go to “Character Sets” tab, select “Use Unicode(AL32UTF8)”, click Next


      Step 11: Click Next


      Step 12: Click Finish


      Step 13: Congrtulation!


    • 6. Starting & Stopping Oracle Database 12c
      • Stopping Oracle Database
      $ . oraenv
      ORACLE_SID = [oracle] ? cdb

      $ sqlplus / as sysdba

      SQL> shutdown immediate
      SQL> exit

      $ lsnrctl stop

      • Start Oracle Database

      $ . oraenv

      ORACLE_SID = [cdb] ? cdb

      $ lsnrctl start

      $ sqlplus / as sysdba

      SQL> startup

      ORACLE instance started.
      Total System Global Area 1509949440 bytes
      Fixed Size 2924640 bytes
      Variable Size 956305312 bytes
      Database Buffers 536870912 bytes
      
      Redo Buffers 13848576 bytes
      
      Database mounted.
      
      Database opened.

      SQL> alter pluggable database all open;

      Pluggable database altered.

Installing Oracle Linux Server 7.3 using VirtualBox

This article describes the steps to install Oracle Linux 7.3 x86_64 on an Oracle VirtualBox 5.1 virtual machine.

 

  1. Creating a Virtual Machine

 Memory: 4GB

 Hard Disk: 80GB
  1. Installing Oracle Linux 7.3

  • Configure Network and Host Name
  • Configure Installation Destination

Create partitions as:

Mount point Partition Size File System
/boot /dev/sda1 1 GB xfs
swap /dev/sda2 16 GB swap
/ /dev/sda3 63 GB xfs
  • Configure Software Selection
 Minimal Install (Default)
  • Begin Installation, set root password, complete installation and reboot.

3         Post-installation of Oracle Linux

3.1         Disable Firewall

# systemctl status firewalld

# systemctl stop firewalld

# systemctl disable firewalld

# systemctl status firewalld

3.2         Network Configuration

  • Network Configuration tool
# nmtui
  • Check hostname
# hostname

# hostnamectl status
  • Set hostname
# hostnamectl set-hostname new_host_name
  • Network configuration files
/etc/hosts

/etc/hostname

/etc/sysconfig/network-scripts/ifcfg-*

/etc/resolv.conf

3.3         NTP Configuration

chrony is the default package in Oracle Linux 7.

Review /etc/chrony.conf and enable NTP:

# systemctl status chronyd

# systemctl start chronyd

# systemctl enable chronyd
  1. Installing VirtualBox guest additions

To share a folder from host machine with the Oracle Linux guest, the VirtualBox Guest Additions is needed to be installed in the guest.

Navigate to VirtualBox menu:  Virtual box menu -> Devices -> Insert Guest Additions CD image

# mkdir /media/cdrom

# mount /dev/sr0 /media/cdrom

# yum install bzip2

# yum install kernel-uek-devel-`uname -r`

# export KERN_DIR=/usr/src/kernels/`uname -r`

# /media/cdrom/VBoxLinuxAdditions.run

# reboot

 

Add user to vboxsf user group, in order to use a shared folder:

# usermod -aG vboxsf oracle

 

Let’s play:

Installing Oracle E-Business Suite 12.2.5 on Oracle Linux 7.2

This article describes the steps to install Oracle E-business Suite 12.2.5 single node Vision instance on an Oracle Linux 7.2 server using VirtualBox 5.1.

1.Download EBS 12.2.5 installation media

All the files are available to download from https://edelivery.oracle.com

PRODUCT PLATFORM PACKAGE
 Oracle E-Business Suite 12.2.5 Linux x86-64 V100052-01_1of3.zip
    V100052-01_2of3.zip
    V100052-01_3of3.zip
    V100053-01_1of2.zip
    V100053-01_2of2.zip
    V100054-01.zip
    V100055-01.zip
    V100056-01.zip
    V100057-01.zip
    V100058-01.zip
    V100059-01_1of2.zip
    V100059-01_2of2.zip
    V100060-01_1of3.zip
    V100060-01_2of3.zip
    V100060-01_3of3.zip
    V100061-01.zip
    V100102-01.zip
 Oracle E-Business Suite 12.2.0 Linux x86-64 V35802-01.zip
    V35803-01_1of3.zip
    V35803-01_2of3.zip
    V35803-01_3of3.zip
    V35804-01_1of2.zip
    V35804-01_2of2.zip
Oracle Database 12.1.0.2.0 Linux x86-64 V46095-01_1of2.zip
    V46095-01_2of2.zip
 Oracle Web Tier 11.1.1.9.0 Linux x86-64 V75792-01.zip
Oracle WebLogic Server 10.3.6.0.0 Linux x86-64 V29856-01.zip
2.Virtual Machine configuration

Memory: 8GB

Hard Disk: 40GB + 300GB

Network: Bridged Adapter

3.Installing Oracle Linux 7.2

  • Configure Network and Host Name
  • Configure Installation Destination

      Create partition as:

Mount point Partition Size File System
/boot /dev/sda1 500 MB xfs
swap /dev/sda2 16 GB swap
/ /dev/sda3 23 GB xfs
/u01 /dev/sdb 300GB xfs
4.Installing VirtualBox guest additions

To share a folder from host machine with the Oracle Linux guest, the VirtualBox Guest Additions is needed to be installed in the guest.

Navigate to VirtualBox menu:  Virtual box menu -> Devices -> Insert Guest Additions CD image

# mkdir /media/cdrom

# mount /dev/sr0 /media/cdrom

# yum install bzip2

# yum install kernel-uek-devel-`uname -r`

# export KERN_DIR=/usr/src/kernels/`uname -r`

# /media/cdrom/VBoxLinuxAdditions.run

# usermod -aG vboxsf oracle

# reboot  

5.Post-installation of Oracle Linux

  • Disable Firewall

    # systemctl status firewalld

    # systemctl disable firewalld

    # systemctl stop firewalld

    # systemctl status firewalld

  • Install E-Business Suite Pre-Install RPM

    Edit /etc/yum.repos.d/public-yum-ol7.repo, Change the field ‘enabled=0’ to ‘enabled=1’ for the repositories[ol7_addons].

    # yum install oracle-ebs-server-R12-preinstall

    Set password for user oracle:

    # passwd oracle

  • Verifying network settings

    Verify that the /etc/hosts file is formatted as follows:

    127.0.0.1 localhost.localdomain localhost

    192.168.1.19 ebs.local ebs

    Verify that the /etc/sysconfig/network file is formatted as follows:

    #HOSTNAME=[node_name].[domain_name]

    HOSTNAME=ebs.local

  • Verifying oraInst.loc 

    # vi /etc/oraInst.loc

    inventory_loc=/u01/oracle/oraInventory

    inst_group=oinstall

  • Creating folders

    # mkdir /u01/oracle

    # chown oracle.oinstall /u01/oracle

    # su – oracle

    $ mkdir -p /u01/oracle/oraInventory

    $ mkdir -p /u01/oracle/VIS 

6.Build Stage Area

Make a shared folder between host and guest VM, assume the folder including the downloaded files on Oracle Linux is: /media/sf_ebs/ebs12.2.5

$ cd /media/sf_ebs/StageR122/

$ unzip ‘/media/sf_ebs/ebs12.2.5/V100052-01*.zip’

$ cd startCD/Disk1/rapidwiz/bin

$ buildStage.sh

The stage area folder is: /media/sf_ebs/StageR122

7.Install ebs 12.2.5

$ cd /media/sf_ebs/StageR122/startCD/Disk1/rapidwiz

$ ./rapidwiz

Cleanup and run rapidwiz again in case of failure:

rm -rf /tmp/OraInstall*

rm -rf /u01/oracle/oraInventory

rm -rf /u01/oracle/VIS/*

8.Start & stop scripts

  $ vi ~/start_ebs.sh

#!/bin/bash

##

## Database Tier

#

#Set env

. /u01/oracle/VIS/12.1.0/VIS_ebs.env

#

#Start database

sqlplus / as sysdba <<EOF

startup

exit

EOF

#

#Start Listener

lsnrctl start VIS

##

## Application Tier

cd /u01/oracle/VIS/fs1/inst/apps/VIS_ebs/admin/scripts/

./adstrtal.sh apps/apps <<EOF

oracle123

EOF

 $ vi ~/stop_ebs.sh

#!/bin/bash

##

## Application Tier

cd /u01/oracle/VIS/fs1/inst/apps/VIS_ebs/admin/scripts/

./adstpall.sh apps/apps <<EOF

oracle123

EOF

##

## Database Tier

#Set env

. /u01/oracle/VIS/12.1.0/VIS_ebs.env

#

#Stop database

sqlplus / as sysdba <<EOF

shutdown immediate

exit

EOF

#

#Stop Listener

lsnrctl stop VIS

$ chmod +x ~/st*_ebs.sh

9.Test

From a client, open URL: http://ebs.local:8000/OA_HTML/AppsLogin

Login as: SYSADMIN/SYSADMIN 

Cloning an Oracle Forms & Reports 12c Server

  1. Clone an Oracle Forms & reports server 12c in VMWware or VirtualBox
  2. Change hostname/IP Address
  3. Login as oracle user, run config.sh:

$ORACLE_HOME/oracle_common/common/bin/config.sh

change RCU configuration

change host name from old to new

      4. Change host name from old to new in other files:

$DOMAIN_HOME/bin/stopWebLogic.sh

$DOMAIN_HOME/bin/startManagedWebLogic.sh

$DOMAIN_HOME/bin/stopManagedWebLogic.sh

$OHS_INST/moduleconf/forms.conf

$OHS_INST/moduleconf/reports_ohs.conf

Oracle Database 12.1.0.2 New Feature: Full Database Caching

Starting with Oracle Database EE/SE2 12.1.0.2, Oracle Database can cache the entire database in memory when the size of the database is smaller than the database buffer cache size.

We can still use this feature when the buffer cache size is not big enough.

You may find the following text in alert_SID.log file:

Buffer Cache Full DB Caching mode changing from FULL CACHING ENABLED to FULL CACHING DISABLED

Full DB Caching disabled: DEFAULT_CACHE_SIZE should be at least  nnn MBs bigger than current size.

We can use Force Full Database Caching Mode then, to cache as many blocks as possible.

 

To enable force Full Database Caching Mode:

STARTUP MOUNT
ALTER DATABASE FORCE FULL DATABASE CACHING;

ALTER DATABASE OPEN;
SELECT FORCE_FULL_DB_CACHING FROM V$DATABASE;

FOR

YES

 

Notes:

  • The data blocks are loaded into the buffer cache as they are being accessed.
  • Old cached blocks will be flushed when buffer cache is full.
  • Recycle buffer can be used for such as audit/log tables.
  • Information about force Full Database Caching Mode is stored in the control file, not in pfile or spfile.

 

Reference:

Force Full Database Caching Mode in 12c (Doc ID 1941494.1)

Oracle Forms & Reports on Linux Virtual environment: The startup is very slow

Installed Oracle Forms & Reports 12.2.1 on Oracle Linux 7.2, which is a VMWare virtual machine. The startup is very slow, around 20 minutes.

CAUSE

The Operating System random numbers generator is too slow.

Solution

  •  Install a package as root

# yum install rng-tools

 

  • Edit /usr/lib/systemd/system/rngd.service.

The ExecStart line should be edited so that it reads as in the following:

ExecStart=/sbin/rngd -f -r /dev/urandom

 

  • Start & Enable the service

# systemctl daemon-reload

# systemctl start rngd

# systemctl status rngd

# systemctl enable rngd

 

  • Check the entropy

$ cat /proc/sys/kernel/random/entropy_avail

Anything below 500 is at risk of running out of entropy.

 

The Forms & Reports server can be started within 5 minutes.

 

REFERENCE

  • The FMW Configuration Wizard Is Very Slow On Linux Virtual Environments. The Startup Of WLS Servers Is Also Very Slow. (Doc ID 1344974.1)
  • Forms and Reports Services 12c (12.2.1) : Create a New Domain

https://oracle-base.com/articles/12c/oracle-forms-and-reports-12c-create-new-domain

 

Oracle CBO: Calculate Full Table Scan cost

An Oracle PL/SQL procedure to calculate IO cost of Full Table Scan.

 

DECLARE

   v_owner_name   VARCHAR2 (30) := 'SCOTT';       -- Schema

   v_table_name   VARCHAR2 (30) := 'EMP';         -- Table name

   v_cost_model   VARCHAR2 (30);


   v_block_size   NUMBER;                                                                               -- db_block_size

   v_dbforc       NUMBER;                                                                --_db_file_optimizer_read_count

   v_dbfmbrc      NUMBER;                                                               -- db_file_multiblock_read_count

   v_blocks       NUMBER;

   v_cost         NUMBER;

   v_io_cost      NUMBER;                                                                           -- from explain plan


   v_#MRDs        NUMBER;                                                                 -- number of multi block reads

   v_sreadtim     NUMBER;                                                                      -- single block read time

   v_mreadtim     NUMBER;                                                                       -- multi block read time


   v_msg          VARCHAR2 (2000);

   TYPE typ_sys_stat_tab IS TABLE OF NUMBER

      INDEX BY VARCHAR2 (30);


   v_sys_stat     typ_sys_stat_tab;

BEGIN

   -- db_block_size: 8192 (default)

   SELECT VALUE

     INTO v_block_size

     FROM v$parameter

    WHERE name = 'db_block_size';


   -- Session Value of _db_file_optimizer_read_count: 8 (default)

   SELECT b.ksppstvl "Session Value"

     INTO v_dbforc

     FROM x$ksppi a, x$ksppcv b

    WHERE a.indx = b.indx AND a.ksppinm = '_db_file_optimizer_read_count';


   SELECT b.ksppstvl "Session Value"

     INTO v_dbfmbrc

     FROM x$ksppi a, x$ksppcv b

    WHERE a.indx = b.indx AND a.ksppinm = 'db_file_multiblock_read_count';




   -- table block# used

   SELECT blocks

     INTO v_blocks

     FROM all_tables

    WHERE OWNER = v_owner_name AND table_name = v_table_name;


   -- get system statistics parameters

   FOR r1 IN (SELECT pname, pval1

                FROM sys.aux_stats$)

   LOOP

      v_sys_stat (r1.pname) := r1.pval1;

   END LOOP;


   /*

    _OPTIMIZER_COST_MODEL (hidden) parameter:

     'CHOOSE' - default: chooses CPU costing based on the presence of statistics in aux_stats$,

     'CPU'    - forces CPU costing based on statistics in aux_stats$,

     'IO'     - forces IO costing

   */

   SELECT b.ksppstvl "Session Value"

     INTO v_cost_model

     FROM x$ksppi a, x$ksppcv b

    WHERE a.indx = b.indx AND a.ksppinm = '_optimizer_cost_model';


   v_msg := 'Full Table Scan: ' || v_owner_name || '.' || v_table_name;

   v_msg := v_msg || CHR (10) || '  number of used table blocks:   ' || v_blocks;

   v_msg := v_msg || CHR (10) || '  db_block_size: ' || v_block_size;

   v_msg := v_msg || CHR (10) || '  _optimizer_cost_model: ' || v_cost_model;

   v_msg := v_msg || CHR (10) || '  _db_file_optimizer_read_count (session value): ' || v_dbforc;

   v_msg := v_msg || CHR (10) || '  db_file_multiblock_read_count (session value): ' || v_dbfmbrc;


   IF v_cost_model = 'IO'

   THEN

      v_cost := CEIL (v_blocks * 0.5965 / POWER (v_dbforc, 0.6582));

      v_msg :=

            v_msg

         || CHR (10)

         || '  Formaula: io_cost = ceil(blocks * 0.5965/ _db_file_optimizer_read_count ^ 0.6582'

         || CHR (10)

         || '  _db_file_optimizer_read_count: '

         || v_dbforc;

   ELSE                                                                                             -- 'CHOOSE' or 'CPU'

      IF v_sys_stat ('FLAGS') = 0 OR v_sys_stat ('MBRC') IS NULL

      THEN

         IF v_sys_stat ('FLAGS') = 0

         THEN

            v_msg := v_msg || CHR (10) || 'System Statistics type: Default NOWORKLOAD';

         ELSE

            v_msg := v_msg || CHR (10) || 'System Statistics type: Gathered NOWORKLOAD';

         END IF;


         v_msg := v_msg || CHR (10) || '  IOSEEKTIM : ' || v_sys_stat ('IOSEEKTIM');

         v_msg := v_msg || CHR (10) || '  IOTFRSPEED: ' || v_sys_stat ('IOTFRSPEED');




         v_sreadtim := v_sys_stat ('IOSEEKTIM') + v_block_size / v_sys_stat ('IOTFRSPEED');

         v_msg := v_msg || CHR (10) || 'SREADTIM = IOSEEKTIM + db_block_size / IOTFRSPEED';

         v_msg := v_msg || CHR (10) || '  single-block I/O read time:    ' || v_sreadtim;


         v_mreadtim := v_sys_stat ('IOSEEKTIM') + v_dbforc * v_block_size / v_sys_stat ('IOTFRSPEED');

         v_msg := v_msg || CHR (10) || 'MREADTIM = IOSEEKTIM + mbrc * db_block_size / IOTFRSPEED';

         v_msg := v_msg || CHR (10) || '  multi-block I/O read time:     ' || v_mreadtim;


         v_#MRDs := v_blocks / v_dbforc;

         v_msg := v_msg || CHR (10) || '#MRDs = table block# used / _db_file_optimizer_read_count';

         v_msg := v_msg || CHR (10) || '  #MRDs: ' || v_#MRDs;


         v_cost := GREATEST (1, CEIL (v_#MRds * v_mreadtim / v_sreadtim));

      ELSE

         v_msg := v_msg || CHR (10) || 'System Statistics type: Gathered WORKLOAD';

         v_msg := v_msg || CHR (10) || '  use SYS.AUX_STATS$.MBRC to calculate #MRDs';


         v_msg := v_msg || CHR (10) || '  SREADTIM  : ' || v_sys_stat ('SREADTIM');

         v_msg := v_msg || CHR (10) || '  MREADTIM  : ' || v_sys_stat ('MREADTIM');

         v_msg := v_msg || CHR (10) || '  MBRC      : ' || v_sys_stat ('MBRC');


         v_#MRDs := v_blocks / v_sys_stat ('MBRC');

         v_msg := v_msg || CHR (10) || '#MRDs = table block# used / MBRC';

         v_msg := v_msg || CHR (10) || '  #MRDs: ' || v_#MRDs;


         v_cost := GREATEST (1, CEIL (v_#MRds * v_sys_stat ('MREADTIM') / v_sys_stat ('SREADTIM')));

      END IF;


      DBMS_OUTPUT.put_line (v_msg);

      DBMS_OUTPUT.put_line ('-----------------');

   END IF;


   DBMS_OUTPUT.PUT_LINE ('io_cost = MAX(1, CEIL(blocks / MBRC * MREADTIM / SREADTIM))');

   DBMS_OUTPUT.put_line ('COST calculated: ' || v_cost);

   DBMS_OUTPUT.put_line ('-----------------');


   -- EXPLAIN PLAN

   --EXECUTE IMMEDIATE 'ALTER SESSION SET "_table_scan_cost_plus_one" = FALSE';


   -- EXECUTE IMMEDIATE 'alter session set db_file_multiblock_read_count=' || v_mbrc;

   EXECUTE IMMEDIATE 'EXPLAIN PLAN FOR SELECT * FROM ' || v_owner_name || '.' || v_table_name;


   SELECT IO_COST

     INTO v_io_cost

     FROM plan_table

    WHERE     operation = 'TABLE ACCESS'

          AND options = 'FULL'

          AND object_name = UPPER (v_table_name)

          AND plan_id = (SELECT MAX (plan_id) FROM plan_table);

   DBMS_OUTPUT.put_line ('COST from explain plan: ' || v_io_cost);

END;

 

REFERENCES

  1. How To Calculate CPU Cost (Doc ID 457228.1)
  2. How is Parameter DB_FILE_MULTIBLOCK_READ_COUNT Calculated? (Doc ID 1398860.1)
  3. Cost-Based Oracle Fundamentals By Jonathan Lewis