Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • telnet listening Linux/Unix
  • CPU Core related projections AWS
  • ORA-1841 Error Connecting to Upgraded Database After Set PASSWORD_LIFE_TIME Oracle
  • TNSNAMES entries details Oracle
  • online_bkup.sql Oracle
  • nfs mount command Linux/Unix
  • Oracle Recommended Patches — Oracle Database ID 756671.1 Oracle
  • Passing from Unix to PLSQL using bind variables Linux/Unix
  • Zip and unzip with tar Linux/Unix
  • Read CSV file using PySpark Python/PySpark
  • cold backup scripts to copy locally Linux/Unix
  • create trigger syntax Oracle
  • runsql_once.ksh Linux/Unix
  • purge_trc.sh Linux/Unix
  • xargs use Linux/Unix

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

  • database trigger failing Oracle
  • runon_allcdbs_find_pdbs.sh Linux/Unix
  • get_vmstat_linux Oracle
  • How to find who is using which Rollback segment and how many rows or blocks in that rollback segments, Oracle
  • 284785.1 How to check RAC Option is currently linked into the Oracle Binary Oracle
  • OPENING A STANDBY DATABASE IN READ-ONLY MODE Oracle

Leave a Reply Cancel reply

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

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (150)
  • MYSQL (5)
  • Oracle (403)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (151)
  • SQL scripts (349)
  • SQL Server (6)
  • Uncategorized (5)
  • Videos (0)

Recent Posts

  • Key Management in Oracle: The Core Issue: Missing Master Key12-May-2026
  • SAT Mathematics 10 questions and answer at the end.30-Apr-2026
  • top 10 AI news today30-Apr-2026
  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sh23-Apr-2026
  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • top 10 AI news today Uncategorized
  • Day to day MYSQL DBA operations (Compared with Oracle DBA) MYSQL
  • get_vmstat.ksh for Solaris Oracle
  • oracle Dba site Oracle
  • Best approach for Oracle database patching sequence to latest/required patchset along with CPU/PSU/any-other-one-off patch ID 865255.1 Oracle
  • upload.html PHP/MYSQL/Wordpress
  • TRUNCATE table and disabling referential constraints. Oracle
  • How to choose Driver table in SQL statement Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme