Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Important Script Method for tuning Oracle
  • import-export with multiple files Oracle
  • Rename Tablespace Oracle
  • Gathering statistics with DBMS_STATS Oracle
  • find checksum of a file. Linux/Unix
  • oracle_env_10g_CADEV Linux/Unix
  • dbms_job.submit example Oracle
  • Rename Oracle Instance Name Oracle
  • Zip and unzip with tar Linux/Unix
  • Find Stale DR Physical Standby Oracle
  • pvmehta.com SQL scripts
    Find which sessions is accessing object that prevent your session to have exclusive locks in Oracle Oracle
  • How to know Number of CPUs on Sun Box Linux/Unix
  • For Perl DBI installation and testing program PHP/MYSQL/Wordpress
  • find_string_in_database.sql Oracle
  • 10g RAC: Troubleshooting CRS Root.sh Problems Oracle

find_pk.sql /* Find Primary Key */

Posted on 02-Aug-2005 By Admin No Comments on find_pk.sql /* Find Primary Key */

set pagesize 300

set linesize 205

set head on

set echo off

spool tblwopk

accept usrid prompt ‘Enter User Name : ‘

accept table_name prompt ‘Enter Table Name : ‘

column PrimaryKey format a80 heading ‘Follwoing Are Primary Keys’

select substr(a.column_name, 1, 20) || ‘ Position : ‘ || to_char(a.position) PrimaryKey

from dba_cons_columns a, dba_constraints b

where b.table_name = upper(‘&TABLE_NAME’)

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

and a.constraint_name = b.constraint_name

and b.constraint_type = ‘P’

order by a.position;

Oracle, SQL scripts

Post navigation

Previous Post: fkwoindex.sql /* Find FK without Index */
Next Post: tblwopk.sql /* Find Tables Without PK */

Related Posts

  • Find_stale_dr.sql finding stale physical DR.. Oracle
  • Goog notes on X$ tables Oracle
  • Temporary Tablespsace Temp tablespace behaviour Oracle
  • switchover for primary database Oracle
  • How to stop OCSSD Daemon Oracle
  • Oracle10g – Using SQLAccess Advisor (DBMS_ADVISOR) with the Automatic Workload Repository Oracle

Leave a Reply Cancel reply

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

Categories

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

Recent Posts

  • 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
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025
  • MYSQL and Oracle Comparison for Oracle DBA24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Export With Query Another Example. Oracle
  • get_vmstat.ksh Linux/Unix
  • findinfo.sql (SQL for getting CPU and Active session info) Oracle
  • Index Range Scan Oracle
  • Load testing on Oracle 19C RAC with HammerDB Oracle
  • Find Stale DR Physical Standby Oracle
  • sess_server.sql Oracle
  • Linux CPU info. Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme