Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Building Our Own Namespaces with “Create Context” Oracle
  • moving lob object to other tablespace lob_mvmt.sql Oracle
  • cif crons Linux/Unix
  • backspace in SQL Plus not working then..? Linux/Unix
  • Find total file sizes Linux/Unix
  • Order by with ROWNUM Oracle
  • cur_sql.sql Oracle
  • Temporary Tablespsace Temp tablespace behaviour Oracle
  • TRUNCATE Privs Oracle
  • find_du.ksh to find # of files, their sizes in current folder and its subdolder Linux/Unix
  • To find explain plan for a statement that occurred in past. Oracle
  • pvm_metric.sql for gathering report from vmstat tables Oracle
  • How to start CRS manually Oracle
  • changing kernel parameter in Oracle Enterpise Linux Linux/Unix
  • run this before doing any dbchange pvm_pre_change.sql 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

  • Very clear article about oracle dataguard Oracle
  • Clean up Oracle
  • ext#.sql Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • Convert multiple rows to single column Oracle
  • 10g oem configuration 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
  • Remove duplicate rows from table Oracle
  • Rman Notes -1 Oracle
  • Rman Notes -1 Oracle
  • Search and replace pattern Linux/Unix
  • Jai Shree Ram Oracle
  • Reading config file from other folder inside class Python/PySpark
  • How to Decide upto what level you can decrement your datafile size. ( Shrink Datafile) Oracle
  • Goldengate document from Porus Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme