Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Generating XML from SQLPLUS Oracle
  • How to specify 2 arch location to avoid any kind of DB hanging. Oracle
  • pvm_metric.sql for gathering report from vmstat tables Oracle
  • arch_configUOCIOTTO.ora Oracle
  • In Addition to previous note, following grants needed on PERFSTAT user. Oracle
  • secure crt settings Linux/Unix
  • Good link for LIO in Oracle ( Logical IOs) Oracle
  • Error Handling in Proc Oracle
  • How to start CRS manually Oracle
  • Recovering lost SYS password Oracle
  • Wait.sql Oracle
  • cif crons Linux/Unix
  • Jai Shree Ram Oracle
  • Adding Datafile on Primary Server and Impact on Standby Server Oracle
  • Check_recovery.sh program to run sqlplus and return its values remotely. Linux/Unix

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

  • When to rebuld B-tree index Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • Find_table_size.sql Oracle
  • JSON/XML Types in Oracle Oracle
  • Oracle Identifiers Oracle
  • sql_doing_fts.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 (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • 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
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • scripts to take listener.log backup Linux/Unix
  • exp syntax in oracle 10g Oracle
  • Follwoing korn shell is used to move files from source folder to destination folder and gzip it in destination folder. mv_iotto.ksh Linux/Unix
  • Good notes on Oracle Events Oracle
  • To Find Orphan OS processes. Linux/Unix
  • Test Case for Inserting Multiple (2.3 Million rows in 26 Seconds) Oracle
  • Default User Profile Oracle
  • import-export with multiple files Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme