Stopping Global cache blocks lost metric



From Metalink


https://support.oracle.com/epmos/faces/DocumentDisplay?id=2543134.1&displayIndex=1


SOLUTION

cd <OMS_HOME>/bin

$emcli login -username=sysman

$emcli sync

$emcli modify_collection_schedule -targetType="oracle_database" -targetNames="<DBInstanceName>" -collectionName="rac_global_cache_10i" -collectionStatus=Disabled -preview="N"

Real world example

[oracle@oms1 bin]$ $OMS_HOME/bin/emcli login -username=sysman -password=.......

Login successful

[oracle@oms1 bin]$ $OMS_HOME/bin/emcli sync

Synchronized successfully

[oracle@oms1 bin]$ emcli modify_collection_schedule -targetType="oracle_database" -collectionName="rac_global_cache_10i" -collectionStatus=Disabled -preview="N" -targetNames="DemoDB"

Collection Name : rac_global_cache_10i

DemoDB : Collection Schedule updated successfully.

The collection schedule of the following metrics might be affected :

rac_global_cache



DBCLI quick notes

Quick notes re dbcli commands - 

[root@ ~]# dbcli describe-system

DbSystem Information
----------------------------------------------------------------
ID: c13eb0d0-...........
Platform: Vmdb
Data Disk Count: 8
CPU Core Count: 2
Created: August 3, 2022 4:49:59 PM BST

System Information
----------------------------------------------------------------
Name: gi2iuoaa
Domain Name: s003.ldntier4prd.oraclevcn.com
Time Zone: Europe/London
DB Edition: EeHp
DNS Servers:
NTP Servers: 169........

Disk Group Information
----------------------------------------------------------------
DG Name Redundancy Percentage
------------------------- ------------------------- ------------
Data External 100
Reco External 100

[root@~]# dbcli describe-database --dbName TIER......

#
Database details
----------------------------------------------------------------
ID: 24d80124-c9da-4037-b077-a9...
Description: TIER4P
DB Name: TIER4P
DB Version: 19.16.0.0.0
DB Type: Si
DB Edition: EE_HP
DBID: 2309127357
Instance Only Database: false
CDB: true
PDB Name: LLINKP
PDB Admin User Name: pdbuser
Class: Oltp
Shape:
Storage: ASM
DB Redundancy:
CharacterSet: AL32UTF8
National CharacterSet: UTF8
Language: AMERICAN
Territory: AMERICA
Home ID: bad88939-ce80-4691-9783-0f6ac6bedef8
Console Enabled: false
Level 0 Backup Day: Sunday
AutoBackup Enabled: false
Created: August 3, 2022 4:50:00 PM BST
DB Domain Name: s003.ldntier4prd.oraclevcn.com


[root@ ~]# dbcli list-dbstorages

ID Type DBUnique Name Status
---------------------------------------- ------ -------------------- ----------
2c5c6fe0-4497-ecc Asm TIm Configured

[root@ ~]# dbcli describe-dbstorage -i 2c5c6fe0-4497-ecc

Database Storage details
----------------------------------------------------------------
ID: 2c5c6fe0-4497-
DB Name: TIER4P
DBUnique Name: TIER4P_lhr2rm
DB Resource ID: 24d80124-c9da-40
Storage Type: ASM
DATA:
Location: +DATA/TIER4P_lhr2rm
Used Space: 993.42GB
Free Space: 3.02TB
REDO:
Location: +RECO/TIER4P_lhr2rm
Used Space: 36.98GB
Free Space: 782.88GB
RECO:
Location: +RECO/TIER4P_lhr2rm
Used Space: 36.98GB
Free Space: 782.88GB
State: ResourceState(status=Configured)
Created: August 3, 2022 4:50:01 PM BST
UpdatedTime: August 3, 2022 5:06:46 PM BST

[root@ ~]# dbcli describe-database --dbid 24d80124..................

Database details
----------------------------------------------------------------
ID: 24d80124-c...
Description: TIER4P
DB Name: TIER4P
DB Version: 19.16.0.0.0
DB Type: Si
DB Edition: EE_HP
DBID: 2309127357
Instance Only Database: false
CDB: true
PDB Name: LLINKP
PDB Admin User Name: pdbuser
Class: Oltp
Shape:
Storage: ASM
DB Redundancy:
CharacterSet: AL32UTF8
National CharacterSet: UTF8
Language: AMERICAN
Territory: AMERICA
Home ID: bad88939-c
Console Enabled: false
Level 0 Backup Day: Sunday
AutoBackup Enabled: false
Created: August 3, 2022 4:50:00 PM BST
DB Domain Name: s003.ldntier4prd.oraclevcn.com

[root@prd01tier4-dbs ~]# dbcli list-dbhomes

ID Name DB Version Home Location Status

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

........9000_home1 19.16.0.0.0 /u01/app/oracle/product/19.0.0.0/dbhome_1 Configured


[root@ ~]# dbcli describe-dbhome -i ......

