ba6.us - Dave's Database Related Stuff

  • home
  • blog
  • notebooks
  • projects
  • recent
  • about
  • manifesto
  • !
Home

Tag Cloud

apex Application Express Auditing data dbi development export funnies HTML Java linux monitoring oem oracle performance perl rman scripting sql SQL Developer sqlplus tuning unix windows
more tags

Search

RSS Feed

Blog Posts :

Navigation

  • Feed aggregator

User login

  • Request new password

sqlplus

Using Proxy Connections with SQL Developer or SQLPLUS

dmann — Tue, 09/13/2011 - 14:04

When trying to debug for another user sometimes it is helpful to be able to log in as that user. In the past magic was done by admins by storing the encrypted passwords, setting to a new temporary password, logging in, and then resetting the old encrypted password back. Luckily modern Oracle versions we have the concept of a Proxy user. This allows connecting as one user but masquerading as another user (once proper permissions have been granted of course). So far I have done this with SQL Developer and SQLPLUS, instructions are below for a test case.
Read more »
  • Proxy
  • SQL Developer
  • sqlplus
  • dmann's blog
  • Add new comment

Shell Script to Run a SQLPLUS against all databases running on a server...

dmann — Tue, 12/29/2009 - 14:33

#!/usr/bin/bash
#---------------------------------------------------------------------------
# Written by  : David Mann @ http://ba6.us
# Script Name : alldatafiles.sh
# Description : Provides list of all datafiles for each running database on 
#               on a machine
#---------------------------------------------------------------------------

ORATAB=/etc/oratab
echo "INSTANCE_NAME, FILE_NAME"

# Step through running instances
ps -ef | grep ora_smon_ | grep -v grep | cut -b61-70 | while read LINE
do
    # Assign the ORACLE_SID
    ORACLE_SID=$LINE
 Read more »
  • shell script
  • sqlplus
  • dmann's blog
  • 1 comment

Returning Error Codes from SQLPLUS

dmann — Thu, 04/19/2007 - 05:42

There may come a time when you need to return an error code from SQLPlus, either to a calling batch file, shell script, or Perl script.

SQLPlus has a WHENEVER directive available for handling errors it encounters. This command controls the behavior of SQLPlus when an OS or SQL error occurs. There are many options for this behavior.

More after the jump…

SQL errors include errors thrown by a single command entered into SQLPlus or an error raised by a PL/SQL block: Read more »

  • oracle
  • sqlplus
  • dmann's blog
  • Add new comment

SQLPLUS and the Ant build tool...

dmann — Thu, 03/29/2007 - 17:55

I've been looking for ways to automate running of Oracle SQLPlus PL/SQL scripts.Of course there are always batch and shell scripts but I'm looking for something less OS specific.Our Java build process is controlled by Apache Ant. It would be nice to include running of SQL scripts in this process. Here are some tools to help integrate SQLPLUS with ANT. SQL Task This task is best for executing bits of literal SQL. This task doesn't know anything about SQLPlus features such as formatting, variables, spooling, etc.
Read more »
  • ant
  • sqlplus
  • dmann's blog
  • 1 comment

Using SQLPLUS to generate scripts…

dmann — Thu, 08/10/2006 - 15:29

Tired of updating scripts by searching and replacing until your fingers fall off? Have a SQL statement you have to run against every table in your schema? Next to Regular Expressions, this is one of the most useful tools in my arsenal. Common uses for this are to write SQL statements that can work from a list of objects in the database: * Tables from USER_TABLES or DBA_TABLES * Constraints from USER_CONSTRAINTS or DBA_CONSTRAINTS * Indexes from USER_INDEXES or DBA_INDEXES * USER_OBJECTS with an appropriate filter on OBJECT_TYPE (TABLE, PACKAGE, SEQUENCE, etc…)
Read more »
  • oracle
  • sqlplus
  • dmann's blog
  • Add new comment
Syndicate content


Cornify
  • home
  • blog
  • notebooks
  • projects
  • recent
  • about
  • manifesto
  • !

Content Copyright 2006-2010. Links are copyright of respective owners.