Parm Patram

Oracle, Linux and UNIX tips, tricks and stuff
  • Home
  • Site Map
  • See long running jobs in the RAC

    RMAN, SQL & PL/SQL, SQLPLUS 08-10-2011 Comments Off

    column
    select inst_id,opname, totalwork, sofar, time_remaining from gv$session_longops where totalwork > sofar order by time_remaining;

  • NLS date format

    HEADS UP, SQL & PL/SQL, SQLPLUS 02-11-2011 Comments Off
    ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
    
  • see tag on raw devices (oracle asm)

    ASM (Automatic Storage Magement), SQL & PL/SQL, SQLPLUS 01-10-2011 Comments Off

    cat /dev/raw/raw46 | od -a -N128

  • Run SQL commands from shell script

    SQL & PL/SQL, SQLPLUS, Scripts 11-15-2010 Comments Off

    #!/bin/bash

    #
    # login to database and run a query

    SQL_HOME=WHERE
    LOG_HOME=WHERE
    SQL_USER=WHAT
    SQL_PASS=WHAT
    SQL_HOST=WHAT
    SQL_DB=WHAT
    SQL_PORT=1521
    LOGFILE=${SQL_HOME}/output.log

    SQL_LOGIN_STR=”${SQL_HOME}/sqlplus -S ${SQL_USER}/${SQL_PASS}@${SQL_HOST}:${SQL_PORT}/${SQL_DB} ”

    cd $SQL_HOME

    RESULT=`${SQL_LOGIN_STR} << EOF
    SET HEADING OFF
    SELECT NAME FROM V\\$DATABASE;
    exit;
    EOF`

    if [ $RESULT == $SQL_DB ]; then
    echo `date`”: OK: $RESULT” | sed ’s/\n//g’ >> $LOGFILE
    else
    echo `date`”: Got Error: $RESULT” | sed ’s/\n//g’ >> $LOGFILE
    fi

  • Write CLOB data to file using UTL_FILE

    SQL & PL/SQL, SQLPLUS 04-28-2010 Comments Off

    http://www.idevelopment.info/data/Oracle/DBA_tips/LOBs/LOBS_41.shtml

  • Call UNIX utilities from within PL/SQL and java

    SQL & PL/SQL 04-25-2010 Comments Off

    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:952229840241

  • Showing object compilation errors.

    SQL & PL/SQL, SQLPLUS 03-15-2010 Comments Off

    set wrap on
    set pages 20
    set lin 200
    column name format A25
    column type format A15
    column seq format 9999
    colunn line format 9999
    column pos format 999
    column text format A100
    select name,type,sequence seq,line,position pos,text from dba_errors where owner=’OWNER’ order by type,name;

  • Oracle PL/SQL Programming online book

    Documentation, SQL & PL/SQL 02-18-2009 Comments Off

    http://docstore.mik.ua/orelly/oracle/prog2/

  • Equivalent of mysql limit clase for sqlplus

    SQL & PL/SQL, SQLPLUS 11-17-2008 Comments Off
    SELECT a, b, c
    FROM
    ( SELECT a, b, c, ROWNUM rn
      FROM
      ( SELECT a, b, c FROM RECORD
        WHERE AVAIL='Y"
        ORDER BY DATE DESC
      )
      WHERE ROWNUM <= 25
    )
    WHERE rn >= 21;
    
    This clunky code is the equivalent of mysql's elegant:
    select a,b,c from record limit 5 offset 4;
  • PL/SQL whitepaper

    Documentation, SQL & PL/SQL 09-15-2008 Comments Off

    http://www.oracle.com/technology/tech/pl_sql/htdocs/New_In_10gR1.htm

« Previous Entries

Category:

  • Administration
    • ASM
    • BLOCK SIZE
    • Database Recovery
    • DBVERIFY
    • GRANTS
    • OEM
    • REDO LOGS
  • APPS
    • AutoConfig
    • Change EBS IP Address
    • Cloning
    • DB Environment Vars
    • Discoverer
    • Environment Vars
    • Patching
    • Problems
    • Resources Online
    • Tricks & Tips
    • Upgrading
    • Workflow
  • Articles
  • Backup & Recovery
  • Certification
  • Configuration
  • DATABASE STRUCTURE
    • Data Dictionary
    • Logical Database Structure
    • Physical Database Structure
    • SCHEMA
  • DATAGUARD
  • Documentation
    • ASM (Automatic Storage Magement)
    • Command Reference
    • DataPump
    • Documentation Library
    • SQL Developer
  • EBS
  • Enterprise Manager
  • FLASHBACK
  • HACKING
  • HEADS UP
  • Installation
    • RAC
  • JDeveloper
  • Linux
    • iptables
    • Networking
  • Monitoring
    • Big Brother
  • MQ
  • NFS
  • NXclient/server
  • Online Resources
  • PERL
  • python
  • RMAN
    • RMAN Catalog Setup
  • Routing & Switching
  • SAN – NAS
    • Netapp
  • Scripts
  • Serial-Parallel-Port-Testers
  • SNMP
  • Software
  • Solaris
  • Spiritual
  • SQL & PL/SQL
  • SQLPLUS
  • Startup/Shutdown
  • Streams
  • Tuning
    • INDEXES
    • SQL Tuning
      • TKPROF and sql_trace
  • Version Control
  • Vertias
    • VCS
    • VxFS
  • VMWare
  • VNC
  • Windows XP
  • ZFS
© Blogname. All Rights Reserved. Entries RSS Comments RSS Login Open Source