Wednesday, May 15, 2024

Oracle 23ai: Quick Overview

 

Oracle Database 23ai

  • Oracle database 23ai is the next long-term support release of Oracle database.
  • It brings AI to your data with the addition of AI Vector search to Oracle's relational database. 

The difference between Oracle database 23c and Oracle database 23ai

  • Oracle database 23c is renamed as database 23ai following the importance of AI technology in this release. 
  • Oracle database 23ai is the version 23.4.0.0.0 and will be referred to as moving forward.

Why should you upgrade to Oracle database 23ai?

  • Oracle database 23ai offers five years of premium support and three years of extended support.
  • Oracle database 19c premier support ends on April 30, 2024and while Oracle waived the additional fees for Extended Support from May 1, 2024 to April 30, 2026, Extended Support will end on April 30, 2027, giving you a longer support overlap with Oracle Database 23ai. (Oracle Database Release MOS Doc ID 742060.1).


  • Oracle database 23ai unifies the relational and document data models to provide the best of both data models worlds in one database with the addition of JSON Relational Duality Views. So instead of using two separated databases (relational and non-relational databases), developers can operate on the same underlying data as either JSON documents, using standard document APIs, or as relational, using standard SQL. To learn more.
  • Oracle database 23ai introduces AI Vector Search feature. It is the capability, that stores and searches the semantic content of documents, images, and other unstructured data as vectors and use these to run fast similarity queries. A vector is a popular data structure used in AI applications. Oracle AI Vector Search allows you to generate, store, index, and query vector embeddings along with other business data, using the full power of SQL. To lean more.
  • Oracle database 23ai offers a faster database processing comparing with previous database releases.  
  • In addition to more than 300 new features compared to previous databases releases such as SQL Firewall and True Cache

Upgrade from a previous version to Oracle database 23ai

  • Oracle provides a direct database upgrade path from Oracle database 19c and 21c to Oracle database 23ai.
  • All other versions of the database need to upgrade to 19c or 21c versions, and then to 23ai.
  • The specific upgrade process may vary depending on the current version and configuration of your particular Oracle Database deployment.

Oracle database 23ai free trial

  • Oracle offers free trials for Oracle Database 23ai through:
    • Oracle Cloud Infrastructure (OCI) with Autonomous Database Free Tier.
    • Oracle Database 23ai Free is available for download as a Linux RPM file, an Oracle Linux-based Docker image, or Oracle Virtual Box VM. To get free Oracle 23ai.


Wednesday, May 8, 2024

Oracle 23ai: Bigfile Tablespace Shrink

 

- Overview:

  • If you try to resize/shrink a datafile before Oracle Database 23ai, you'll get "ORA-03297: file contains used data beyond requested RESIZE value", because there are segments' extents (your tables, indexes, partitions, etc.) that are blocking it from shrinking..
  • Oracle 23ai database introduces the option to shrink a Bigfile tablespace to reclaim datafile's free space.
  • A new procedure (SHRINK_TABLESPACE) has been added to DBMS_SPACE package to shrink tablespace and reclaim datafile's free space.
In this blog, I'll demonstrate the steps to shrink a tablespace.

Prerequisites:
  • Oracle Database 23ai.

Preparation Steps:

 1. Create a new Bigfile tablespace.
   - Connect to a pluggable database and create a new tablespace.

















2. Create new tables on the new tablespace and populate with data.
  - In my example, I used below commands to create and populate tables with data.
  - Create tables:
create table segments tablespace TEST_SHRINK as select * from dba_segments;
create table objects tablespace TEST_SHRINK as select * from dba_objects;
create table my_tables tablespace TEST_SHRINK as select * from dba_tables;

  - Populate tables by running below inserts multiple times:
insert into segments select * from segments; 
insert into objects select * from objects;
insert into my_tables select * from my_tables;

  - Check datafile's free space and write it down for comparison later.

















3. Delete some data or truncate table/s. 
  - In my example, I truncated OBJECTS table.
  - Notice that datafile's free space increased from 316M to 724M.












Shrink Tablespace Steps:

1. Analyze a tablespace shrink by executing below command.

execute dbms_space.shrink_tablespace('TEST_SHRINK',shrink_mode => DBMS_SPACE.TS_MODE_ANALYZE)

  - It is highly recommended to determine the potential of a shrink operation by running it in analyze mode first. 
  - The result of this analysis contains useful information including a list of unsupported objects, a list of movable objects, the total size of movable objects in the tablespace, and the suggested target size for the tablespace. 
  - Analyzing a tablespace will take much less time that actually shrinking it.













2. Execute shrink tablespace by executing below command.

execute dbms_space.shrink_tablespace('TEST_SHRINK')

  - Notice that datafile's size was shrunk from 1024M to 202M and datafile's free space was decreased from 724M to 7M.






Oracle 23ai: Quick Overview

  Oracle Database 23ai Oracle database 23ai is the next long-term support release of Oracle database. It brings AI to your data with the ad...