Oracle Database Administration Scripts | DBA Bundle

Posted: February 16, 2014 in General, Script
Tags: , , ,

This tool call it the DBA Bundle , it’s a tar file contains a group of most useful shell scripts that help the database administrator in the day to day tasks in a smart, safe and easy way, some of these scripts are old but it still doing it’s job efficiently 🙂 for more detail’s please check the below blog for DBA Bundle owner Mr.Mahmmoud ADEL

The bundle is downloadable from here:

This tool I call it DBA Bundle , it’s a tar file contains a group of shell scripts, you can DOWNLOAD the latest version from this link: [V. 2.4 25-Apr-2016]


To call script “” use “.” command: e.g.
# .

What if I’ve more than one database on the server, how to use “” script?

let’s say you’ve two databases running on the same servers (SALESDB & ORCL), if you want to use the shortcuts (alert,tns,bdump,..) for SALESDB just run “” script and select SALESDB, once you want to use the shortcuts (aliases) for ORCL DB re-run script “” and select ORCL this once, and so on.

That was regarding the shortcut commands (aliases), regarding the aliases of other scripts in this bundle each time you execute an alias of a script it will list to you the current running instances on the server to select the database you want the script to run against .

If you still can’t get the use of “” script, still it’s easy, just whenever you want to run any script go to the location where you extracted the bundle and run the script you want from there.

Now let’s move to the function of each script in this bundle:

Script Name | Description
——————-|——————————————–|  Script Export Full DB|SCHEMA|TABLE data
(gives your the option of using exp or expdp utility for the export).
——————-|——————————————– | Script Takes an online RMAN full backup for the database
(gives you the option of compressed backup).
—————— |——————————————– | Script Lists All TABLESPACES and it’s size on a database.
——————|———————————————      | Script Lists All DATAFILES and it’s size on a database.
——————|———————————————| Script Retrieves the AUDIT data for a DB user  in a specific date or number of days back.
——————|——————————————–| Script Retrieves the AUDIT data for a DB user in a specific date or number of days back. (this is the one linked to the alias if used “” script).
zanga zanga is a Libyan term used in one of the Gaddafi speeches(the ex-leader of Libya), when he vowed to hunt down protesters alleyway by alleyway but indeed the rebels hunted him down in a sewerage tube.
——————|——————————————–| Script Gathers STATISTICS on a SCHEMA or TABLE using DBMS_STATS
——————|——————————————– | Script Lists All Invalid Objects on the DB + it’s compile statements.
——————|——————————————— | Script Lists the Biggest 50 Objects on a database.
——————|———————————————| Script Lists the Details of a user session. (if no input, will list all sessions on the instance).
——————|———————————————| Script Lists All current sessions on all running instances [RAC DB].
——————|——————————————— | Script Lists the Blocking LOCKS on a database.
——————|——————————————— | Script Unlocks a specific DB User Account + the option of reset the user’s password.
——————|———————————————| Script Shows the details of a specific SQL STATEMENT by providing it’s SQL_ID.
——————|———————————————| Script Shows the value of a Visible or Hidden initialization Parameter.
——————|——————————————— | Script Lists All database Jobs (dba_jobs + dba_scheduler_jobs).
——————|———————————————| Script Shows the DB Session details when providing it’s Unix PID.
——————|———————————————| Script Backup & Clean up All DB & it’s Listener LOGs.
——————|———————————————| Script Shows the last login date of ALL users in the database.
——————|———————————————| Script Shows the failed login attempts in the last provided n of days.
——————|———————————————| Script Start TRACING an Oracle Session activities in a logfile.
——————|———————————————| Script Stop TRACING an already traced Oracle Session + provide the logfile and it’s TKPROFED log.
——————|——————————————— | Script Generates the Full SQL Creation script for a DB user.
——————|——————————————— | Script Generates Full SQL Creation script for a database Object.
——————|——————————————–| Script Deletes all Archivelogs older than (provided) number of days.
——————|——————————————–| Script Analyze All tables under a specific SCHEMA (using ANALYZE command).

Scripts that are not aliased:
The following scripts will not be included in the list of aliases because it’s not applicable or need to be used carefully:
————————————————————– | Script Monitors the ALERTLOGs of ALL Databases and Listeners running
on the server and instantly report ORA- errors and TNS- errors that appears
in these logs to the DBA E-mail Address by sending an email to the DBA
(you have to modify this parameter in line number 11
to point to your E-mail Address):

> Of course the sendmail service should be configured on the server.

The best use of this script is to schedule running it in the crontab
to run every 5 minutes (or less) to report ORA- and TNS- errors
when they appear in the DBs & listeners logs.
———————–|———————————————-| Script to SHUTDOWN ALL running Databases & Listeners on The server.
———————–|———————————————- | Script Takes a COLD BACKUP of a specific database
(of course the database will be down during the cold backup ;-))
This script will shutdown the database, takes a cold backup,
creates a restore script (in case you want to restore this cold backup
later ) then indeed it will startup the database.

That’s all regarding this bundle, please note that time by time I’ll update this bundle by adding new scripts or by improving the functionalities of existing ones.

  1. hany says:

    thanks a lot ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s