Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • How can I tell if ASO is installed ? Oracle
  • sid_wise_sql.sql Further explaination Oracle
  • move_arch_files.ksh Linux/Unix
  • Global Unique Identifier Generation in Oracle 9.2 SYS_GUID() Oracle
  • Oracle Recommended Patches — Oracle Database ID 756671.1 Oracle
  • For Search and replace unix command. Linux/Unix
  • TOP-N Sql to find Nth max or Top N rows Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • import-export with multiple files Oracle
  • Histogram information Oracle
  • Oracle 11g Environment Setup Oracle
  • find_log_switch.sql Find log switches in graphical manner Oracle
  • set_env_dba Linux/Unix
  • Sort with ASCII order and Numeric Order Linux/Unix
  • To seee semaphores and shared memory segments in Solaris 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

  • Oracle10g – Using SQLAccess Advisor (DBMS_ADVISOR) with the Automatic Workload Repository Oracle
  • FGA Part-I Oracle
  • How to find pinned objects from shared pool. (pinned via dbms_shared_pool.keep) Oracle
  • Virtual Indexes in Oracle Oracle
  • Kill a session dynanically using execute immediate Oracle
  • lck.sql 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 (149)
  • MYSQL (5)
  • Oracle (395)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (343)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • prepfiles.sh for step by step generating pending statistics files10-Mar-2026
  • tracksqltime.sql05-Mar-2026
  • Complete Git Tutorial for Beginners25-Dec-2025
  • Postgres DB user and OS user.25-Dec-2025
  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Windows based Command line mailing program like mailx (Sednmail for windows) PHP/MYSQL/Wordpress
  • Find average Row Length and other table size calculation. metalink notes Oracle
  • TRUNCATE table and disabling referential constraints. Oracle
  • Find Plan Hash value fphv.sql Oracle
  • DB Console Mainenance. Oracle
  • find_string_in_database.sql Oracle
  • Transfer SQL Profiles from One database to other database. Oracle
  • temp_use.sql diplays usage of temp ts Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme