Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • scripts to take listener.log backup Linux/Unix
  • Processes parameter and its dependencies on OS kernel parameters Linux/Unix
  • configUOCIOTTO.ora Oracle
  • fuser to check who is using diretory Linux/Unix
  • How to know current SID Oracle
  • Facts about SCN and Rollback Segment Oracle
  • Exadata Basics Oracle
  • Good Site for Oracle Internals Oracle
  • Jai Shree Ram Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • Vivek’s egrep commands to trace problem. (on linux x86-64) Linux/Unix
  • find checksum of a file. Linux/Unix
  • Distributed Transaction Troubleshooting. Oracle
  • TRUNCATE Privs Oracle
  • Rman Notes -1 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

  • Reclaim temp tablespace for oracle 8, 8i Oracle
  • To check whether standby is recovering properly or not?? Oracle
  • DBMS_Shared_pool pinning triggers Oracle
  • Oracle 10g for solaris 10 Oracle
  • RMAN : Consistent Backup, Restore and Recovery using RMAN Oracle
  • DBMS_UTILITY.ANALYZE_SCHEMA 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 (402)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (350)
  • SQL Server (6)
  • Uncategorized (3)
  • Videos (0)

Recent Posts

  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sql23-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
  • Creating a Container Database using dbaascli08-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • SQLPLUS COPY command Precautions. Oracle
  • Trace a SQL session from another session using ORADEBUG Oracle
  • Drop tempfiles from database Oracle
  • Histogram Overview Oracle
  • Wait Based Tuning Step by step with SQL statement Oracle
  • The most important Tuning Notes Oracle
  • Oracle 11g RAC on OEL 5 and Vmware 2 Oracle
  • JSON/XML Types in Oracle Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme