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
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in January 2003