Monday, May 5, 2025

Common issue in Golden Gate along with Solution

 Common issue in Golden Gate along with Solution


1. Processes Startup Issues
❗Problem:
GoldenGate processes (like Extract or Replicat) fail to start due to missing parameters, port issues, or environment settings.

🧪 Example:
GGSCI> start extract EXT1
ERROR: Missing required parameter: USERID
✅ Solution:
Check the parameter file:
GGSCI> edit params EXT1
Ensure you have the required lines like:
USERID ggs_admin, PASSWORD ggs_pwd
TABLE schema.table;
USERID ggs_admin, PASSWORD ggs_pwd
TABLE schema.table;
Also, make sure the GoldenGate home and environment variables (like LD_LIBRARY_PATH) are set correctly:
echo $ORACLE_HOME
echo $LD_LIBRARY_PATH
Check if the Manager process is running:
GGSCI> info mgr
GGSCI> start mgr

🔹 2. Data Not Getting Captured
❗Problem:
Extract is running but no data is captured in the trail files.

🧪 Example:
GGSCI> stats extract EXT1, totalsonly
Shows 0 inserts/updates/deletes even though source table has changes.

✅ Solution:
Check if the table is included in the Extract parameter file:
TABLE hr.employees;

Supplemental logging may not be enabled on the source:
ALTER TABLE hr.employees ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
Check if the database is in ARCHIVELOG mode:
ARCHIVE LOG LIST;
Ensure DDL include/exclude rules aren't filtering it out.

🔹 3. Data Not Getting Applied onto Target DB
❗Problem:
Replicat is running, but target database is not getting updated.

🧪 Example:
GGSCI> stats replicat REP1, totalsonly
Shows 0 operations, even though trail files exist.

✅ Solution:
Check if trail file path is correct in Replicat parameters:
EXTTRAIL ./dirdat/aa
Validate table mapping:
MAP hr.employees, TARGET hr.employees;
Check for errors in the report file:
GGSCI> view report REP1
Use logdump to inspect the trail file and confirm it contains valid data.

🔹 4. Data Integrity Issues
❗Problem:
Rows are missing, duplicated, or mismatched between source and target.

🧪 Example:
Target has duplicate rows or missing foreign key entries.

✅ Solution:
Use HANDLECOLLISIONS temporarily for mismatch scenarios during initial sync:
HANDLECOLLISIONS
Use Oracle GoldenGate Veridata or run SQL MINUS to compare source/target data:
SELECT * FROM source_table
MINUS
SELECT * FROM target_table;
If using bidirectional replication, enable REPERROR (default, discard) to avoid looping conflicts and use TRIGGERSUPPRESS.

Use BATCHSQL in Replicat for better performance and consistency on large updates.

Saturday, May 3, 2025

DR Drill in Oracle RAC 19c

🚀 Successfully Completed DR Drill in Oracle RAC 19c! ðŸ”¥
Performing a Disaster Recovery (DR) Drill is a crucial step in ensuring business continuity and validating our DR strategy. Recently, I had the opportunity to execute a DR drill in an Oracle RAC 19c environment, and I wanted to share some key steps and commands used during the process.

Key Steps in DR Drill:
✅ Check Primary Database & Standby Readiness
✅ Simulate Failover & Switchover Scenarios
✅ Perform Role Transition (Primary <-> Standby)
✅ Validate Data Integrity & Performance
✅ Reinstate Original Primary (if required)

Key Oracle Commands Used in DR Drill:

🔹 Check Data Guard Configuration:

DGMGRL> show configuration;
DGMGRL> show database primary_db;
DGMGRL> show database standby_db;

🔹 Perform Switchover to Standby (Planned Activity):

DGMGRL> switchover to standby_db;
🔹 Perform Failover (Unplanned Disaster Recovery):

DGMGRL> failover to standby_db;
🔹 Convert Standby Back to Primary (After Failover):

DGMGRL> reinstate database primary_db;
🔹 Verify Redo Apply & Sync Status:

DGMGRL> show database standby_db status;
🔹 Start Managed Recovery in Standby (If Required):

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
The DR drill was a great success, ensuring that the standby database can seamlessly take over in case of a failure. Regular DR drills help organizations stay prepared for high availability and disaster recovery challenges.

Monday, November 30, 2020

What makes a great DBA?


  What makes a great DBA?
Knowing how to approach and solve performance problems is one of the vital skills.
  • if you want to be a great DBA, you must learn how to solve performance problems 
  • if you want to know how to solve performance problems, you need a step by step process for it
  • if you want to understand the Oracle memory components, you need to study the Oracle memory
  • if you want to understand the workings of the Oracle cursor, you need to study the 7 stages of the Oracle cursors
  • if you want to understand Oracle statistics, you need to study all the Oracle statistics types and how to use them.
  • if you want to feel confident using the AWR, ADDM and ASH, you need to study these topics in detail.
  • if you want to be able to solve any performance problems, you need to know how to approach the performance problems.

Monday, September 14, 2020

How To Enable/Disable Archive Log Mode In Oracle Database

 

How To Enable/Disable Archive Log Mode In Oracle Database


There are 2 types of logging mode in oracle database.


1. Archivelog mode :

In this mode, after the online redo logs are filled , it will move to archive location.


2. Noarchivelog mode :

In this mode, filled online redo logs wont be archives, instead they will be overwritten.



How to Enable archive log mode :

 

SQL > select name,log_mode from v$database;
 
NAME      LOG_MODE
--------- -----------
PROD      NOARCHIVELOG
 

SQL > archive log list
Database log mode              No Archive Mode
Automatic archival             Disbled
Archive destination            /u01/archive/PROD
Oldest online log sequence     506
Next log sequence to archive   513
Current log sequence           513
 


---- make sure db is running in spfile


SQL > alter system set log_archive_dest_1='LOCATION=/u01/archive/PROD' scope=spfile;
database altered.
 

SQL >shutdown  immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
 

SQL > startup mount
ORACLE instance started.
Total System Global Area 6415597568 bytes
Fixed Size                  2170304 bytes
Variable Size             905970240 bytes
Database Buffers         5502926848 bytes
Redo Buffers                4530176 bytes
Database mounted.
 

SQL >alter database archivelog;
 
database altered.
 

SQL >alter database open;
 
database altered.
 

SQL >select name,log_mode from v$database;
 
NAME      LOG_MODE
--------- -----------
PROD      ARCHIVELOG
 

SQL >archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/archive/PROD
Oldest online log sequence     506
Next log sequence to archive   513
Current log sequence           513
 



How to Disable archivelog mode :


SQL >select name,log_mode from v$database;

 

NAME      LOG_MODE

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

PROD      ARCHIVELOG

 


SQL > archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u01/archive/PROD

Oldest online log sequence     506

Next log sequence to archive   513

Current log sequence           513

 

 

SQL > shutdown  immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

 


SQL > startup mount

ORACLE instance started.

Total System Global Area 6415597568 bytes

Fixed Size                  2170304 bytes

Variable Size             905970240 bytes

Database Buffers         5502926848 bytes

Redo Buffers                4530176 bytes

Database mounted.

 


SQL >alter database noarchivelog;

database altered.

SQL >alter database open;

 

database altered.

SQL > select name,log_mode from v$database;

 

NAME      LOG_MODE

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

PROD      NOARCHIVELOG

 


SQL > archive log list

Database log mode              No Archive Mode

Automatic archival             Disbled

Archive destination            /u01/archive/PROD

Oldest online log sequence     506

Next log sequence to archive   513

Current log sequence           513

 



I hope this article helped you. Your suggestions/feedback are most welcome.
Keep learning… Have a great day!!!

How to Rename or Move Redo log files in Oracle

 

How to Rename or Move Redo log files in Oracle


It is possible to move/rename the online redo logs should the need arise. This document will detail the steps required to move/rename the online redo logs in an 12cR2 environment on Linux. These steps also apply to a 10g, and 11gR2 environment.


First we will verify the current location of the online redo log files :


SQL>
SQL>
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/redo03.log
/u01/app/oracle/oradata/ORCL/redo02.log
/u01/app/oracle/oradata/ORCL/redo01.log




We are going to move the online redo logs from /u01/app/oracle/oradata/ORCL/ to /u01/app/oracle/oradata/ORCL/redo/. The redo logs cannot be moved/renamed while the database is online. The database must be in a mount state to move/rename the online redo logs.


First we will shutdown the database and move the online redo logs to their new location :


SQL>
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@orakldba ~]$
[oracle@orakldba ~]$ mv /u01/app/oracle/oradata/ORCL/redo03.log /u01/app/oracle/oradata/ORCL/redo/redo03.log

[oracle@orakldba ~]$ mv /u01/app/oracle/oradata/ORCL/redo02.log /u01/app/oracle/oradata/ORCL/redo/redo02.log

[oracle@orakldba ~]$ mv /u01/app/oracle/oradata/ORCL/redo01.log /u01/app/oracle/oradata/ORCL/redo/redo01.log

[oracle@orakldba ~]$


Next we bring up the database into mount mode and issue ALTER DATABASE RENAME FILE statements to update the data dictionary and control files. The last thing we do is open the database.


