True Cache is an in-memory, read-only replica database, similar to Oracle Active Data Guard but without disk storage.

On this activity we are going to create a True Cache DB but I’m limited to the memory of my lab and I can not create a huge DB to test, so DB needs to be small.
We will also will be following “Configuring True Cache Manually”
I tried “True Cache Installation & Configuration On Database Base System (Doc ID 3031433.1)” but I was having many complains about primary not being on archive log mode (which it is), but I guess issue is because I’m not running this on an Engineered System? who knows….

Below are my machine hostnames:

Primary Database Server: ol8_23ai
Primary Instance: dbtest23

True Cache instance Server: ol8_23ai_stb
True Cache instance: tcdbtest

1:- Both need to be on /etc/hosts:

[root@ol8_23ai ~]# grep ol8_23ai /etc/hosts
192.168.56.121 ol8_23ai 	ol8_23ai.localdomain
192.168.56.122 ol8_23ai_stb 	ol8_23ai_stb.localdomain
[root@ol8_23ai ~]#

[root@ol8_23ai_stb ~]# grep ol8_23ai /etc/hosts
192.168.56.121 ol8_23ai 	ol8_23ai.localdomain
192.168.56.122 ol8_23ai_stb 	ol8_23ai_stb.localdomain
[root@ol8_23ai_stb ~]#

2:- Make sure primary DB is in archive more:

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/database/DBTEST23/archivelog
Oldest online log sequence     39
Next log sequence to archive   39
Current log sequence           38
SQL>

3:- Copy password file to True Cache node:

[oracle@ol8_23ai ~]$ scp -p /u01/app/oracle/product/23ai/db_home1/dbs/orapwdbtest23 ol8_23ai_stb:/u01/app/oracle/product/23ai/db_home1/dbs/orapwtcdbtest
oracle@ol8_23ai_stb's password:
orapwdbtest23                                                                                                                  100% 2048   858.5KB/s   00:00
[oracle@ol8_23ai ~]$

4:- Add to tnsnames.ora on both primary and true cache node:

DBTEST23 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ol8_23ai)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dbtest23)
    )
  )
  
TCDBTEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ol8_23ai_stb)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = tcdbtest)
    )
  )  
  
LISTENER_PRIMARY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ol8_23ai)(PORT=1521))
  )


LISTENER_TRUE_CACHE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ol8_23ai_stb)(PORT=1521))
  )

5:- Configure Listener on the primary instance:

add the following lines on listener.ora (here my IP's):

VALID_NODE_CHECKING_REGISTRATION_LISTENER = OFF
REGISTRATION_INVITED_NODES_LISTENER = (192.168.56.121,192.168.56.122)

** restart listener

6:- Update local listener on True Cache node:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = TCDBTEST)
      (ORACLE_HOME = /u01/app/oracle/product/23ai/db_home1)
    (SID_NAME = tcdbtest)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ol8_23ai_stb)(PORT = 1521))
  )

7:- Create pfile for True Cache instance:

[oracle@ol8_23ai_stb ~]$ cat /u01/app/oracle/product/23ai/db_home1/dbs/initTCDBTEST.ora
true_cache=true
db_name=dbtest23
db_unique_name=tcdbtest
sga_target=1504M
fal_server=dbtest23
fal_client=tcdbtest
instance_name=tcdbtest
db_create_file_dest=/u02/database/
local_listener=listener
remote_listener=listener_primary
_exadata_feature_on=true
[oracle@ol8_23ai_stb ~]$

8:- Start True Cache DB:

[oracle@ol8_23ai_stb ~]$ . oraenv
ORACLE_SID = [tcdbtest] ? tcdbtest

[oracle@ol8_23ai_stb ~]$ sqlplus / as sysdba

SQL>  startup nomount pfile=/u01/app/oracle/product/23ai/db_home1/dbs/initTCDBTEST.ora;
ORACLE instance started.

Total System Global Area 1566010568 bytes
Fixed Size                  5360840 bytes
Variable Size             402653184 bytes
Database Buffers         1157627904 bytes
Redo Buffers                 368640 bytes
SQL>

9:- Create True Cache:

SQL> CREATE TRUE CACHE;
True Cache created.
SQL>

10:- How to Stop / Start db?:

Just shutdown/startup:

SQL> shutdown immediate
True Cache instance shut down.

SQL> startup
ORACLE instance started.
Total System Global Area 1566010568 bytes
Fixed Size                  5360840 bytes
Variable Size             402653184 bytes
Database Buffers         1157627904 bytes
Redo Buffers                 368640 bytes
Database mounted.
Database opened.
SQL>


set pages 999
set lines 110
col HOST format a18
col INST# format a4
col INST_NAME format a10
col status format a10
col DB_ROLE format a17
col open_mode format a21
col startup_time format a20
alter session set nls_date_format="DD-MON-YYYY HH24:MI:SS";
--set time on
select decode(gi.inst_id,i.instance_number, '*'||gi.inst_id, gi.inst_id) as INST#, decode(INSTR(gi.HOST_NAME,'.'),0,gi.host_name,SUBSTR(gi.HOST_NAME,1,INSTR(gi.HOST_NAME,'.')-1)) as HOST, gi.instance_name as INST_NAME, gi.status, d.database_role as DB_ROLE, d.open_mode, gi.startup_time from gv$instance gi, v$instance i, gv$database d where gi.inst_id=d.inst_id order by 2;


INST HOST               INST_NAME  STATUS     DB_ROLE           OPEN_MODE             STARTUP_TIME
---- ------------------ ---------- ---------- ----------------- --------------------- --------------------
*1   ol8_23ai_stb       tcdbtest   OPEN       TRUE CACHE        READ ONLY WITH APPLY  11-NOV-2024 22:16:40

11:- Verify True Cache:

On True Cache:

   INST_ID PROCESS   MRP_STAT         THREAD#  SEQUENCE#     BLOCK#
---------- --------- ------------- ---------- ---------- ----------
         1 MRP0      APPLYING_LOG           1         43        668
SQL> /
   INST_ID PROCESS   MRP_STAT         THREAD#  SEQUENCE#     BLOCK#
---------- --------- ------------- ---------- ---------- ----------
         1 MRP0      APPLYING_LOG           1         43        670



On Primary:

SQL> alter system switch logfile;
System altered.


On True Cache:


SQL> /

   INST_ID PROCESS   MRP_STAT         THREAD#  SEQUENCE#     BLOCK#
---------- --------- ------------- ---------- ---------- ----------
         1 MRP0      APPLYING_LOG           1         44         20
         1 RFS       WRITING                1         44         21

That’s it! you can create True cache services following THIS, but this was not the goal of this activity.

Last modified: 12 November 2024

Author

Comments

Write a Reply or Comment

Your email address will not be published.