Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • How to analyze statspack or AWR report. Oracle
  • ENQ: KO – FAST OBJECT CHECKPOINT tips Oracle
  • Oracle Material from OTN Oracle
  • Building Our Own Namespaces with “Create Context” Oracle
  • ORACLE_SID in sqlplus Oracle
  • scp with ssh2 Linux/Unix
  • 751131.1 New Article Error 2819 While Requesting a Systemstate Dump Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • PLSQL Table Syntax 2 Oracle
  • compile_inv.sql Oracle
  • Goldengate Tutorial Oracle
  • Running select from V$ views from remote server Linux/Unix
  • check_copy_progress.sh Linux/Unix
  • Exadata Basics Oracle
  • Temporary Tablespsace Temp tablespace behaviour Oracle

segment_wise_space.sql segspace.sql Segment wise space usage (allocated and used)

Posted on 18-Apr-2006 By Admin No Comments on segment_wise_space.sql segspace.sql Segment wise space usage (allocated and used)

spool seg1 set lines 141 set serveroutput on execute dbms_output.enable(1000000); declare tmp varchar2(1); v_tbl_name varchar2(100); v_tot_blocks number; v_tot_bytes number; v_unused_blocks number; v_unused_bytes number; tot_mb number; unused_mb number; v_fileid number; v_blockid number; v_block number; cursor c1 is select OWNER, segment_name, segment_type, bytes/(1024 *1024) USED_MB, (extents * initial_extent)/(1024 *1024) Allocated_MB, Tablespace_name, extents from dba_segments where owner in…

Read More “segment_wise_space.sql segspace.sql Segment wise space usage (allocated and used)” »

Oracle, SQL scripts

catall.sh

Posted on 06-Apr-2006 By Admin No Comments on catall.sh

#!/bin/ksh for fname in `ls` do print “”; print “/* File Name : $fname */”; print “”; cat $fname done

Linux/Unix, shell

before_trunc.sql Before Truncate table needs to execute following:

Posted on 31-Mar-2006 By Admin No Comments on before_trunc.sql Before Truncate table needs to execute following:

/* before_trunc.sql This script gives disble constrints script before truncating table */ accept tblname prompt ‘Enter the Table Name You want to truncate -> ‘ column head heading “Execute Following Statements To Truncate &tblname, as &tblname is referenced by following foreign keys” select ‘alter table ‘ || lpad(b.table_name, 30) || ‘ disable constraint ‘ ||…

Read More “before_trunc.sql Before Truncate table needs to execute following:” »

Oracle, SQL scripts

TRUNCATE table and disabling referential constraints.

Posted on 31-Mar-2006 By Admin No Comments on TRUNCATE table and disabling referential constraints.

When you truncate table A, and Table A has some child table that contain data. TRUNCATE fails. For that you need to find table A’s all child tables and diable that referential integrity. /* before_trunc.sql This script gives disble constrints script before truncating table */ accept tblname prompt ‘Enter the Table Name You want to…

Read More “TRUNCATE table and disabling referential constraints.” »

Oracle, SQL scripts

Rownum with Order by

Posted on 31-Mar-2006 By Admin No Comments on Rownum with Order by

Above version 8.0, you can select rows for specified range. select * from ( select a.*, rownum rnum from ( YOUR_QUERY_GOES_HERE — including the order by ) a where rownum = MIN_ROWS /

Oracle, SQL scripts

tblwopk.sql tablewopk.sql

Posted on 28-Mar-2006 By Admin No Comments on tblwopk.sql tablewopk.sql

select a.table_name from user_tables a where not exists ( select ‘x’ from user_constraints b where b.table_name = a.table_name and b.constraint_type = ‘P’);

Oracle, SQL scripts

fkwoind.sql fkwoindex.sql

Posted on 28-Mar-2006 By Admin No Comments on fkwoind.sql fkwoindex.sql

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…

Read More “fkwoind.sql fkwoindex.sql” »

Oracle, SQL scripts

usnsql.sql Displays information about UNDO segments with sql statements

Posted on 27-Mar-2006 By Admin No Comments on usnsql.sql Displays information about UNDO segments with sql statements

select /*+ ALL_ROWS */ a.usn, a1.name, a.extents, a.hwmsize, a.status usn_status, b.start_date, b.status tx_status, c.sid, c.sql_id, d.sql_text from v$rollstat a, v$rollname a1, v$transaction b, v$session c, v$sqlarea d where a.usn = b. xidusn and a.usn = a1.usn and b.ses_addr = c.saddr and c.sql_id = d.sql_id;

Oracle, SQL scripts

Drop tempfiles from database

Posted on 21-Mar-2006 By Admin No Comments on Drop tempfiles from database

(1) alter tablespace temp add tempfile ‘/db7/oradata/WEBARCH/temp01.dbf’ size 1024M; (2) alter database tempfile ‘/db2/oradata/WEBARCH/temp_001.dbf’ drop including datafiles;

Oracle, SQL scripts

sid_wise_cursor.sql find open cursor basis on username or SID

Posted on 10-Mar-2006 By Admin No Comments on sid_wise_cursor.sql find open cursor basis on username or SID

accept u_name prompt ‘Enter User Name (Enter NONE if want SID specific query): ‘ accept s_id prompt ‘Enter SID (Enter 0 for Userspecific Query): ‘ select a.sid, b.sql_text, a.sql_id, c.spid, b.user_name from v$session a, v$open_cursor b, v$process c where a.sql_id = b.sql_id and (a.username = upper(‘&u_name’) or a.sid = &s_id ) and a.paddr = c.addr…

Read More “sid_wise_cursor.sql find open cursor basis on username or SID” »

Oracle, SQL scripts

Posts pagination

Previous 1 … 36 37 38 … 56 Next

Categories

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

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • DBMS_JOB all example Oracle
  • 751131.1 New Article Error 2819 While Requesting a Systemstate Dump Oracle
  • how to find OS block size Oracle
  • eplan9i.sql Oracle
  • Search and Replace vi editor command. Linux/Unix
  • switchlogfile.sh Linux/Unix
  • How to stop OCSSD Daemon Oracle
  • Example of How To Resize the Online Redo Logfiles Note:1035935.6 Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme