Sunday, March 9, 2025

   OCI - Vision

The very common use case seen today is image recognition and detecting objects within that image. The image could have document with texts or it could have any objects. Its important to not only detect the object and also perform analysis of the object. For example if it is an objects then its important to classify the object, if it is a document then classify it whether it is invoice or receipt and what language it is written.

OCI Vision is an AI powered service and it performs all of the above. It split between document AI for document-centric image and perform image analysis using machine learning capability for the objects. We will see how it performs in this article.

Prerequisites:

OCI account, it could be trail or paid account.
Account credentials to set the policy. The user should have privilege to use ai-service-vision-family.
Objects to analyse, it could be in the local storage or OCI object storage. If the location is OCI Object storage, then necessary privilege is granted to access the object storage files.


Login into OCI console.

Vision service is located under Analytics & AI -> AI services -> Vision.

Once we choose the Vision, it will open up Vision overview page.


We have five options to perform with this service.
Image classification:

It takes the image from Local storage or object storage and then analyse and classifies it into different types based on visual appearance, objects identified in the image. It also provides the confidence level through scores for each identified object. We could assume that object with high score have been identified correctly.

Lets discuss with an example.

Chosen an random image located in local storage.

The Results shows it has identified Dice in the image and its confidence score is 99.97% and it classifies the object into game, sports and also its Board game. Its not completely blue colour, hence the score for the colour is less.

Object Detection:

This feature detects all the objects located in an image. It provides confidence score for each object it has identified.

In the results we could see the objects identified. Similar objects are identified with different score. The object detection feature has identified only the objects in the image.

 

Face Detection:

This feature detects how many human faces detected in a picture.

The object here is an image with cat. We could the Empty results returned.

The image used in the object detection has been used here. We could see Face detection has said Empty results returned.

Text Detection:

 The image used here has text and face. Text analysis will identify the text in the image. The results will be categorized as Line and Words.

 

Video Analysis:

 Its one of the very useful use case. This feature will analyze the video and reports about the Labels, Objects, Text and Face.

 

 

 

 

 

 

Sunday, November 3, 2024

Oracle 23ai DB new feature - True Cache


    Oracle Database 23ai has come up with many new feature. One of the important feature is True cache. In general Database comes with many cache like DB Buffer cache, Library cache,  Redo log Buffer cache, PL/SQL Function result cache, Smart Flash cache, SubQuery caching, In Memory option. All the said caches above are built within the cache. True cache is different from these cache. It is getting build outside of database. 

True cache is a read only instance and its has its own buffer. It will collect the data from the source database and keeps updating the data to maintain sync with original data located in the source database.  The read only instance can be at source location or it can be at location closer to the customer region.

For example the database holds data of multiple region customers and database connection will be happening from different parts of the world. We need to provide same database performance to all customers. For application we have seen Redis cache which does this activity. But for database we need similar caching concept to aggregate database retrieval performance which is provided by True cache.

Consider the above scenario. Database is physically located in US and it is accessed by APAC customers. The data retrieval and performance should not be affected because of the distance between customer location and database. So we need to cache the data in  APAC region. But we need only APAC region customer's data. So caching needs to be done for subset of data. Also the cached data should be read consistent and also updates happening in Main database should be reflected immediately in Cache.

True cache provides all the above features. It may look similar to Active Data Guard. But it is different.



True cache Installation

True cache can be installed either using DBCA or Manual method.

DBCA:

For configuring True cache first we need to collect details of Primary or Source database and configure True cache using the collected details. We call the Primary database details as Blob. Kindly note it is not related to Blob data type 😀

First step is generating BLOB from source database.

$ORACLE_HOME/bin/dbca -configureDatabase -prepareTrueCacheConfigFile -sourceDB <primary_db_sid_or_db_unique_name> -trueCacheBlobLocation <primary_db_config_blob_path> -silent

PrepareTrueCacheConfig parameter directs DBCA to create Blob at the location mentioned in trueCacheBlobLocation parameter. DBCA will package the password file (and optional TDE wallet) into a configuration BLOB file. 
Once the blob got created, it can be copied to True cache instance creation location. It could be local or remote.

$ORACLE_HOME/bin/dbca -createTrueCache -gdbName true_cache_global_name -sid true_cache_sid -sourceDBConnectionString primary_db_easy_connect_string -trueCacheBlobFromSourceDB true_cache_config_blob_path -sgaTargetInMB sga_memory_size -pgaAggregateTargetInMB pga_memory_size -tdeWalletLoginType AUTO_LOGIN -listeners listener_name -silent

trueCacheBlobFromSourceDB parameter denotes the location of copied BLOB file.
sourceDBConnectionString parameter looks for Primary database connection string

True cache is an instance and requires SGA and PGA which can be specified through parameters.
sgaTargetInMB, pgaAggregateTargetInMB

Manual Method

The steps are similar to physical standby creation. Copy password file and  init parameter file to True cache instance. At true cache instance, the init parameter file will have entries similar to physical standby database. db_name, db_unique_name, fal_server, fal_client, instance_name, local_listener, remote_listener, sga_target parameters to be specified. 

true_cache=true  ===> Additional parameter to enable True cache behavior.


Configure local listener at primary and true cache (static entry in listener.ora file) instance to establish the connectivity.

Connect to the True Cache instance using SQL*Plus:

sqlplus / as SYSDBA

Start the instance in NOMOUNT state using the PFILE:

STARTUP NOMOUNT PFILE=<path_to_init_parameter_file>;

Create the True cache. This step will create the control files, mount the instance, and start the database in read-only mode.

SQL> CREATE TRUE CACHE;

Additional Configuration:

Create standby redo logs to receive redo log entries from the primary database.
Update the LOG_ARCHIVE_DEST parameter in the primary database to configure the destination for redo log transmission.


Tuesday, May 28, 2024

Oracle Database free 23ai installation on Linux 8.x (Redhat, Oracle Linux)


The Database Installation RPM can be downloaded from https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23ai-1.0-1.el8.x86_64.rpm

For other Linux versions the download link is available at https://www.oracle.com/database/free/get-started/


[root@oralinux87 oracle]# ll

total 1345920

-rw-r--r--. 1 root   root     1378076936 May 27 17:46 oracle-database-free-23ai-1.0-1.el8.x86_64.rpm

-rw-r--r--. 1 oracle oinstall     141655 May 27 17:34 wget-log


Install Database 23ai using dnf command.


[root@oralinux87 oracle]# dnf install -y oracle-database-free-23ai-1.0-1.el8.x86_64.rpm

Last metadata expiration check: 0:05:29 ago on Mon 27 May 2024 05:42:05 PM CDT.

Dependencies resolved.

=============================================================================================================================================================================================================================================

 Package                                                                Architecture                                  Version                                                     Repository                                            Size

=============================================================================================================================================================================================================================================

Installing:

 oracle-database-free-23ai                                              x86_64                                        1.0-1                                                       @commandline                                         1.3 G

Installing dependencies:

 compat-openssl10                                                       x86_64                                        1:1.0.2o-4.el8_6                                            ol8_appstream                                        1.1 M

 ksh                                                                    x86_64                                        20120801-267.0.1.el8                                        ol8_appstream                                        923 k

 oracle-database-preinstall-23ai                                        x86_64                                        1.0-2.el8                                                   ol8_appstream                                         30 k


Transaction Summary

=============================================================================================================================================================================================================================================

Install  4 Packages


Total size: 1.3 G

Total download size: 2.1 M

Installed size: 3.6 G

Downloading Packages:

(1/3): oracle-database-preinstall-23ai-1.0-2.el8.x86_64.rpm                                                                                                                                                  172 kB/s |  30 kB     00:00

(2/3): compat-openssl10-1.0.2o-4.el8_6.x86_64.rpm                                                                                                                                                            2.2 MB/s | 1.1 MB     00:00

(3/3): ksh-20120801-267.0.1.el8.x86_64.rpm                                                                                                                                                                   373 kB/s | 923 kB     00:02

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                                                                        848 kB/s | 2.1 MB     00:02

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                                                                     1/1

  Installing       : ksh-20120801-267.0.1.el8.x86_64                                                                                                                                                                                     1/4

  Running scriptlet: ksh-20120801-267.0.1.el8.x86_64                                                                                                                                                                                     1/4

  Installing       : compat-openssl10-1:1.0.2o-4.el8_6.x86_64                                                                                                                                                                            2/4

  Running scriptlet: compat-openssl10-1:1.0.2o-4.el8_6.x86_64                                                                                                                                                                            2/4

  Installing       : oracle-database-preinstall-23ai-1.0-2.el8.x86_64                                                                                                                                                                    3/4

  Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64                                                                                                                                                                              4/4

  Installing       : oracle-database-free-23ai-1.0-1.x86_64                                                                                                                                                                              4/4

  Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64                                                                                                                                                                              4/4

[INFO] Executing post installation scripts...

[INFO] Oracle home installed successfully and ready to be configured.

To configure Oracle Database Free, optionally modify the parameters in '/etc/sysconfig/oracle-free-23ai.conf' and then run '/etc/init.d/oracle-free-23ai configure' as root.


  Running scriptlet: oracle-database-preinstall-23ai-1.0-2.el8.x86_64                                                                                                                                                                    4/4

  Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64                                                                                                                                                                              4/4

  Verifying        : compat-openssl10-1:1.0.2o-4.el8_6.x86_64                                                                                                                                                                            1/4

  Verifying        : ksh-20120801-267.0.1.el8.x86_64                                                                                                                                                                                     2/4

  Verifying        : oracle-database-preinstall-23ai-1.0-2.el8.x86_64                                                                                                                                                                    3/4

  Verifying        : oracle-database-free-23ai-1.0-1.x86_64                                                                                                                                                                              4/4


Installed:

  compat-openssl10-1:1.0.2o-4.el8_6.x86_64                   ksh-20120801-267.0.1.el8.x86_64                   oracle-database-free-23ai-1.0-1.x86_64                   oracle-database-preinstall-23ai-1.0-2.el8.x86_64


Complete!

[root@oralinux87 oracle]#



Configure the database using /etc/init.d/oracle-free-23ai. It will create a PDB called FREEPDB1 in 23ai database and the ask for the password. The given password is common for sys, system and pdbadmin users.

The configuration with default settings as below. If we want to modify the settings then edit the /etc/sysconfig/oracle-free-23ai.conf file.

# LISTENER PORT used Database listener, Leave empty for automatic port assignment
LISTENER_PORT=

# Character set of the database
CHARSET=AL32UTF8

# Database file directory
# If not specified, database files are stored under Oracle base/oradata
DBFILE_DEST=

# DB Domain name
DB_DOMAIN=

# Configure TDE
CONFIGURE_TDE=false

# Encrypt Tablespaces list, Leave empty for user tablespace alone or provide ALL for encrypting all tablespaces
# For specific tablespaces use SYSTEM:true,SYSAUX:false
ENCRYPT_TABLESPACES=

# SKIP Validations, memory, space
SKIP_VALIDATIONS=FALSE


[root@oralinux87 oracle]# ls -lrt /etc/init.d/

total 48

-rw-r--r--. 1 root root 18434 Aug 10  2022 functions

-rw-r--r--. 1 root root  1161 Nov  9  2022 README

-r-xr-xr-x. 1 root root 20518 Apr 24 14:46 oracle-free-23ai

[root@oralinux87 oracle]# /etc/init.d/oracle-free-23ai configure

Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:

Confirm the password:

Configuring Oracle Listener.

Listener configuration succeeded.

Configuring Oracle Database FREE.

Enter SYS user password:

**************

