Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Export With Query Another Example. Oracle
  • UTL_FILE test program Oracle
  • Vivek’s egrep commands to trace problem. (on linux x86-64) Linux/Unix
  • Find all users who have DML privileges Oracle
  • RMAN : Consistent Backup, Restore and Recovery using RMAN Oracle
  • CPU speed on Linux Linux/Unix
  • Validating ORACLE_SID againt oratab file. Linux/Unix
  • replacing ^M character when passing files from Windows to Unix Linux/Unix
  • Windows based Command line mailing program like mailx (Sednmail for windows) PHP/MYSQL/Wordpress
  • Sequence Resetting Oracle
  • scripts to take listener.log backup Linux/Unix
  • Test Case for Inserting Multiple (2.3 Million rows in 26 Seconds) Oracle
  • dbms_job.submit example Oracle
  • Directory wise folder wise space usage Linux/Unix
  • get_ratio.sql get the ratio of users from v$session and this uses CASE-WHEN-THEN clause Oracle

fkwoindex.sql /* Find FK without Index */

Posted on 02-Aug-2005 By Admin No Comments on fkwoindex.sql /* Find FK without Index */

set pagesize 300

set linesize 205

set head on

set echo off

spool fkwoind

accept usrid prompt ‘Enter User Name : ‘

col “Cons Name” format a30 heading “Cons Name” word_wrapped

col status format a10 heading status

col “Cons Type” format a12 heading “Cons Type”

col “Column Name” format a30 heading “Column Name”

col “Cons Desc” format a50 heading “Cons Desc” word_wrapped

REM Find all FK Constraints, that does not have column position in constraint and in index matching

select /*+ rule */ b.table_name, b.constraint_name “FK-Cons|Name”,

substr(a.column_name, 1, 30) “Column Name”, a.position, b.status

from dba_cons_columns a, dba_constraints b

where a.constraint_name = b.constraint_name

and a.owner = b.owner

and a.owner = upper(‘&usrid’)

and b.constraint_type = ‘R’

and (b.table_name, a.column_name, a.position) not in

( select table_name, column_name, column_position

from dba_ind_columns

where table_owner = a.owner

)

order by b.table_name, b.constraint_name, a.position;

REM Find all FK Constraints, that does not have index on it.

select /*+ rule */ b.table_name, b.constraint_name “FK-Cons|Name”,

substr(a.column_name, 1, 30) “Column Name”, b.status

from dba_cons_columns a, dba_constraints b

where a.constraint_name = b.constraint_name

and a.owner = b.owner

and a.owner = upper(‘&usrid’)

and b.constraint_type = ‘R’

and (b.table_name, a.column_name) not in

( select table_name, column_name

from dba_ind_columns

where table_owner = a.owner

)

order by b.table_name, b.constraint_name, a.position;

spool off

Oracle, SQL scripts

Post navigation

Previous Post: findx.sql /* Find Indexes on specified USER.TABLE_NAME */
Next Post: find_pk.sql /* Find Primary Key */

Related Posts

  • TNSNAMES entries details Oracle
  • SQLPLUS COPY command Precautions. Oracle
  • Query to Generate aggregate on every 30 mins. Oracle
  • Sending SQLPLUS output in HTML format Oracle
  • dbinv.sql Oracle
  • V$ROLLSTAT status is Full Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • VIvek Encryption Package and Its Usage Oracle
  • UNderstand and eliminate Latch contention. Oracle
  • sql_plan9i.sql Oracle
  • Oracle Identifiers Oracle
  • Finding last recovered file on DR and remove all chanracters before any “/” Linux/Unix
  • Alter procedure auditing Oracle
  • My Minimum Tuning Programs Oracle
  • Good Doc 28-JUN-2006 Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme