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...
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
- 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.
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.