Problem solve Get help with specific problems with your technologies, process and projects.

DBAs and scripting languages

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

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

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.