Monday, 28 December 2020

SineFlex Solutions Pitch Deck PPT and Video

 

Hi All ,

We already know that recently we got the assignment to prepare Pitchdeck on Sineflex Solutions as a part of business communications. So i have prepared PPT and make very average video, But i want to share my knowledge with all. 

I have prepard my PDF PPT using  canva it is free of cost also  prepared my resume using canva.com . 

I have prepared my video using zoom. we can perform all recoding as well as PPT presentation. After recording video it will automatically convert mp4 to avi conversion.

All Pitch deck template present in canva . This blog is just for reference.


NOTE : Don't do any copy and paste form below reference.  U---  can detect  plagiarism using there tools. 



















Video Snapshot (Uploading Only Image 😀😐)














 Web blog Link : Small tutorial for making presentation and video recording using Zoom and Canva



kindly 

Thursday, 10 December 2020

IMPDP Error : RAC Environment Fails With Errors ORA-29913 ORA-31640 ORA-19505 ORA-27037

Scenario Preview : 

Recently we faced an error during impdp operation  migration of multiple schema from standalone database to 2 node RAC database. We face some issue on some of the tables of particular schemas but . Same script used for standalone DB were working  fine also other schema of using same expdp dumpfile. 

Reason was instead using TAF services that we have registered. We  were doing impdp on particular instance services level.

Error: ORA-31693 | ORA-31640 | ORA-19505

Scenario Error: 

After troubleshooting we found we were using parallel option  parallel=3 during  import   

ORA-31693: Table data object "INFODBA"."PPOM_OBJECT" failed to load/unload and is being skipped due to error:

ORA-31640: unable to open dump file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp" for read

ORA-19505: failed to identify file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp"

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Command used during import 

oracle@01:/u04/MasterDB/expdp/expdp_smrprod> impdp \"sys/xxx@SMRPROD2 as sysdba\" dumpfile=EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp directory=EXPDPPROD logfile=impdpSMRPRODB-$(date +%Y-%m-%d_%H-%M-%S).log schemas=infodba JOB_NAME=FULL_EXPDP_SMRPRODB parallel=3

Import: Release 12.1.0.2.0 - Production on Sun Nov 8 09:34:11 2020

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
Master table "SYS"."FULL_EXPDP_SMRPRODB" successfully loaded/unloaded
Starting "SYS"."FULL_EXPDP_SMRPRODB":  "sys/********@SMRPROD2 AS SYSDBA" dumpfile=EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp directory=EXPDPPROD logfile=impdpSMRPRODB-2020-11-08_09-34-11.log schemas=infodba JOB_NAME=FULL_EXPDP_SMRPRODB parallel=3
Processing object type DATABASE_EXPORT/SCHEMA/USER
ORA-31684: Object type USER:"INFODBA" already exists
Processing object type DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/ROLE_GRANT
Processing object type DATABASE_EXPORT/SCHEMA/DEFAULT_ROLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLESPACE_QUOTA
Processing object type DATABASE_EXPORT/SCHEMA/SEQUENCE/SEQUENCE
Processing object type DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
ORA-31693: Table data object "INFODBA"."PPOM_OBJECT" failed to load/unload and is being skipped due to error:
ORA-31640: unable to open dump file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp" for read
ORA-19505: failed to identify file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-31693: Table data object "INFODBA"."PPOM_APPLICATION_OBJECT" failed to load/unload and is being skipped due to error:
ORA-31640: unable to open dump file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp" for read
ORA-19505: failed to identify file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
. . imported "INFODBA"."POM_BACKPOINTER"                 605.0 MB 14101046 rows
. . imported "INFODBA"."PIMANFILE"                       266.9 MB 1335204 rows
ORA-31693: Table data object "INFODBA"."POM_RECIPE_TABLE" failed to load/unload and is being skipped due to error:
ORA-31640: unable to open dump file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp" for read
ORA-19505: failed to identify file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-31693: Table data object "INFODBA"."POM_LOCK_KEYS" failed to load/unload and is being skipped due to error:
ORA-31640: unable to open dump file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp" for read
ORA-19505: failed to identify file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
. . imported "INFODBA"."PFND0WORKFLOWAUDIT"              855.8 MB 1759632 rows
. . imported "INFODBA"."PPSOCCURRENCE"                   147.2 MB  588268 rows
ORA-31693: Table data object "INFODBA"."PIMANRELATION" failed to load/unload and is being skipped due to error:
ORA-31640: unable to open dump file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp" for read
ORA-19505: failed to identify file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
. . imported "INFODBA"."PWORKSPACEOBJECT"                256.4 MB 1802823 rows
. . imported "INFODBA"."PFND0GENERALAUDIT"               110.8 MB  491362 rows
ORA-31693: Table data object "INFODBA"."PDATASET" failed to load/unload and is being skipped due to error:
ORA-31640: unable to open dump file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp" for read
ORA-19505: failed to identify file "/u04/MasterDB/expdp/expdp_smrprod/EXPDP-SMRPRODB-2020-11-08_09-02-28.dmp"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
. . imported "INFODBA"."PEPMTASK"                        64.87 MB  331746 rows
. . imported "INFODBA"."PFND0SYNC_CHECKSUMS_3"           66.24 MB  887437 rows
. . imported "INFODBA"."PREF_LIST_0"                     30.97 MB  805308 rows
. . imported "INFODBA"."PPROJECT_LIST"                   28.16 MB  736249 rows
. . imported "INFODBA"."PFND0SECURITYAUDIT"              25.59 MB   85555 rows
. . imported "INFODBA"."PPROPAGATION_OBJ_LIST"           28.12 MB  729337 rows
. . imported "INFODBA"."PREVISIONS"                      21.79 MB  562331 rows
. . imported "INFODBA"."PREF_NAMES_0"                    25.36 MB  805308 rows
. . imported "INFODBA"."PREF_TYPES"                      18.68 MB  805308 rows
^C
Import> stop_job
Are you sure you wish to stop this job ([yes]/no): yes