DB Home details
----------------------------------------------------------------
ID: bad88939-
Name: OraDB19000_home1
Version: 19.16.0.0.0
Home Location: /u01/app/oracle/product/19.0.0.0/dbhome_1
Status: Configured
Created: August 3, 2022 4:50:00 PM BST
Database Edition: EE_HP
Unified Auditing: false


Oracle "Floating" Services

Running a two node RAC 19c cluster.

Also, running a two node Data Guard 19c environment to provide resilience for the primary environment.

If you were to do a Data Guard switch you would need to manually change any connection strings to reflect the fact that that Data Guard environment is the "new" primary otherwise applications or SQL Developer / TOAD etc will be pointing to the "original" i.e now standby side.

However, there is a way to have your connections "float" between your Primary and Secondary environments. 

Please note - SCAN listeners, RAC, DataGuard, TDE etc outside of this post.

++++++++++++++++++++

Example values - very simplistic setup for clarity :

ENV_lhr34g - database. ENV1 & ENV2 (RAC instances)    - pdbs read write

ENV_lhr456 - database. ENV1 & ENV2 (Data Guard env)  - pdbs read only (active dataguard)

TEST - pluggable database

TSTS - pluggable database service (example)

db-1 & db2 (two nodes on 'Primary' side) 

db-3 & db-4 (two nodes on 'Secondary' i.e. 'DataGuard' side)

Remember after "switch over" these will swap.

env1-scan.example.com - SCAN listener name on primary

env2-scan.example.com - SCAN listener name on secondary (Data Guard side)

++++++++++++++++++++

Added the service (after a bit of trial and error with syntax and options) -

[oracle@db-1 ~]$ srvctl add service -d ENV_lhr34g -s TSTS -pdb TEST -l primary -r "ENV1,ENV2"

Started the service -

[oracle@db-1 ~]$ srvctl start service -service TSTS -db ENV_lhr34g

Check

[oracle@db-1 ~]$ srvctl status database -db ENV_lhr34g -v

Instance ENV1 is running on node db-1 with online services TSTS. Instance status: Open.
Instance ENV2 is running on node db-2 with online services TSTS. Instance status: Open.

 Added a "TEST" entry to the tnsnames.ora on both primary nodes to test connection.

Amended a default entry in the tnsnames.ora - you might want to adjust this entry to suit your environment.

TEST =(DESCRIPTION=(SDU=65535)(SEND_BUF_SIZE=10485760)(RECV_BUF_SIZE=10485760)(ADDRESS_LIST=(FAILOVER = ON)(LOAD_BALANCE = OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=env1-scan.example.com)(PORT=1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = env2-scan.example.com)(PORT = 1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TSTS.example.com)))

Login with that entry

sqlplus user1/password@TEST

SQL> select host_name from gv$instance where instance_number=userenv('instance');

HOST_NAME
----------------------------------------------------------------
db-1

Trying logging in and out a few times and SCAN listener will point you to either db-1 or db-2

Now amend the Data Guard side 

Add an entry on the DataGuard side but do not start the service - note the database name is the one on the DataGuard side.

[oracle@db-3 ~]$ srvctl add service -d ENV_lhr456 -s TSTS -pdb TEST -l primary -r "ENV1,ENV2"

DO NOT start the service this will happen when you do a switchover !

(If you try and start the service prior to switching over it will fail with an error and the only way to start it, is to stop the service on the primary first and then start the service on the Data Guard side. However, that would mean  you would connect to the read only pdb on the Data Guard side and not the primary database. One way to ensure you always connect to the primary is to change the ordering of the HOST= option in the service name in the tnsnames.ora file so that the connection is correct - something I have not had a chance to try but may update this at a later date. If you do want to connect to the read only pdb on the secondary suggest an alternative service name is created. For simplicity suggest the service is only started on the primary - let the dataguard switchover look after it).

Add a tnsnames entry as per the primary side on both Data Guard nodes.

As the grid user you might want to run "crsctl stat res -t" to check the status of the services.

e.g. 

ora.env_lhr346.tsts.svc

1 OFFLINE OFFLINE STABLE
2 OFFLINE OFFLINE STABLE

Will be "online online" if this is primary

To confirm your pdb connection is working simply do a Data Guard switchover (outside of the scope of this ) but for Oracle cloud simply a case of going into the Cloud console and enabling switchover.

Once the switchover is complete - again check the connection but this time, the sqlplus connection will report the "new" primary (try logging in and out a few times to confirm you see db-3 and db-4 the new servers you should be connecting to). 

Also check "crsctl stat res -t" as above to confirm the service is now online.


sqlplus user1/password@TEST

SQL> select host_name from gv$instance where instance_number=userenv('instance');

HOST_NAME
----------------------------------------------------------------
db-3

SQL> show con_name;

CON_NAME
------------------------------
TEST

 As always, any improvements, amendments or correction please let me know and always test on a "sandbox" environment prior to any production changes.