Search
Navigation
Recent blog posts
- Oracle IN Condition and Multi Column Subqueries
- SQL For Dinosaurs
- Quickie script to run dbv on your database...
- Permissions for Autotrace
- Accuracy of PROFILER.SQL from Metalink Doc: 243755.1
- Recording Oracle System Stats for historical analysis...
- Shell Script to Run a SQLPLUS against all databases running on a server...
- Viewing command line args with Solaris ps utility...
- Orion IO Test Tool
- Documented Hints available in 11.2...
Books
User login
sqlplus
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 »
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 »
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 »
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 »