Solution:

DataPump Import With PARALLEL > 1 In RAC Environment Fails With Errors ORA-29913 ORA-31640 ORA-19505 ORA-27037 (Doc ID 1173765.1)

Use cluster=N to run the import from a single node of the RAC cluster which has file access.

or

Run the Data Pump import job with parallel=1 (default)



OEM 12c - Oracle Physical Standby archive log sync monitoring

 OEM 12c - Oracle Physical Standby archive log sync monitoring

Note: Before Configuring Matric for archive log sync monitoring, Please make sure, there should not have One Matric for one Standby. One Matric should have groups of standby servers.

Step: 1: Enterprise>Monitoring>Metric Extensions


Step: 2: Metric Extensions Page Open


Step: 3  Click on +Create & Click on Metric Extension

 

Step: 4 Page Open: Create New: General Properties


Step: 5 Create New: General Properties: Put same values except Name$ & Displays (Put values according to Standby Group Name) &  then Click on Next.


 Step: 6 Put the below query in SQL Query Column only & Click Next


Query :

select sum(local.sequence#-target.sequence#) Total_gap

from

(select thread#,max(sequence#) sequence# from gv$archived_log where

dest_id=(select dest_id from v$archive_dest where TARGET='STANDBY'

)

and applied='YES' group by thread#) target,

(select thread#,max(sequence#) sequence# from gv$log group by thread#) local

where target.thread#=local.thread#;

Step: 7 Automatically Open Create New: Column

Step: 8  Create New: Column : Click on +Add & Click on New metric column.


Step: 9 Add Column put same value as I have entered & Click on OK.



 Step: 10 Now Create Neww : Columns


Step: 11



Step: 12



Step: 13


Step: 14

Step: 15


Step: 16




Step: 17



Step: 18


 
Step: 19


Step: 20


Step: 21

Step: 22


 
Step: 23


 
Step: 24


Step: 25


Step: 26


Step: 27


Step: 28


 
Step: 29



Tuesday, 8 December 2020

PT - Extracting Session level trace based on sid and serial#

Session level trace example  based on sid and serial#

  • Checking the database name 

SQL> @d


NAME      INSTANCE_NAME    DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    CURRENT_SCN        FAILOVER_SCN

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

TC12DEV   TC12DEV          TC12DEV                        READ WRITE           PRIMARY          NO                 0

  • Command to check sessions details  (describing only particular session only for trace generation)

SQL> @sessions


     INST   SID SERIAL# USERNAME     OSUSER           PROGRAM    LOCKED S hh:mm:ss SQL_ID            SEQ# Current/LastEvent         State (sec)

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

MODULE                                                                                               ACTION

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



        1   298   33658 INFODBA      varunyadav       SQL Develo        I 00:29:48 cr6axzpwa6byz       62 SQL*Net message from clie WAITING   1788

SQL Developer


 9 rows selected.

  • Extracting trace based on sis and session#

SQL> DEFINE v_sid =298

SQL> DEFINE v_serial =33658

SQL> BEGIN

DBMS_MONITOR.SESSION_TRACE_ENABLE( SESSION_ID => &v_sid, SERIAL_NUM =>

&v_serial, WAITS => TRUE, BINDS => FALSE);

END;

/  2    3    4    5

old   2: DBMS_MONITOR.SESSION_TRACE_ENABLE( SESSION_ID => &v_sid, SERIAL_NUM =>

new   2: DBMS_MONITOR.SESSION_TRACE_ENABLE( SESSION_ID => 298, SERIAL_NUM =>

old   3: &v_serial, WAITS => TRUE, BINDS => FALSE);

new   3: 33658, WAITS => TRUE, BINDS => FALSE);


PL/SQL procedure successfully completed.


SQL> SELECT P.TRACEFILE FROM V$SESSION S JOIN V$PROCESS P ON S.PADDR = P.ADDR WHERE S.SID = &V_SID;

old   1: SELECT P.TRACEFILE FROM V$SESSION S JOIN V$PROCESS P ON S.PADDR = P.ADDR WHERE S.SID = &V_SID

new   1: SELECT P.TRACEFILE FROM V$SESSION S JOIN V$PROCESS P ON S.PADDR = P.ADDR WHERE S.SID = 298


TRACEFILE

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

/u01/app/oracle/diag/rdbms/tc12dev/TC12DEV/trace/TC12DEV_ora_20976.trc


SQL> BEGIN

DBMS_MONITOR.SESSION_TRACE_DISABLE( SESSION_ID => &v_sid, SERIAL_NUM =>

&v_serial);

END;

/  2    3    4    5

old   2: DBMS_MONITOR.SESSION_TRACE_DISABLE( SESSION_ID => &v_sid, SERIAL_NUM =>

new   2: DBMS_MONITOR.SESSION_TRACE_DISABLE( SESSION_ID => 298, SERIAL_NUM =>

old   3: &v_serial);

new   3: 33658);


PL/SQL procedure successfully completed.


SQL>


Trace output:




Sunday, 29 November 2020

LOG MINER : Log miner_current_scn


LOGMINER - Based on SCN 

Scenario Preview:

We have archive log of particular date, with the help of  logminer we can extract the value based on SCN Number.

In general we can extract object value based on archive log | Timestamp date |  SCN Number

Operating System: OEL 7.7 64 bit

Database Version : 12.2.0.1 

Database : SMRUPGR12QA

Schema : infodba

Log Miner table : PFND0GENERALAUDIT

  • Check UTL_FILE_DIR location below.

SQL> sho parameter utl_file_dir

NAME                                 TYPE        VALUE

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

utl_file_dir                         string

  • We need to take bounce of  database as parameter value is not set as dyanamics to set UTL_FILE_DIR  location.

SQL> alter system set utl_file_dir='/u04/db_backup/expdp/SMRUPGR12QA/logminer' scope=spfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 2147483648 bytes

Fixed Size                  3712904 bytes

Variable Size             822085752 bytes

Database Buffers         1308622848 bytes

Redo Buffers               13062144 bytes

Database mounted.

Database opened.

SQL> @d

NAME                             INSTANCE_NAME    DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    CURRENT_SCN        FAILOVER_SCN

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

SMRUPGR1                         SMRUPGR12QA      SMRUPGR12QA                    READ WRITE           PRIMARY          NO                 0

SQL> sho parameter utl_file_dir

NAME                                 TYPE        VALUE

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

utl_file_dir                         string      /u04/db_backup/expdp/SMRUPGR12

                                                 QA/logminer

  • Create directory for storing logminer file location 

SQL> CREATE OR REPLACE DIRECTORY LOG_DIR AS '/u04/db_backup/expdp/SMRUPGR12QA/logminer';

Directory created.

  • Optional if we wants to exract from particular users

SQL> GRANT READ, WRITE ON DIRECTORY LOG_DIR TO infodba;

Grant succeeded.

SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;

SUPPLEME

--------

NO

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

Database altered.

  • Start log miner specifying name and location 

 SQL>  BEGIN

sys.DBMS_LOGMNR_D.build (

dictionary_filename => 'date_lgmnrdict.ora',

dictionary_location => 'LOG_DIR');

END;

/  2    3    4    5    6

PL/SQL procedure successfully completed.

  • Using mention and specify the  archive log values below. 

SQL> BEGIN

DBMS_LOGMNR.add_logfile (

  2    3  options => DBMS_LOGMNR.new,

logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_737_hvcwzj71_.arc');

  4    5

  6  DBMS_LOGMNR.add_logfile (

  7  options => DBMS_LOGMNR.addfile,

  8  logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_738_hvd82hth_.arc');

  9

 10  DBMS_LOGMNR.add_logfile (

 11  options => DBMS_LOGMNR.addfile,

 12  logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_739_hvfq7xpq_.arc');

 13

 14  END;

 15  /

PL/SQL procedure successfully completed. 

SQL>  BEGIN

sys.DBMS_LOGMNR_D.build (

dictionary_filename => 'date_lgmnrdict.ora',

dictionary_location => 'LOG_DIR');

END;

/  2    3    4    5    6

PL/SQL procedure successfully completed.

  • Using mention and specify the archive log values below. 

SQL> BEGIN

DBMS_LOGMNR.add_logfile (

  2    3  options => DBMS_LOGMNR.new,

logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_737_hvcwzj71_.arc');

  4    5

  6  DBMS_LOGMNR.add_logfile (

  7  options => DBMS_LOGMNR.addfile,

  8  logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_738_hvd82hth_.arc');

  9

 10  DBMS_LOGMNR.add_logfile (

 11  options => DBMS_LOGMNR.addfile,

 12  logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_739_hvfq7xpq_.arc');

 13

 14  END;

 15  /


PL/SQL procedure successfully completed.

  • Log miner Based on SCN Number

begin

DBMS_LOGMNR.start_logmnr (

dictfilename => '/oradb/logminer/lgmnrdict.ora',

startscn => 20734338,

endscn => 20834345);

END;

PL/SQL procedure successfully completed.

SQL>

SELECT seg_owner, seg_name, count(*) AS Hits
FROM   v$logmnr_contents
WHERE  seg_name NOT LIKE '%$'
GROUP BY seg_owner, seg_name;


SELECT OPERATION, STATUS, SQL_REDO FROM V$LOGMNR_CONTENTS WHERE SEG_OWNER = 'INFODBA' AND TABLE_NAME = 'PFND0GENERALAUDIT';


SQL> EXECUTE DBMS_LOGMNR.END_LOGMNR();

PL/SQL procedure successfully completed.

SQL>
 

Log Miner : Date_Timestamp_logminer


LOGMINER - Based on Date and time generation

Scenario Preview:

We have archive log of particular date, with the help of  logminer we can extract the value based on date and time.

In general we can extract object value based on archive log | Timestamp date |  SCN Number

Operating System: OEL 7.7 64 bit

Database Version : 12.2.0.1 

Database : SMRUPGR12QA

Schema : infodba

Log Miner table : PFND0GENERALAUDIT

Check UTL_FILE_DIR location below.

SQL> sho parameter utl_file_dir

NAME                                 TYPE        VALUE

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

utl_file_dir                         string

  • We need to take bounce of  database as parameter value is not set as dyanamics to set UTL_FILE_DIR  location.

SQL> alter system set utl_file_dir='/u04/db_backup/expdp/SMRUPGR12QA/logminer' scope=spfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 2147483648 bytes

Fixed Size                  3712904 bytes

Variable Size             822085752 bytes

Database Buffers         1308622848 bytes

Redo Buffers               13062144 bytes

Database mounted.

Database opened.

SQL> @d

NAME                             INSTANCE_NAME    DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    CURRENT_SCN        FAILOVER_SCN

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

SMRUPGR1                         SMRUPGR12QA      SMRUPGR12QA                    READ WRITE           PRIMARY          NO                 0

SQL> sho parameter utl_file_dir

NAME                                 TYPE        VALUE

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

utl_file_dir                         string      /u04/db_backup/expdp/SMRUPGR12

                                                 QA/logminer

Create directory for storing logminer file location 

SQL> CREATE OR REPLACE DIRECTORY LOG_DIR AS '/u04/db_backup/expdp/SMRUPGR12QA/logminer';

Directory created.

Optional if we wants to exract from particular users

SQL> GRANT READ, WRITE ON DIRECTORY LOG_DIR TO infodba;

Grant succeeded.

SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;

SUPPLEME

--------

NO

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;


Database altered.

  • Start log miner specifying name and location 

 SQL>  BEGIN

sys.DBMS_LOGMNR_D.build (

dictionary_filename => 'date_lgmnrdict.ora',

dictionary_location => 'LOG_DIR');

END;

/  2    3    4    5    6


PL/SQL procedure successfully completed.

  • Using mention and specify the  archive log values below. 

SQL> BEGIN

DBMS_LOGMNR.add_logfile (

  2    3  options => DBMS_LOGMNR.new,

logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_737_hvcwzj71_.arc');

  4    5

  6  DBMS_LOGMNR.add_logfile (

  7  options => DBMS_LOGMNR.addfile,

  8  logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_738_hvd82hth_.arc');

  9

 10  DBMS_LOGMNR.add_logfile (

 11  options => DBMS_LOGMNR.addfile,

 12  logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_739_hvfq7xpq_.arc');

 13

 14  END;

 15  /


PL/SQL procedure successfully completed.

  • Start log mining mentioning date and time

SQL> begin

dbms_logmnr.start_logmnr (

dictfilename => '/u04/db_backup/expdp/SMRUPGR12QA/logminer/date_lgmnrdict.ora',

  2    3    4  starttime => TO_DATE('19-NOV-2020 05:26:00', 'DD-MON-YYYY HH:MI:SS'),

  5  endtime => TO_DATE('19-NOV-2020 08:35:00', 'DD-MON-YYYY HH:MI:SS'));

end;

/  6    7


PL/SQL procedure successfully completed.

  • Example to check the logs contents 

SQL>

SELECT seg_owner, seg_name, count(*) AS Hits
FROM   v$logmnr_contents
WHERE  seg_name NOT LIKE '%$'
GROUP BY seg_owner, seg_name;


SELECT OPERATION, STATUS, SQL_REDO FROM V$LOGMNR_CONTENTS WHERE SEG_OWNER = 'INFODBA' AND TABLE_NAME = 'PFND0GENERALAUDIT';

  • End log mining operations
SQL> EXECUTE DBMS_LOGMNR.END_LOGMNR();

PL/SQL procedure successfully completed.

SQL>

NEW LOGMINER - Based on archivelog generation

Scenario Preview:

We have archive log of particular date, with the help of  logminer we can extract the value based on archive log .

In general we can extract object value based on archive log | Timestamp date |  SCN Number

Operating System: OEL 7.7 64 bit

Database Version : 12.2.0.1 

Database : SMRUPGR12QA

Schema : infodba

Log Miner table : PFND0GENERALAUDIT

SQL> @d

NAME                             INSTANCE_NAME    DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    CURRENT_SCN        FAILOVER_SCN

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

SMRUPGR1                         SMRUPGR12QA      SMRUPGR12QA                    READ WRITE           PRIMARY          NO                 0


Check UTL_FILE_DIR location below.

SQL> sho parameter utl_file_dir

NAME                                 TYPE        VALUE

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

utl_file_dir                         string

  • We need to take bounce of  database as parameter value is not set as dyanamics to set UTL_FILE_DIR  location.

SQL> alter system set utl_file_dir='/u04/db_backup/expdp/SMRUPGR12QA/logminer' scope=spfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 2147483648 bytes

Fixed Size                  3712904 bytes

Variable Size             822085752 bytes

Database Buffers         1308622848 bytes

Redo Buffers               13062144 bytes

Database mounted.

Database opened.

SQL> @d

NAME                             INSTANCE_NAME    DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE    CURRENT_SCN        FAILOVER_SCN

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

SMRUPGR1                         SMRUPGR12QA      SMRUPGR12QA                    READ WRITE           PRIMARY          NO                 0

SQL> sho parameter utl_file_dir

NAME                                 TYPE        VALUE

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

utl_file_dir                         string      /u04/db_backup/expdp/SMRUPGR12

                                                 QA/logminer

Create directory for storing logminer file location 

SQL> CREATE OR REPLACE DIRECTORY LOG_DIR AS '/u04/db_backup/expdp/SMRUPGR12QA/logminer';

Directory created.

Optional if we wants to exract from particular users

SQL> GRANT READ, WRITE ON DIRECTORY LOG_DIR TO infodba;

Grant succeeded.

SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;

SUPPLEME

--------

NO

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;


Database altered.

  • Start log miner specifying name and location 

SQL> BEGIN

sys.DBMS_LOGMNR_D.build (

dictionary_filename => 'lgmnrdict.ora',

dictionary_location => 'LOG_DIR');

END;

/  2    3    4    5    6

PL/SQL procedure successfully completed.

SQL> SQL>

SQL> SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/SMRUPGR12QA/redo01.log
/u01/app/oracle/oradata/SMRUPGR12QA/redo02.log
/u01/app/oracle/oradata/SMRUPGR12QA/redo03.log
  • Using mention archive log  values to log. 
SQL> BEGIN
DBMS_LOGMNR.add_logfile (
options => DBMS_LOGMNR.new,
logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_737_hvcwzj71_.arc');

DBMS_LOGMNR.add_logfile (
  2    3    4    5    6    7  options => DBMS_LOGMNR.addfile,
logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_738_hvd82hth_.arc');

DBMS_LOGMNR.add_logfile (
  8    9   10   11  options => DBMS_LOGMNR.addfile,
 12  logfilename => '/u04/db_backup/Flash_recovery_area/SMRUPGR12QA/SMRUPGR12QA/archivelog/2020_11_19/o1_mf_1_739_hvfq7xpq_.arc');
 13
 14  END;
/  15

PL/SQL procedure successfully completed.

SQL> sho user
USER is "SYS"
SQL>
  • Start log mining location 
SQL> sho user
USER is "SYS"
SQL> BEGIN
-- Start using all logs
DBMS_LOGMNR.start_logmnr (
dictfilename => '/u04/db_backup/expdp/SMRUPGR12QA/logminer/lgmnrdict.ora');
END;
/   2    3    4    5    6

PL/SQL procedure successfully completed.

SQL>
  • Check the log mining contents.
SELECT seg_owner, seg_name, count(*) AS Hits
FROM   v$logmnr_contents
WHERE  seg_name NOT LIKE '%$'
GROUP BY seg_owner, seg_name;

  • Check Tablevalue operation information details

SELECT OPERATION, STATUS, SQL_REDO FROM V$LOGMNR_CONTENTS WHERE SEG_OWNER = 'INFODBA' AND TABLE_NAME = 'PFND0GENERALAUDIT';
  • End log miner execution

SQL> EXECUTE DBMS_LOGMNR.END_LOGMNR();

PL/SQL procedure successfully completed.

SQL>

Wednesday, 25 November 2020

PT - Row level lock contention TX blockers and waiters

 Handling 'enq: TX - row lock contention'

  • Client session 1 :  Recording current time and update customers row

SQL> SELECT TO_CHAR(SYSDATE, 'MM/DD/YY HH24:MI:SS') ctime FROM DUAL;


CTIME

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

11/24/20 20:41:27


SQL> var V_CUSTOMER_ID number

SQL> exec :V_CUSTOMER_ID := 100


PL/SQL procedure successfully completed.


SQL> UPDATE CUSTOMERS

  2  SET CUST_EMAIL = CUST_EMAIL || '' WHERE CUSTOMER_ID = :V_CUSTOMER_ID;


1 row updated.

  • client Session 2 :  Same update statement run on session.


SQL> UPDATE CUSTOMERS SET CUST_EMAIL = CUST_EMAIL || '' WHERE CUSTOMER_ID =100;

output 
C:\Users\varunyadav>sqlplus sys/system123@orcl2 as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Nov 24 20:46:49 2020

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

  • Query to check waiter and blocker session 

SQL> col SESSIONS format A20
SQL> SELECT DECODE(REQUEST,0,'Holder SID: ','Waiter SID: ') ||
  2  SID SESSIONS, ID1, ID2, LMODE, REQUEST, TYPE
  3  FROM V$LOCK
  4  WHERE (ID1, ID2, TYPE) IN (SELECT ID1, ID2, TYPE FROM V$LOCK WHERE REQUEST > 0)
  5  ORDER BY ID1, REQUEST;

SESSIONS                    ID1        ID2      LMODE    REQUEST TY
-------------------- ---------- ---------- ---------- ---------- --
Holder SID: 126          131085       1379          6          0 TX
Waiter SID: 867          131085       1379          0          6 TX

  • Information about waiter sessions details
SQL> set pagesize 20
SQL> col INFO for a200
SQL> SELECT
  2  'SID: '|| S.SID || CHR(10) ||
  3  'USERNAME: '|| S.USERNAME || CHR(10) ||
  4  'EVENT: ' || S.EVENT || CHR(10) ||
  5  'DESCRIPTION: ' || T.DESCRIPTION || CHR(10) ||
  6  'CURRENT STATEMENT: ' || Q.SQL_TEXT || CHR(10) ||
  7  'WAITING TIME (s): ' || S.SECONDS_IN_WAIT || CHR(10) ||
  8  'P1TEXT: ' || S.P1TEXT || CHR(10) ||
  9  'P1: ' || S.P1 || CHR(10) ||
 10  'P2TEXT: ' || S.P2TEXT || CHR(10) ||
 11  'P2: ' || S.P2 || CHR(10) ||
 12  'P3TEXT: ' || S.P3TEXT || CHR(10) ||
 13  'P3: ' || S.P3
 14  AS INFO
 15  FROM V$SESSION S, V$LOCK L, V$LOCK_TYPE T, V$SQL Q
 16  WHERE S.SID = L.SID AND T.TYPE=L.TYPE AND S.SQL_ID = Q.SQL_ID
 17  AND L.REQUEST>0;

INFO
--------------------------------------------------------------------------------
SID: 867
USERNAME: SOE
EVENT: enq: TX - row lock contention
DESCRIPTION: Lock held by a transaction to allow other transactions to wait for
it
CURRENT STATEMENT: UPDATE CUSTOMERS SET CUST_EMAIL = CUST_EMAIL || '' WHERE CUST
OMER_ID =100
WAITING TIME (s): 291
P1TEXT: name|mode
P1: 1415053318
P2TEXT: usn<<16 | slot
P2: 131085
P3TEXT: sequence
P3: 1379
  • Query to retrieve particular affected lock row

SQL> SELECT 'SELECT * FROM "' || O.OWNER || '"."' || O.OBJECT_NAME || '"
  2  WHERE ROWID = DBMS_ROWID.ROWID_CREATE(1, ' || S.ROW_WAIT_OBJ# || ', ' ||
  3  S.ROW_WAIT_FILE# || ', ' || ROW_WAIT_BLOCK# || ', ' ||
  4  ROW_WAIT_ROW# || ');'
  5  FROM DBA_OBJECTS O, V$SESSION S
  6  WHERE S.ROW_WAIT_OBJ# = O.OBJECT_ID AND S.SID = &V_WSID;
Enter value for v_wsid: 867
old   6: WHERE S.ROW_WAIT_OBJ# = O.OBJECT_ID AND S.SID = &V_WSID
new   6: WHERE S.ROW_WAIT_OBJ# = O.OBJECT_ID AND S.SID = 867

'SELECT*FROM"'||O.OWNER||'"."'||O.OBJECT_NAME||'"WHEREROWID=DBMS_ROWID.ROWID_CRE
--------------------------------------------------------------------------------
SELECT * FROM "SOE"."CUSTOMERS"
WHERE ROWID = DBMS_ROWID.ROWID_CREATE(1, 170508, 8, 4816, 38);


  • Rollback client session 1:

SQL>rollback;



SQL> SELECT DECODE(REQUEST,0,'Holder SID: ','Waiter SID: ') ||
  2  SID SESSIONS, ID1, ID2, LMODE, REQUEST, TYPE
  3  FROM V$LOCK
  4  WHERE (ID1, ID2, TYPE) IN (SELECT ID1, ID2, TYPE FROM V$LOCK WHERE REQUEST > 0)
  5  ORDER BY ID1, REQUEST;

no rows selected

SQL>

  • ASH report of particular locking periods: 


define dbid = '';
define inst_num = '';
define report_type = 'html';
define begin time
define begin_time ='-10'
define duration = 10;
define report_name = 'C:\Users\varunyadav\ash_enqtx.html';
define slot_width = '';
define target_session_id = '';
define target_sql_id = '';
define target_wait_class = '';
define target_service_hash = '';
define target_module_name = '';
define target_action_name = '';
define target_client_id = '';
define target_plsql_entry = '';
define target_container = '';
@?\rdbms\admin\ashrpti.sql


  • Query for enqueue wait events since last database start
SQL> col EVENT format a40
SQL> col WAIT_CLASS format a11
SQL> SELECT EVENT, AVERAGE_WAIT,
  2  TO_CHAR(ROUND(TIME_WAITED/100),'999,999,999') TIME_SECONDS, WAIT_CLASS
  3  FROM V$SYSTEM_EVENT
  4  WHERE EVENT LIKE 'enq%'
  5  ORDER BY TIME_WAITED;

EVENT                                    AVERAGE_WAIT TIME_SECONDS WAIT_CLASS
---------------------------------------- ------------ ------------ -----------
enq: SQ - contention                              .14            0 Configurati
                                                                   on

enq: PV - syncstart                              1.35            0 Other
enq: CF - contention                             5.34            0 Other
enq: WF - contention                            20.17            0 Other
enq: CR - block range reuse ckpt                  .21            1 Other
enq: RO - fast object reuse                       .29            3 Application
enq: PR - contention                            18.46            6 Other
enq: JG - queue lock                             5.76           12 Other
enq: TX - row lock contention               233833.06        7,015 Application

9 rows selected.

SQL>
  • Query to check object waited for lock to be released

SQL> col OBJECT_NAME for a10
SQL> col stats for a20
SQL> SELECT OBJECT_NAME, SUBSTR(STATISTIC_NAME, 1, 30) STATS, VALUE
  2  FROM V$SEGMENT_STATISTICS
  3  WHERE ( STATISTIC_NAME IN( 'ITL waits' , 'row lock waits' ))
  4  AND VALUE>0 AND OBJECT_NAME NOT LIKE 'BIN$%'
  5  ORDER BY VALUE DESC;

OBJECT_NAM STATS                     VALUE
---------- -------------------- ----------
EMP        row lock waits                2
CUSTOMERS  row lock waits                1

SQL>
  • Query for most waited wait events of application class
SQL> col SQL_TEXT for a30
SQL> SELECT ROUND(APPLICATION_WAIT_TIME / 1000000) WAIT_TIME_S,
  2  SQL_ID, SUBSTR(SQL_TEXT,1,30) SQL_TEXT
  3  FROM V$SQLSTATS
  4  WHERE APPLICATION_WAIT_TIME >0
  5  ORDER BY APPLICATION_WAIT_TIME DESC FETCH FIRST 10 ROW ONLY;

WAIT_TIME_S SQL_ID        SQL_TEXT
----------- ------------- ------------------------------
       5372 9b21yxhcn6r9d UPDATE EMP SET SALARY=SALARY W
        948 fwwngr2fq76ap  UPDATE EMP SET SALARY=SALARY
        695 1d0m79rpx5h4j UPDATE CUSTOMERS SET CUST_EMAI
          2 6mcpb06rctk0x call dbms_space.auto_space_adv
          1 b6usrg82hwsa3 call dbms_stats.gather_databas

SQL>

Use Case: Using Session Waiting Events with Hung or Very Slow Sessions

Use Case: Using Session Waiting Events with Hung or Very Slow Sessions 

Scenario Overview:

we have 2 client session 1 &2 . We will update same row on table in both session and do not commit after session 1execution . and try to update same query on session 2 .

Checking the sessions details of waiter and blocker of session.

 SESSION 1

C:\Users\varunyadav>sqlplus soe/soe@orcl2

SQL*Plus: Release 12.2.0.1.0 Production on Tue Nov 24 16:30:41 2020

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

Last Successful login time: Tue Nov 24 2020 16:30:13 +05:30

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>  UPDATE EMP SET SALARY=SALARY WHERE EMP_NO=104;

1 row updated.

SQL>

 SESSION 2

C:\Users\varunyadav>sqlplus soe/soe@orcl2

SQL*Plus: Release 12.2.0.1.0 Production on Tue Nov 24 16:30:41 2020

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

Last Successful login time: Tue Nov 24 2020 16:30:13 +05:30

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>  UPDATE EMP SET SALARY=SALARY WHERE EMP_NO=104;

( Session above stuck as session 1 is not commit there update)

  • Checking the idle or hung  session details using query

C:\Users\varunyadav>sqlplus soe/soe@orcl2

SQL*Plus: Release 12.2.0.1.0 Production on Tue Nov 24 16:35:10 2020

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

Last Successful login time: Tue Nov 24 2020 16:30:41 +05:30

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> SELECT SID, EVENT
  2  FROM V$SESSION
  3  WHERE STATE='WAITING' AND USERNAME ='SOE' AND WAIT_CLASS<>'Idle';

       SID EVENT
---------- ----------------------------------------------------------------
       126 enq: TX - row lock contention

  • Hung session information 

SQL> col SESSION_WAITS format a100
SQL> SELECT 'SID: '|| SID||
  2  CHR(10)||'USERNAME: '|| USERNAME||
  3  CHR(10)||'STATE: '|| STATE||
  4  CHR(10)||'EVENT: '|| EVENT||
  5  CHR(10)||'WAIT_TIME: '|| WAIT_TIME||
  6  CHR(10)||'SECONDS_IN_WAIT: '|| SECONDS_IN_WAIT||
  7  CHR(10)||'WAIT_CLASS: '|| WAIT_CLASS||
  8  CHR(10)||'P1TEXT: '|| P1TEXT||
  9  CHR(10)||'P1: '|| P1||
 10  CHR(10)||'P2TEXT: '|| P2TEXT||
 11  CHR(10)||'P2: '|| P2 ||
 12  CHR(10)||'P3TEXT: '|| P3TEXT||
 13  CHR(10)||'P3: ' || P3 AS SESSION_WAITS
 14  FROM V$SESSION
 15  WHERE USERNAME='SOE' AND EVENT LIKE 'enq: TX%'
 16  ORDER BY WAIT_TIME;

SESSION_WAITS
--------------------------------------------------------------------------------
SID: 126
USERNAME: SOE
STATE: WAITING
EVENT: enq: TX - row lock contention
WAIT_TIME: 0
SECONDS_IN_WAIT: 280
WAIT_CLASS: Application
P1TEXT: name|mode
P1: 1415053318
P2TEXT: usn<<16 | slot
P2: 524304

SESSION_WAITS
--------------------------------------------------------------------------------
P3TEXT: sequence
P3: 1381


SQL> col EVENT for a30
SQL> SELECT E.EVENT,
  2  TO_CHAR(ROUND(E.TIME_WAITED/100),'999,999,999') TIME_SECONDS
  3  FROM V$SESSION_EVENT E, V$SESSION S
  4  WHERE E.SID=S.SID AND S.USERNAME='SOE' AND E.EVENT LIKE 'enq: TX%'
  5  ORDER BY TIME_WAITED;

EVENT                          TIME_SECONDS
------------------------------ ------------
enq: TX - row lock contention           307

  • Retrieve session history details

SQL> SELECT COUNT(*) FROM V$SESSION_WAIT_HISTORY
  2  WHERE EVENT LIKE 'enq: TX%';

  COUNT(*)
----------
         0

SQL>

<16 --------------------------------------------------------------------------------="" 1381="" 524304="" p2:="" p3:="" p3text:="" sequence="" session_waits="" slot="" sql="">ROLLBACK

<16 --------------------------------------------------------------------------------="" 1381="" 524304="" p2:="" p3:="" p3text:="" sequence="" session_waits="" slot="" sql="">Session 1
SQL> UPDATE EMP SET SALARY=SALARY WHERE EMP_NO=104; 
 1 row updated. 

 SQL> rollback; 
 Rollback complete. SQL>

<16 --------------------------------------------------------------------------------="" 1381="" 524304="" p2:="" p3:="" p3text:="" sequence="" session_waits="" slot="" sql="">Session 2
SQL> UPDATE EMP SET SALARY=SALARY WHERE EMP_NO=104; 
 1 row updated. 

 SQL> rollback; 
 Rollback complete. 

  • Wait event of sessions of schema
SQL>
SQL> col EVENT format a40
SQL> col WAIT_CLASS format a10
SQL> SELECT SID, EVENT, WAIT_CLASS
  2  FROM V$SESSION
  3  WHERE USERNAME='SOE';

       SID EVENT                                    WAIT_CLASS
---------- ---------------------------------------- ----------
        10 SQL*Net message to client                Network
       126 SQL*Net message from client              Idle
       867 SQL*Net message from client              Idle

SQL>