SQL>
SQL> startup mount;
ORACLE instance started.
Total System Global Area  536870912 bytes
Fixed Size                  8622776 bytes
Variable Size             448793928 bytes
Database Buffers           75497472 bytes
Redo Buffers                3956736 bytes
Database mounted.


SQL>
SQL>
SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/redo03.log' to '/u01/app/oracle/oradata/ORCL/redo/redo03.log';

Database altered.


SQL>
SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/redo02.log' to '/u01/app/oracle/oradata/ORCL/redo/redo02.log';

Database altered.


SQL>
SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/redo01.log' to '/u01/app/oracle/oradata/ORCL/redo/redo01.log';

Database altered.


SQL>
SQL> alter database open;

Database altered.




We can see that the changes were made in the data dictionary by issuing the following query again.


SQL>
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/redo/redo03.log
/u01/app/oracle/oradata/ORCL/redo/redo02.log
/u01/app/oracle/oradata/ORCL/redo/redo01.log

SQL>






I hope this article helped you. Your suggestions/feedback are most welcome.
Keep learning… Have a great day!!!

How To Rename Or Move A Datafile In Oracle

 

How To Rename Or Move A Datafile In Oracle

 

In Oracle 12c :

 

If you are in 12c version ,then renaming a datafile can be done online, without making the datafile offline.

 

SQL>
SQL> select file_name,tablespace_name,online_status from dba_data_files where tablespace_name='SHASHI';
FILE_NAME                                                              TABLESPACE_NAME                ONLINE_
---------------------------------------------------------------------- ------------------------------ -------
/u01/app/oracle/oradata/ORCL/shashi.dbf                                SHASHI                         ONLINE

 

SQL>
SQL>
SQL> alter database move datafile '/u01/app/oracle/oradata/ORCL/shashi.dbf' to '/home/oracle/shashi01.dbf';
Database altered.

 

SQL>
SQL>
SQL> select file_name,tablespace_name,online_status from dba_data_files where tablespace_name='SHASHI';
FILE_NAME                                                              TABLESPACE_NAME                ONLINE_
---------------------------------------------------------------------- ------------------------------ -------
/home/oracle/shashi01.dbf                                              SHASHI                         ONLINE

 

 

 

In 11g and previous versions :

 

If you are in 11g or previous version, you need to follow below steps to move or rename a datafile without shutting down the database.

 

        First make the datafile offline.
        move the datafile as os level.
        Rename the datafile at database level.
        recover the particular datafile.
        make the datafile online.


SQL>
SQL> set lines 200 pages 100
SQL> col FILE_NAME for a70
SQL>
SQL> select file_name,tablespace_name,online_status from dba_data_files where tablespace_name='SHASHI';
FILE_NAME                                                              TABLESPACE_NAME                ONLINE_
---------------------------------------------------------------------- ------------------------------ -------
/u01/app/oracle/oradata/ORCL/shashi.dbf                                SHASHI                         ONLINE

 

SQL>
SQL>
SQL> alter database datafile '/u01/app/oracle/oradata/ORCL/shashi.dbf' offline;
Database altered.

 

SQL>
SQL>
SQL> select file_name,tablespace_name,online_status from dba_data_files where tablespace_name='SHASHI';
FILE_NAME                                                              TABLESPACE_NAME                ONLINE_
---------------------------------------------------------------------- ------------------------------ -------
/u01/app/oracle/oradata/ORCL/shashi.dbf                                SHASHI                         RECOVER

 

SQL>
SQL>
SQL> !mv /u01/app/oracle/oradata/ORCL/shashi.dbf /home/oracle/shashi01.dbf

 

SQL>
SQL>
SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/shashi.dbf' to '/home/oracle/shashi01.dbf';
Database altered.

 

SQL>
SQL>
SQL> alter database datafile '/home/oracle/shashi01.dbf' online;
alter database datafile '/home/oracle/shashi01.dbf' online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/home/oracle/shashi01.dbf'

 

SQL>
SQL>
SQL> recover datafile 6;
Media recovery complete.

 

SQL>
SQL>
SQL>
SQL> alter database datafile '/home/oracle/shashi01.dbf' online;
Database altered.

 

SQL>
SQL>
SQL> select file_name,tablespace_name,online_status from dba_data_files where tablespace_name='SHASHI';
FILE_NAME                                                              TABLESPACE_NAME                ONLINE_
---------------------------------------------------------------------- ------------------------------ -------
/home/oracle/shashi01.dbf                                              SHASHI                         ONLINE

 

 

 

 

I hope this article helped you. Your suggestions/feedback are most welcome.
Keep learning… Have a great day!!!