Enter SYSTEM user password:

*************

Enter PDBADMIN User Password:

************

Prepare for db operation

7% complete

Copying database files

29% complete

Creating and starting Oracle instance

30% complete

33% complete

36% complete

39% complete

43% complete

Completing Database Creation

47% complete

49% complete

50% complete

Creating Pluggable Databases

54% complete

71% complete

Executing Post Configuration Actions

93% complete

Running Custom Scripts

100% complete

Database creation complete. For details check the logfiles at:

 /opt/oracle/cfgtoollogs/dbca/FREE.

Database Information:

Global Database Name:FREE

System Identifier(SID):FREE

Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.


Connect to Oracle Database using one of the connect strings:

     Pluggable database: oralinux87/FREEPDB1

     Multitenant container database: oralinux87


We need to set ORACLE environment variables to access the executables. For that we need to Oracle database home location.

It can be identified from Central inventory and its location can be found using /etc/oraInst.loc file.


[root@oralinux87 oracle]# cat /etc/oraInst.loc

inventory_loc=/opt/oracle/oraInventory    -----------> Central Inventory location.

inst_group=oinstall


[root@oralinux87 oracle]# cd /opt/oracle/oraInventory

[root@oralinux87 oraInventory]# ls -lrt

total 12

-rwxrwx---. 1 oracle oinstall 1644 May 27 17:53 orainstRoot.sh

-rw-rw----. 1 oracle oinstall   59 May 27 17:53 oraInst.loc

drwxrwx---. 2 oracle oinstall 4096 May 27 17:53 logs

drwxrwx---. 2 oracle oinstall   60 May 27 17:53 ContentsXML

[root@oralinux87 oraInventory]# cd ContentsXML/

[root@oralinux87 ContentsXML]# ll

total 12

-rw-rw----. 1 oracle oinstall 300 May 27 17:53 comps.xml

-rw-rw----. 1 oracle oinstall 479 May 27 17:53 inventory.xml   ---> It has all oracle home details.

-rw-rw----. 1 oracle oinstall 292 May 27 17:53 libs.xml

[root@oralinux87 ContentsXML]# cat inventory.xml

<?xml version="1.0" standalone="yes" ?>

<!-- Copyright (c) 1999, 2024, Oracle and/or its affiliates.

All rights reserved. -->

<!-- Do not modify the contents of this file by hand. -->

<INVENTORY>

<VERSION_INFO>

   <SAVED_WITH>12.2.0.9.0</SAVED_WITH>

   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>

</VERSION_INFO>

<HOME_LIST>

<HOME NAME="OraDBHome23aiFree" LOC="/opt/oracle/product/23ai/dbhomeFree" TYPE="O" IDX="1"/>      ---> We could see Oracle 23ai Installation location.

</HOME_LIST>

<COMPOSITEHOME_LIST>

</COMPOSITEHOME_LIST>

</INVENTORY>


[root@oralinux87 ContentsXML]# cd /opt/oracle/product/23ai/dbhomeFree

[root@oralinux87 dbhomeFree]# pwd

/opt/oracle/product/23ai/dbhomeFree

[root@oralinux87 dbhomeFree]# echo $ORACLE_HOME


[root@oralinux87 dbhomeFree]# sudo su - oracle

[oracle@oralinux87 ~]$ export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree

[oracle@oralinux87 ~]$ export PATH=$ORACLE_HOME/bin:$PATH

[oracle@oralinux87 ~]$ sqlplus sys@localhost:1521/FREEPDB1 as sysdba


SQL*Plus: Release 23.0.0.0.0 - Production on Mon Version 23.4.0.24.05

Copyright (c) 1982, 2024, Oracle.  All rights reserved.

Enter password:

Connected to:

Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.4.0.24.05


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         3 FREEPDB1                       READ WRITE NO

SQL>


  Oracle AI Database@Azure: Why It Matters and When to Use It Oracle Database@Azure was announced by Oracle and Microsoft in September 202...