Posts by Venkatesh GK

Script to check for corruption in the database dictionary

Set verify off Set space 0 Set line 120 Set heading off Set feedback off Set pages 1000 Spool analyze.sql SELECT ‘Analyze cluster “‘||cluster_name||'” validate structure cascade;’ FROM dba_clusters WHERE…

Read More

Script to check duplicate objects in SYS and SYSTEM

Please use the below query to check the same. column object_name format a30 select object_name, object_type from dba_objects where object_name||object_type in (select object_name||object_type from dba_objects where owner = ‘SYS’) and…

Read More

ORA-56920: a prepare or upgrade window or an on-demand or datapump-job loading of a secondary time zone data file is in an active state

Please use the below to fix the issue.   CONN / as sysdba alter session set “_with_subquery”=materialize; alter session set “_simple_view_merging”=TRUE; set serveroutput on VAR numfail number BEGIN DBMS_DST.UPGRADE_DATABASE(:numfail, parallel…

Read More

ORA-01591: lock held by in-doubt distributed transaction 1.92.66874

Below is an example for transaction id 1.92.66874, you need to replace correct transaction id. Trying to manually commit or rollback this transaction   commit force ‘1.92.66874’; ORA-02058: no prepared…

Read More

Query to get session details for pending transactions in Oracle Database

Please get session detail for transaction 95.22.1516570 (Replace with your transaction id) select t1.sid, t1.username, t2.xidusn, t2.used_urec, t2.used_ublk from v$session t1, v$transaction t2 where t1.saddr = t2.ses_addr; and t2.XIDUSN =…

Read More

Script to collect all the required information for understanding the Concurrent Processing workload on a system

REM HEADER REM $Header: cp_analyzer.sql v1.01 MCOSTA $ REM REM MODIFICATION LOG: REM REM MCOSTA REM REM Consolidated script to diagnose the current status and footprint of Concurrent Processing on…

Read More

Query to generate Baseline Script for a SQL_ID in Oracle Database

Please use the below query. col sql_text for a60 wrap set verify off set pagesize 999 set lines 155 col username format a13 col prog format a22 col sid format…

Read More

Steps to Export and Import AWR Stats

Please find the steps to export and import AWR stats. Exporting AWR snapshot data:- ***************************** SQL> @?/rdbms/admin/awrextr.sql AWR EXTRACT **************************************************** This script will extract the AWR data for a range of snapshots into a dump file. The script…

Read More

Steps to Backup and Restore Java Classes and Privileges only in Oracle Database

The following SQL script, when run as user SYS, will generate an ordered script to recreate all the java grants, and java policies, assigned to users. It does not generate…

Read More

Steps to reformat the corrupted free blocks.

Please find the steps done below for one type of block but can be used for any block.   create table demo.wcc99(n number, c varchar2(4000)) nologging tablespace DISC pctfree 99…

Read More