Ask the Expert

DBAs and scripting languages

As a good Oracle DBA, is it necessary to know any scripting languages, and if yes then which ones?

    Requires Free Membership to View

I think that knowing scripting languages is very important. This way, you can write small programs, or scripts, to perform maintenance tasks for you. How do you backup your database? Many people have scripts for that. How do you rebuild indexes at 3:00 in the morning when you are sound asleep? Many people have scripts for that too. Practically any maintenance task for Oracle databases can be scripted and then scheduled to run at a certain time and/or interval.

I strongly suggest that you learn the scripting language that is native to the platform your database runs on. If you are on Unix platforms, then learn Shell scripting. If you are on a Windows platform, then learn the old DOS scripting commands.

Two other scripting languages that I use all the time are Perl scripts and Expect scripts. Perl is a great, multipurpose scripting language that many, many DBAs use. The nice thing about Perl is that a Perl program written for one system will work on almost any other system, with very few modifications. In Unix, it is very easy for me to find a list of files in a directory that are older than a certain date with the "find" command. I can then pass those files to the "rm" command to remove files older than this date. There is no equivalent in DOS. So for databases on my Windows platforms, I wrote a Perl script to do the same. I can even use this on Unix if I want!

Expect is another great scripting language. Expect scripts will launch any command-line program for you. Most of these utilities will prompt you for information. With Expect, you tell it what prompts to "expect" and how to respond. I've written many Expect scripts to launch SQL*Plus and sign on to the database and run some commands.

For More Information


This was first published in January 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: