Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6803347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:20:00+00:00 2026-05-26T19:20:00+00:00

I am looking for the command line command that will display the same thing

  • 0

I am looking for the command line command that will display the same thing as the gui

Unindexed Foreign Keys 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:20:00+00:00Added an answer on May 26, 2026 at 7:20 pm

    There is no command line command (that I know of) which does it. But you can roll your own. Basically you need a query which checks the database for these, which is effectively what your GUI tool must be doing. The query would be something like:

    SELECT  FK.table_name, FK.constraint_name
    FROM    user_constraints FK
    WHERE   FK.constraint_type = 'R'
    AND     EXISTS
            (   SELECT  FC.position, FC.column_name
                FROM    user_cons_columns FC
                WHERE   FC.constraint_name = FK.constraint_name
                MINUS
                SELECT  IC.column_position AS position, IC.column_name
                FROM    user_ind_columns IC
                WHERE   IC.table_name = FK.table_name
            )
    

    NOTE: This SQL is NOT perfect. There could be situations where it is fooled into thinking there is an index bet there’s not really. Multiple different indexes with columns in the right place could fool it. To do it properly you’ll need to start grouping in inline views or use analytic functions to ensure all the index columns come from the same index. So I left it at this simple version which will work most of the time.

    Then you can run this SQL in sqlplus, or you could embed it in a shell script which is easily run from the command line. A crude one would be:

    #!/bin/bash -ue
    
    LOGIN="$1"
    sqlplus -s << END_SQL
        $LOGIN
        SET PAGESIZE 5000
        SELECT  FK.table_name, FK.constraint_name
        FROM    user_constraints FK
        WHERE   FK.constraint_type = 'R'
        AND     EXISTS
                (   SELECT  FC.position, FC.column_name
                    FROM    user_cons_columns FC
                    WHERE   FC.constraint_name = FK.constraint_name
                    MINUS
                    SELECT  IC.column_position AS position, IC.column_name
                    FROM    user_ind_columns IC
                    WHERE   IC.table_name = FK.table_name
                )
    /
    END_SQL
    

    Which you can then run like this and get the basic results:

    [user@centos5 sql]$ ./fk.sh scott/tiger@orcl
    
    TABLE_NAME                     CONSTRAINT_NAME
    ------------------------------ ------------------------------
    EMP                            FK_DEPTNO
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a command-line program that will print out the text of a
I'm looking for a way to create a command-line thor app that will run
I'm looking for a set of command line parameters that will allow me to
I am looking for a Linux command-line tool that would report the disk IO
I am looking for a (preferably) command-line tool that can reformat the C# source
I'm looking for a .NET library or command line tool that would allow me
I was looking for a portable script or command line program that can synchronize
I'm looking for a tool which will allow me use command-line-style (preferably POSIX) strings
I'm looking for a Unix command that will allow me to search/replace in a
I've been tasked with writing a simple command line utility in C# that will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.