Eclipsys Blog

Oracle 23ai: True Cache

Written by Chanaka Yapa | Aug 28, 2024 6:30:00 PM

Introduction

In today’s fast-paced digital landscape, speed is paramount. Users expect instant responses, and applications must seamlessly handle high traffic and demanding workloads. Oracle databases, often the backbone of critical systems, bear the weight of these performance demands. Fortunately, Oracle Database has a powerful solution: True Cache, an advanced in-memory caching technology designed to optimize database performance and enhance application efficiency.

 

What is Oracle True Cache? 

True Cache is a fast storage layer that temporarily holds frequently accessed data from an Oracle database to speed up read operations. It’s like a quick-access memory that helps retrieve data faster without repeatedly querying the main database.

Simple terms: True Cache is an in-memory, read-only caching layer positioned in front of an Oracle database.

 

General Architecture 

Figure 1: True Cache Architecture

 

The benefits of True Cache in Oracle 23c AI include:

Faster Data Access: By storing frequently accessed data in memory, True Cache reduces the time needed to retrieve data from the database, leading to quicker response times for applications

Improved Performance: With data readily available in memory, the overall performance of the database engine is enhanced, allowing for more efficient processing of queries and transactions.

Reduced Database Load: True Cache minimizes the number of direct queries to the database, thereby reducing the workload on the database engine and freeing up resources for other tasks.

Enhanced User Experience: Applications that rely on quick data retrieval will see significant improvements, providing a smoother and more responsive user experience.

Scalability: As demand for data grows, True Cache can help maintain performance levels by efficiently managing and accessing frequently used data.

If you need more detail, refer to Oracle’s main blog for true cache.

https://blogs.oracle.com/database/post/introducing-oracle-true-cache

In this article, I will elaborate on how you can set up Oracle’s true cache instance.

 

Pre-requisites for True cache testing

  • Create two DBCS instances with 23ai. (Both instances should be in the same subnet).
  • Make sure connective is there for two VMs. (default ports 22 and 1521 need to be enabled for the subnet ).
  • Make sure to add the IP address of both nodes to the host file.

Below is my machine hostname :

Using the DBCA utility, I create a BLOB file, which I then transfer to the True Cache instance. Upon inspecting the contents of the BLOB file, you’ll find both the password file and the wallet stored within it.

  $ORACLE_HOME/bin/dbca -configureDatabase -prepareTrueCacheConfigFile \
-sourceDB P23AI \
-trueCacheBlobLocation /home/oracle/scripts/ \
-silent

Expected output

[oracle@dbsdpl24 admin]$ $ORACLE_HOME/bin/dbca -configureDatabase -prepareTrueCacheConfigFile \
-sourceDB P23AI \
-trueCacheBlobLocation /home/oracle/scripts/ \
-silent

Enter password for the TDE wallet:

Enter password for the TDE wallet:
Session ID of the current execution is: 1
Log file location: /u01/app/oracle/cfgtoollogs/dbca/P23AI_jt7_yyz/trace.log_2024-08-20_04-35-42PM_53669
-----------------
Running Initialization job
Completed Initialization job
33% complete
-----------------
Running Validate_dataguard job
Skipping. Job is detected as not applicable.
40% complete
-----------------
Running Validate_db_version job
Completed Validate_db_version job
47% complete
-----------------
Running Validate_tde_credentials job
Completed Validate_tde_credentials job
53% complete
-----------------
Running Validate_true_cache_instance job

Completed Validate_true_cache_instance job
60% complete
-----------------
Running Validate_archive_log_mode job
Completed Validate_archive_log_mode job
67% complete
-----------------
Running Prepare_blob job
Completed Prepare_blob job
100% complete
---------- PLUGIN NOTES ----------
Successfully created blob file: /home/oracle/scripts/blob_2024-08-20_04-35-42PM.tar.gz
---------- END OF PLUGIN NOTES ----------
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/P23AI_jt7_yyz/P23AI_jt7_yyz0.log" for further details.
[oracle@dbsdpl24 admin]$

Note: Make sure to transfer: the blob_2024-08-20_04-35-42PM.tar.gz file to the true cache instance. 

 

Configure Listener on the primary instance 

Add the required entries to the listener configuration and then restart the listener.

REGISTRATION_INVITED_NODES_Listener = (10.0.1.6,10.0.1.240)
VALID_NODE_CHECKING_REGISTRATION_LISTENER=OFF

 

Drop DBCS-created database

Using DBCA to delete a database on a True Cache instance.

$ORACLE_HOME/bin/dbca -deleteDatabase -sourceDB TC23AI -forceArchiveLogDeletion -silent

 

Configure True Cache

The next step is to create a true cache instance. With DBCA, we can also create a True Cache instance.

$ORACLE_HOME/bin/dbca -createTrueCache \
-gdbName TC23AI \
-sid TC23AI \
-sourceDBConnectionString dbsdpl24.sub08101943421.cnvcn01.oraclevcn.com:1521/P23AI_jt7_yyz.sub08101943421.cnvcn01.oraclevcn.com \
-trueCacheBlobFromSourceDB /home/oracle/scripts/blob_2024-08-20_04-35-42PM.tar.gz \
-sgaTargetInMB 14848 \
-pgaAggregateTargetInMB 3712 \
-silent -listeners LISTENER

 

