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

Batch processing cpio -r

We have a Unix database that completes a cold backup to tape every night. The files are written out using their full pathname using the cpio command. We need to restore these files to a different pathname for creating test database purposes. I have looked at the cpio -r option but this seems to only be available in interactive mode. We need a way of batch processing this cpio -r for multiple datafiles... any advice and/or scripts would be appreciated.

There are a couple of options for you. One option is to use a scripting language called Expect. Expect is a scripting language that can interface with any command line interface. You tell Expect what to "expect", and your Expect script will supply the next answer. For instance, you can invoke SQL*Plus from Expect. You tell Expect to expect the prompt for the username. Then, when Expect sees this prompt, it passes the supplied username to the SQL*Plus executable. You can use it to do the same thing in your example. Have your Expect script call "cpio -r" for you. Tell it what to expect in return and how to respond to that prompt. Expect is one of the great scripting languages that no one talks about!

Otherwise, you might want to consider dropping the directory path from your files that you archive with cpio. Or consider using something other than cpio to do the archive.

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.