EM Express 19c Flash-Based for CDB/PDB


During database creation, DBCA enables Enterprise Manager Express (EM Express) for being created CDB, not for PDB. We have to enable it by ourselves. In this post, you can see steps that you should take to start EM express which is dedicated for a CDB/PDB.



Acess URL : https://hostname-or-ipaddress:5501/em


Function used : 

1. https

2. http

[oracle@west01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Aug 11 13:31:02 2020

Version 19.8.0.0.0

Copyright (c) 1982, 2020, Oracle.  All rights reserved.


Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.8.0.0.0

SQL> show con_name

CON_NAME

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

CDB$ROOT

SQL> select dbms_xdb_config.gethttpsport() from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()

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

                            0

SQL> exec dbms_xdb_config.sethttpsport(5500);

PL/SQL procedure successfully completed.

SQL>  select dbms_xdb_config.gethttpsport() from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()

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

                          5500


SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 WORAVRPDB1                     READ WRITE NO

SQL> alter session set container=WORAVRPDB1;

Session altered.

SQL> show con_name

CON_NAME

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

WORAVRPDB1

SQL> select dbms_xdb_config.gethttpsport() from dual;


DBMS_XDB_CONFIG.GETHTTPSPORT()

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

                             0

SQL> exec dbms_xdb_config.sethttpsport(5501);

PL/SQL procedure successfully completed.

SQL>  select dbms_xdb_config.gethttpsport() from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()

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

                          5501


EM Express 19c  Flash-Based



Since Oracle database 19c, we have a new UI of Enterprise Manager Express (EM Express) which is based on Java JET technology.


I installed Oracle 19c database. I logged as System user into Enterprise Manager. I want to create new user and set permissions to him, but the Server tab is missing. There is only Performance tab.


As you can see, some functions we used in EM Express 12c are not available anymore in the new UI. On the positive side, it responds very fast, very express. But maybe it's too simplified to be useful for DBA. Luckily, we can revert the UI back to flash-based.

SQL> @?/rdbms/admin/execemx emx


Session altered.


no rows selected

old   1: select nvl( '&1','omx') p1 from dual

new   1: select nvl( 'emx','omx') p1 from dual

P1

---

emx

PL/SQL procedure successfully completed.

Session altered.

After that, please re-logon to make it work.


To go back to Java JET based UI, you can do this:

SQL> @?/rdbms/admin/execemx omx

Session altered.

no rows selected

old   1: select nvl( '&1','omx') p1 from dual

new   1: select nvl( 'omx','omx') p1 from dual

P1

---

omx

PL/SQL procedure successfully completed.

Session altered.

https://docs.oracle.com/en/database/oracle/oracle-database/19/admqs/getting-started-with-database-administration.html#GUID-F1C3023C-35DC-4086-A63F-F58F3FFC2923


ASMLib Scanned No Disks on Boot


ASMLib seems to be started too soon to scan iSCSI disks which may not be ready on boot in Enterprise Linux 7.


[root@woravr01 ~]# oracleasm listdisks

No Result here ...

lets Check the status of ASM :

[root@woravr01 ~]# oracleasm status

Checking if ASM is loaded: yes

Checking if /dev/oracleasm is mounted: yes



[root@woravr01 ~]# systemctl status oracleasm

● oracleasm.service - Load oracleasm Modules

   Loaded: loaded (/usr/lib/systemd/system/oracleasm.service; enabled; vendor preset: disabled)

   Active: active (exited) since Tue 2020-08-11 12:44:06 IST; 2min 39s ago

  Process: 1494 ExecStart=/usr/sbin/oracleasm.init start_sysctl (code=exited, status=0/SUCCESS)

 Main PID: 1494 (code=exited, status=0/SUCCESS)

    Tasks: 0

   CGroup: /system.slice/oracleasm.service


Aug 11 12:44:03 woravr01.oravr.in systemd[1]: Starting Load oracleasm Modules...

Aug 11 12:44:06 woravr01.oravr.in oracleasm.init[1494]: Initializing the Oracle ASMLib driver: OK

Aug 11 12:44:06 woravr01.oravr.in oracleasm.init[1494]: Scanning the system for Oracle ASMLib disks: OK

Aug 11 12:44:06 woravr01.oravr.in systemd[1]: Started Load oracleasm Modules.

[root@woravr01 ~]#




Let's see some background information of ASMLib Everything looks Good

[root@woravr01 ~]#  oracleasm configure

ORACLEASM_ENABLED=true

ORACLEASM_UID=oracle

ORACLEASM_GID=asmadmin

ORACLEASM_SCANBOOT=true

ORACLEASM_SCANORDER=""

ORACLEASM_SCANEXCLUDE=""

ORACLEASM_SCAN_DIRECTORIES=""

ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"



[root@woravr01 ~]# cat /etc/sysconfig/oracleasm

#

# This is a configuration file for automatic loading of the Oracle

# Automatic Storage Management library kernel driver.  It is generated

# By running /etc/init.d/oracleasm configure.  Please use that method

# to modify this file

#

# ORACLEASM_ENABLED: 'true' means to load the driver on boot.

ORACLEASM_ENABLED=true

# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.

ORACLEASM_UID=grid

# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.

ORACLEASM_GID=asmadmin

# ORACLEASM_SCANBOOT: 'true' means scan for ASM disks on boot.

ORACLEASM_SCANBOOT=true

# ORACLEASM_SCANORDER: Matching patterns to order disk scanning

ORACLEASM_SCANORDER=""

# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan

ORACLEASM_SCANEXCLUDE=""

# ORACLEASM_SCAN_DIRECTORIES: Scan disks under these directories

ORACLEASM_SCAN_DIRECTORIES=""

# ORACLEASM_USE_LOGICAL_BLOCK_SIZE: 'true' means use the logical block size

# reported by the underlying disk instead of the physical. The default

# is 'false'

ORACLEASM_USE_LOGICAL_BLOCK_SIZE=false





oracleasm is running well, but it scanned nothing on boot . This is because oracleasm started before the iSCSI storage is fully started by the server. So all we need to do is to re-arrange the initialization order.

We re-arrange the boot order by adding the following lines on "oracleasm.service"

[root@woravr01 ~]# vi /usr/lib/systemd/system/oracleasm.service

[Unit]

Description=Load oracleasm Modules

Requires=multipathd.service iscsi.service

After=multipathd.service iscsi.service

[Service]

Type=oneshot

RemainAfterExit=yes

ExecStart=/usr/sbin/oracleasm.init start_sysctl

ExecStop=/usr/sbin/oracleasm.init stop_sysctl

ExecReload=/usr/sbin/oracleasm.init restart_sysctl

[Install]

WantedBy=multi-user.target

~

--End 



reboot the all nodes :

[root@woravr01 ~] reboot

[root@woravr02 ~] reboot


[root@woravr01 ~]# oracleasm listdisks

ACFS

DATA

FRA

OCR

[root@woravr02 ~]# oracleasm listdisks

ACFS

DATA

FRA

OCR



Database Security for Audit





Database auditing is the activity of monitoring and recording configured database actions from database users and non database users, to ensure the security of the databases.

An administrator can perform auditing on individual actions, such as the type of Structured Query Language (SQL) statement executed, or on combinations of data that can include the user name, application or time stamp, for example. Auditors need to audit for both successful and failed activities, and include or exclude specific users from the audit:



Good security requires physical access control, reliable personnel, trustworthy installation and configuration procedures, secure communications, and control of database operations such as selecting, viewing, updating, or deleting database records. Since some of these requirements involve applications or stored procedures as well as human action, security procedures must also account for how these programs are developed and dealt with.

Types of risk:

Mistake         :
Failure to maintain or operate the database as required leads to accidental disclosure of information, and unauthorized changes lead to unauthorized and accidental disclosures, inserts, updates or deletions.
Misuse          :
Failure to maintain access rights to the database leads to abuse of privileged access and leakage of information.
Malicious action:
Failure to maintain a secure, logical setup of the database leads to data theft or a denial-of-service (DoS) attack.
Com

Types of Common Vulnerabilities :



Phishing
is an e-mail fraud method in which the perpetrator sends out legitimate-looking emails in an attempt to gather personal and financial information from recipients. Typically, the messages appear to come from well-known and trustworthy web sites. Web sites that are frequently spoofed by phishers include PayPal, eBay, MSN, Yahoo and Best Buy, for example.
SQL injection
is a technique used to take advantage of nonvalidated input vulnerabilities to pass SQL commands through a web application for execution by a back-end database. Attackers take advantage of the fact that programmers often chain together SQL commands with user-provided parameters and, therefore, can embed SQL commands inside these parameters. The result is that the attacker can execute arbitrary SQL queries and/or commands on the back-end database server through the web application.
Data exfiltration :
is the unauthorized copying, transfer or retrieval of data from a computer or server. Data exfiltration is a malicious activity performed through various techniques, typically by cybercriminals over the Internet or other network. Data exfiltration is also known as data extrusion, data exportation or data theft.
Staging server :
is a server that enables assembling, deploying and testing a software or web site on a server instance, similar to the production server. Typically, software or a web site is deployed on the staging server from the development server when development is complete. A staging server helps to identify the software or web site behavior, experience and performance as it will be visible on the production server. This helps software developers or quality assurance (QA) staff identify and resolve any problems, bugs, performance or usability issues, or other issues before the software or web site is deployed on the production server. The staging server can be a staging database server, staging web site server or staging application server, for example. Analyzing data




Analyzing database configuration is critical to determine vulnerabilities and assure the standard auditing. Database auditing includes:

. Finding sensitive data and privileges
. Preventing data access
. Validating that detection and alert mechanisms are in place


Data redaction:
provides selective, on-the-fly redaction of sensitive data in SQL query results, prior to application display, so that unauthorized users cannot view the sensitive data. It enables consistent redaction of database columns across application modules accessing the same database information. Data redaction minimizes changes to applications because it does not alter actual data in internal database buffers, caches or storage, and it preserves the original data type and formatting when transformed data are returned to the application. Data redaction has no impact on database operational activities, such as backup and restore, upgrade, and patch, and on high-availability clusters.
Data masking:
obfuscates sensitive data by replacing them with other data—typically characters that will meet the requirements of a system designed to test or still work with the masked results. Masking ensures that vital parts of personally identifiable information (PII), such as the first five digits of a social security number, are obscured or otherwise deidentified.
Data encryption:
involves converting and transforming data into scrambled, often unreadable, ciphertext using nonreadable mathematical calculations and algorithms. Restoring the message requires a corresponding decryption algorithm and the original encryption key.t


1. Secure Installation and Configuration Checklist

Default privileged Oracle accounts continue to be the highest risk issue commonly encountered. It is an easy issue to fix and prevent. After installation, Oracle has a number of default accounts, each with a default preset value. Following database install, the Oracle database configuration assistant (DBCA) automatically locks and expires the majority of the default database user accounts. Additionally, DBCA changes the SYSTEM account to the value specified during the installation routine.

If an Oracle database is manually installed, the DBCA never executes, and those dangerous default privileged accounts are never locked and expired. By default, their password is the same as their username. These will be the first credentials that a hacker will attempt to use to connect to the database. As a best practice, each of these accounts should be configured with a strong unique password, and if an account is not required, it should be locked and expired.

Install only what is required.

Do a custom installation. Avoid installing options and products you do not need. Choose to install only those additional products and options, in addition to the database server, that you require. Or, if you choose to do a typical installation instead, then improve your security after the installation processes finish, by removing the options and products you do not need.
   
Lock and expire default user accounts.
   
Oracle Database installs with many default (preset) database server user accounts. Upon the successful creation of a database server instance, the Database Configuration Assistant automatically locks and expires most default database user accounts.
   
    UserList : ('ANONYMOUS' ,'APEX_040200' ,'APEX_PUBLIC_USER' ,'APPQOSSYS' ,'AUDSYS' ,'BI' ,'CTXSYS' ,'DBSNMP' ,'DIP' ,'DVF' ,'DVSYS' ,'EXFSYS' ,'FLOWS_FILES' ,'GSMADMIN_INTERNAL' ,'GSMCATUSER' ,'GSMUSER' ,'HR' ,'IX' ,'LBACSYS' ,'MDDATA' ,'MDSYS' ,'OE' ,'ORACLE_OCM' ,'ORDDATA' ,'ORDPLUGINS' ,'ORDSYS' ,'OUTLN' ,'PM' ,'SCOTT' ,'SH' ,'SI_INFORMTN_SCHEMA' ,'SPATIAL_CSW_ADMIN_USR' ,'SPATIAL_WFS_ADMIN_USR' ,'SYS' ,'SYSBACKUP' ,'SYSDG' ,'SYSKM' ,'SYSTEM' ,'WMSYS' ,'XDB' ,'SYSMAN' ,'RMAN' ,'RMAN_BACKUP' ,'OWBSYS' ,'OWBSYS_AUDIT' ,'APEX_030200' ,'MGMT_VIEW' ,'OJVMSYS')
   
    So, how to find Oracle built-in accounts with "default passwords" ?

    SQL> select * FROM DBA_USERS_WITH_DEFPWD ;
    SQL> select username,last_login,oracle_maintained from dba_users where oracle_maintained='Y';
    SQL> select name, astatus  from sys.user$ where name='ORDDATA';
   
    List of Default password : http://www.petefinnigan.com/default/oracle_default_passwords.htm
   
2.Restrict operating system access.

Limit the number of operating system users.
Limit the privileges of the operating system accounts (administrative, root-privileged, or DBA) on the Oracle Database host (computer) to the fewest and least powerful privileges required for each user.

Disallow modifying the default permissions for the Oracle Database home (installation) directory or its contents, even by privileged operating system users or the Oracle owner.
Restrict symbolic links. Ensure that when any path or file to the database is provided, neither that file nor any part of that path is modifiable by an untrusted user. The file and all components of the path should be owned by the DBA or some trusted account, such as root. This recommendation applies to all types of files, such as data files, log files, trace files, external tables, bfiles, and so on.
   
4. Restrict network access.
 https://docs.oracle.com/cd/B19306_01/network.102/b14266/checklis.htm#i1011179
   
   
5. Apply all security patches and workarounds.
   
Plug every security hole or flaw as soon as corrective action is identified. Always apply all relevant and current security patches for both the host operating system and Oracle Database, and for all installed Oracle Database options and components.
   
    https://www.oracle.com/security-alerts/
   

6. Audit PUBLIC Role for Identification of Unnecessary Privileges

In Oracle, extended routines exist that allow minimally privileged users to execute functions that they otherwise would not be able to execute. These extended routines are called packages, and are roughly equivalent to Extended Stored Procedures in Microsoft SQL Server. A special role, called PUBLIC, acts as a default role assigned to every user in the Oracle database. Any database user can execute privileges that are granted to PUBLIC. This is commonly exploited for database privilege escalation.

 These packages and subtypes should be revoked from PUBLIC and made executable for an application only when absolutely necessary.
   
7. Database Auditing
   
Audit SYS operations:
By default, Oracle databases do not audit SQL commands executed by the privileged SYS and users connecting with SYSDBA or SYSOPER privileges. If a database is hacked, these privileges are going to be the hacker’s first target. Fortunately, auditing SQL commands of these privileged users is very simple: sqlplus> alter system set audit_sys_operations=true scope=spfile.

Enable database auditing:
Again, by default, Oracle auditing of SQL commands is not enabled. Auditing should be turned on for all SQL commands. Database auditing is turned on with the audit_trail parameter: sqlplus> alter system set audit_trail=DB, EXTENDED scope=spfile. (Note: The command enables auditing from the database, but not the database vault information, into the table SYS. AUD$.) There are actually four database auditing types: OS, DB, EXTENDED and XML.

Enable auditing IMP OBJ:
Once auditing has been enabled, it can be turned on for objects where an audit trail is important.
       
8. Logon/Logoff Trigger
   
9. Password and Profile

Oracle provides fairly robust password management for Oracle logins. Unfortunately, none of these are applied in the default Oracle account profile.

In Oracle, logins are assigned an account policy through an Oracle profile. Every login can be applied to only one Oracle profile. If no Oracle profile is specified when the login is created, it is assigned the default Oracle profile.
   
Password complexity verification—Without a password complexity verification function, users most likely choose simple dictionary words that are easy to remember and easy for a hacker to guess. In Oracle, a user Procedural Language (PL)/SQL script must be set to check the complexity of a user’s password. In general, the password verification function should ensure that users’ passwords incorporate.
   
Resource Parameter

SESSIONS_PER_USER   : Specify the number of concurrent sessions to which you want to limit the user.
CPU_PER_SESSION     : Specify the CPU time limit for a session, expressed in hundredth of seconds.
CPU_PER_CALL        : Specify the CPU time limit for a call (a parse, execute, or fetch), expressed in hundredths of seconds.
CONNECT_TIME        : Specify the total elapsed time limit for a session, expressed in minutes.
IDLE_TIME           : Specify the permitted periods of continuous inactive time during a session, expressed in minutes. Long-running queries and other operations are not subject to this limit.
LOGICAL_READS_PER_SESSION : Specify the permitted number of data blocks read in a session, including blocks read from memory and disk.
LOGICAL_READS_PER_CALL    : Specify the permitted the number of data blocks read for a call to process a SQL statement (a parse, execute, or fetch).
PRIVATE_SGA               :    Specify the amount of private space a session can allocate in the shared pool of the system global area (SGA), expressed in bytes.
COMPOSITE_LIMIT           : Specify the total resource cost for a session, expressed in service units. Oracle Database calculates the total service units as a weighted sum of CPU_PER_SESSION, CONNECT_TIME, LOGICAL_READS_PER_SESSION, and PRIVATE_SGA.
   
   
PAssword Parameter
   
FAILED_LOGIN_ATTEMPTS     : Maximum times the user is allowed in fail login before locking the user account
PASSWORD_LIFE_TIME        : Number of days the password is valid before expiry
PASSWORD_REUSE_TIME       : Number of day after the user can use the already used password
PASSWORD_REUSE_MAX        : Number of times the user can use the already used password
PASSWORD_LOCK_TIME        : Number of days the user account remains locked after failed login
PASSWORD_GRACE_TIME       : Number of grace days for user to change password
PASSWORD_VERIFY_FUNCTION  : PL/SQL that can be used for password verification
SEC_CASE_SENSITIVE_LOGON  : To control the case sensitivity in passwords
   
Password verification function : Oracle Database 12.1.0.1  $ORACLE_HOME/rdbms/admin/utlpwdmg.sql taken from Oracle 12.1.0.1 on Linux x86-64bit
   
   
10. Database Traffic Is Encrypted

This recommendation is rarely implemented, except in the most secure organizations. Oracle supports network-level encryption by both Secure Sockets Layer (SSL), using X.509v3 signed certificates, and native encryption without certificates.

The takeaway with network-level encryption is not only that sensitive data in transit are protected when encryption is employed, but also that the SID is protected. Without encryption, the SID can be easily enumerated through man-in-the-middle attacks.       

11. Privilages

Practice the principle of least privilege. Oracle recommends granting necessary privileges only. Do not provide database users or roles more privileges than necessary. (If possible, grant privileges to roles, not users.) In other words, the principle of least privilege is that users be given only those privileges that are actually required to efficiently perform their jobs.    
       
   

DB Audit on OS LEVEL






In our database there is turned on auditing on some operations and audit records go to OS.



AUDIT_TRAIL =     { none | os | db | db,extended | xml | xml,extended }


DB              Auditing is enabled. Audit records will be written to the
                SYS.AUD$ table.
OS              Auditing is enabled. Audit records will be written to an
                audit trail in the operating system.
db,extended     As db, but the SQL_BIND and SQL_TEXT columns are also populated.
NONE            Auditing is disabled (default).
xml-            Auditing is enabled, with all audit records stored
                as XML format OS files.
xml,extended    As xml, but the SQL_BIND and SQL_TEXT columns are also populated.
TRUE            This value is supported for backward-compatibility
                with versions of Oracle;it is equivalent to the DB value.
FALSE           This value is supported for backward-compatibility
                with versions of Oracle;it is equivalent to the NONE value.



SQL> SHOW PARAMETER AUDIT

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest                      string      /opt/app/oracle/admin/oravr/adump
audit_sys_operations                 boolean     TRUE
audit_syslog_level                   string      LOCAL7.INFO
audit_trail                          string      OS
SQL>




1. Connect to a database instance as sysdba user

SQL> connect / as sysdba

2. Set audit trail to OS

SQL> alter system set audit_trail=OS;

3. Enable auditing for system users

SQL> alter system set audit_sys_operations=TRUE;

4. Set rsyslog facility and severity(needs database restart)

SQL> alter system set audit_syslog_level=local7.info scope=spfile sid='*';

5.  Restart database

SQL> shutdown immediate;

SQL> startup;


6. Edit rsyslog.conf file



#Saving oracle database audit records
local7.info          /opt/syslog/oracle_audit.log

--Optional

#Send oracle database audit trail to remote rsyslog server
local5.info          @192.168.2.54


7. Restart rsyslog service

# service rsyslog restart

Shutting down system logger: [ OK ]
Starting system logger: [ OK ]

8. It is better to limit the size for audit log, or it may fill the space:

# vi /etc/logrotate.d/oracle.audit

#Created by MariK

/opt/syslog/oracle_audit.log {
 rotate 3
 compress
 missingok
 notifempty
 size 40G
 postrotate
 service rsyslog restart
 endscript
}

To check the syntax run :

# logrotate /etc/logrotate.d/oracle.audit


Example:

oravr1.oravr.in:/home/oracle> tailf /opt/syslog/oracle_audit.log

Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "287" SESSIONID:[9] "162326064" ENTRYID:[4] "8009" STATEMENT:[5] "52545" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[8] "PROFILE$" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "288" SESSIONID:[9] "162326064" ENTRYID:[4] "8010" STATEMENT:[5] "52545" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[9] "DBA_USERS" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "283" SESSIONID:[9] "162326064" ENTRYID:[4] "8011" STATEMENT:[5] "52545" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[4] "DUAL" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "302" SESSIONID:[9] "162326064" ENTRYID:[4] "8012" STATEMENT:[5] "52570" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[4] "OBJ$" OS$USERID:[6] "oracle" DBID:[10] "4040881803" PRIV$USED:[3] "237"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "284" SESSIONID:[9] "162326064" ENTRYID:[4] "8013" STATEMENT:[5] "52570" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[5] "USER$" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "283" SESSIONID:[9] "162326064" ENTRYID:[4] "8014" STATEMENT:[5] "52570" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[4] "OBJ$" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "284" SESSIONID:[9] "162326064" ENTRYID:[4] "8015" STATEMENT:[5] "52570" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[5] "USER$" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "300" SESSIONID:[9] "162326064" ENTRYID:[4] "8016" STATEMENT:[5] "52570" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[20] "_CURRENT_EDITION_OBJ" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "284" SESSIONID:[9] "162326064" ENTRYID:[4] "8017" STATEMENT:[5] "52570" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[5] "USER$" OS$USERID:[6] "oracle" DBID:[10] "4040881803"
Jul 22 06:02:41 oravr1 Oracle Audit[22070]: LENGTH: "290" SESSIONID:[9] "162326064" ENTRYID:[4] "8018" STATEMENT:[5] "52570" USERID:[6] "DBSNMP" USERHOST:[32] "oravr1.oravr.in" TERMINAL:[7] "unknown" ACTION:[1] "3" RETURNCODE:[1] "0" OBJ$CREATOR:[3] "SYS" OBJ$NAME:[10] "_BASE_USER" OS$USERID:[6] "oracle" DBID:[10] "4040881803"



HANDLECOLLISIONS - NOHANDLECOLLISIONS

         



HANDLECOLLISIONS was added to the replicat process in order to allow for collisions caused by uncertainty in the initial load to be handled for a short period of time. It is designed to handle changes to rows that were made during the time that the initial load was happening and is not designed to handle collisions that occur because of bi-directional replication or logic or architectural problems.

Never use HANDLECOLLISIONS unless it is absolutely necessary. Even then, use it for the shortest time possible.




If there is an update to a column that is used as a key in GoldenGate the following will occur:

If the row that has the old key is not found in the target database, the update is converted to an insert.
If a row is found with the new key, the row with the old key is deleted and the update overlays the row with the new key.

Both of these cases require that all of the columns are logged. This is done by making sure trandata is complete and by using the extract parameter NOCOMPRESSUPDATES.

If a duplicate record is found, the value in the trail file is used and the record that previously exists is discarded.

CONDITION ACTION

INSERT Collision INSERT Collision INSERT IN SOURCE WHOSE KEY CLUMN EXIST ON TARGET Converted to UPDATES UPDATE Collision UPDATE Collision Updated in source but row not present in target MISSING ROW FROM TARGET IS CONVERTED TO INSERT DELETE Collision DELETE Collision Deleted in source but row not present in target Ignored Discard file : SOURCE TARGET ERROR MESSAGE Duplicate inserts Send to discard file when it comes across – REPERROR (0001 Discard) Unique constraint violation. Updated in source but row not present at target Send to discard file when it comes across – REPERROR (1403 Discard) No data found Deleted in source but row not present at target Send to discard file when it comes across – EPERROR (1403 Discard) No data found


If a missing record is found during an update or delete operation that does not affect the GoldenGate key value, it is simply discarded.











Enabling HANDLECOLLISIONS---->

Globally: Enable global HANDLECOLLISIONS for ALL MAP statements

/*
HANDLECOLLISIONS
MAP soe.emp, TARGET soe.emp;
MAP soe.device, TARGET soe.device;
MAP soe.deviceinfo, TARGET soe.deviceinfo;
MAP soe.orders, TARGET soe.orders;

*/



Group : Enable HANDLECOLLISIONS for some MAP statements

/*
HANDLECOLLISIONS
MAP soe.emp, TARGET soe.emp;
MAP soe.device, TARGET soe.device;

NOHANDLECOLLISIONS -- (from here NOHANDLECOLLISIONS )

MAP soe.deviceinfo, TARGET soe.deviceinfo;
MAP soe.orders, TARGET soe.orders;
*/

/*

Tables: Enable global HANDLECOLLISIONS but disable for specific tables

HANDLECOLLISIONS
MAP soe.emp, TARGET soe.emp;
MAP soe.device, TARGET soe.device;
MAP soe.deviceinfo, TARGET soe.deviceinfo, NOHANDLECOLLISIONS; -- This is imp
MAP soe.orders, TARGET soe.orders, NOHANDLECOLLISIONS; -- This is imp

*/

Detail record count : stats replicate --- redirected

Don't forget to remove the HANDLECOLLISIONS parameter after the Replicat has moved old CSN where it was abending previously.
Also make sure to restart the Replicat after the removing this parameter.