Expected output

[oracle@dbsdpl53 scripts]$ $ORACLE_HOME/bin/dbca -createTrueCache \
-gdbName TC23AI \
-sid TC23AI \
-sourceDBConnectionString dbsdpl24.sub08101943421.cnvcn01.oraclevcn.com:1521/P23AI_jt7_yyz.sub08101943421.cnvcn01.oraclevcn.com \
-trueCacheBlobFromSourceDB /home/oracle/scripts/blob_2024-08-20_04-35-42PM.tar.gz \
-sgaTargetInMB 14848 \
-pgaAggregateTargetInMB 3712 \
-silent -listeners LISTENER
Enter Remote DB SYS user password:

Enter password for the source database TDE wallet:

[FATAL] [DBT-10317] Specified SID Name (TC23AI) already exists.
ACTION: Specify a different SID Name that does not already exist.
[oracle@dbsdpl53 scripts]$ vi /etc/oratab
[oracle@dbsdpl53 scripts]$ $ORACLE_HOME/bin/dbca -createTrueCache -gdbName TC23AI -sid TC23AI -sourceDBConnectionString dbsdpl24.sub08101943421.cnvcn01.oraclevc n.com:1521/P23AI_jt7_yyz.sub08101943421.cnvcn01.oraclevcn.com -trueCacheBlobFromSourceDB /home/oracle/scripts/blob_2024-08-20_04-35-42PM.tar.gz -sgaTargetInMB 1 4848 -pgaAggregateTargetInMB 3712 -silent -listeners LISTENER
Enter Remote DB SYS user password:

Enter password for the source database TDE wallet:

[WARNING] [DBT-10331] Specified SID Name (TC23AI) may have a potential conflict with an already existing database on the system.
CAUSE: The specified SID Name without the trailing numeric characters (TC23AI) may have a potential conflict with an already existing database on the system.
ACTION: Specify a different SID Name that does not conflict with existing databases on the system.
Session ID of the current execution is: 5
Log file location: /u01/app/oracle/cfgtoollogs/dbca/TC23AI/trace.log_2024-08-20_05-28-57PM_98530
-----------------
Running Extract_password_file_from_blob_file job
Completed Extract_password_file_from_blob_file job
25% complete
-----------------
Running Create_static_listener job
Skipping. Job is detected as not applicable.
38% complete
-----------------
Running Register_listener job
Completed Register_listener job
50% complete
-----------------
Running Extract_tde_wallet_from_blob_file job
Completed Extract_tde_wallet_from_blob_file job
54% complete
-----------------
Running Setup_required_directories job
Skipping. Job is detected as not applicable.
57% complete
-----------------
Running Create_pfile job
Completed Create_pfile job
61% complete
-----------------
Running Start_nomount_instance job
Completed Start_nomount_instance job
64% complete
-----------------
Running Create_TDE_wallet job
Completed Create_TDE_wallet job
68% complete
-----------------
Running Create_truecache_instance job

Completed Create_truecache_instance job
71% complete
-----------------
Running Add_oratab_entry job
Completed Add_oratab_entry job
75% complete
-----------------
Running Reopen_wallet job
Completed Reopen_wallet job
100% complete
---------- PLUGIN NOTES ----------
Successfully created True Cache.
In order to complete the operation,configure the True Cache database application services from the primary database.
---------- END OF PLUGIN NOTES ----------
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/TC23AI/TC23AI1.log" for further details.

 

After the creation True cache instance status

No data file is needed for this, as everything is managed in memory. Similar to Active Data Guard, archives will push all frequently accessed data.

select open_mode,database_role from v$database;

OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY TRUE CACHE

-- MRP
SQL> select INST_ID,PROCESS,STATUS,THREAD#,SEQUENCE#,BLOCK# from GV$MANAGED_STANDBY;

INST_ID PROCESS STATUS THREAD# SEQUENCE# BLOCK#
---------- --------- -------------------- ---------- ---------- ----------
1 DGRD ALLOCATED 0 0 0
1 DGRD ALLOCATED 0 0 0
1 ARCH CONNECTED 0 0 0
1 ARCH CONNECTED 0 0 0
1 ARCH CONNECTED 0 0 0
1 ARCH CONNECTED 0 0 0
1 RFS IDLE 1 0 0
1 RFS RECEIVING 1 5 1335415
1 RFS IDLE 0 0 0
1 MRP0 APPLYING_LOG 1 5 1335416
1 DGRD ALLOCATED 0 0 0

INST_ID PROCESS STATUS THREAD# SEQUENCE# BLOCK#
---------- --------- -------------------- ---------- ---------- ----------
1 RMI IDLE 0 0 0
1 RMI IDLE 0 0 0
13 rows selected.

 

Conclusion

In a fast-paced world where every millisecond counts, caching is essential, and Oracle’s True Cache is revolutionizing database performance. By accelerating data access and enhancing reliability and efficiency, True Cache empowers businesses to stay competitive and deliver exceptional user experiences. If you’re aiming to boost your database performance, True Cache could be the game-changing solution you’ve been looking for.