Skip Headers
Oracle® Secure Backup Reference
Release 10.1

Part Number B14236-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

obtar -x

Purpose

Use obtar -x to extract files from a backup image. You can extract the entire contents of a backup image or only part of the backup image.

To restore data to your own directories, you do not need special rights. To restore data into directories as root, you must be either be logged in as root or specify the -R option with the obtar command.

Syntax

obtar -x::=

obtar -x [ -kpORvzZ ]
[ -f device ]...
[ -F { cur|file-number } ]
[ -H destination-host ]
[ -s,prefix,[replacement,] ] [ pathname ]...

Semantics

You can specify a number of options with obtar -x; this section describes those options that you are most likely to use. Refer to "obtar Options" to learn about additional obtar -x options.

pathname

Specifies the path names of files or directories to be extracted from the backup image. If you specify a directory, then obtar recursively extracts the contents of the directory. If you do not specify a path name, then obtar extracts the entire contents of the backup image.

-f [ device ]

Specifies the name of the device where the data is located. If you do not specify -f, then obtar reads from the device specified by the TAPE environment variable, if it is defined.

-F [ cur|file-number ]

Specifies the number of the backup image on the volume set. If you do not specify -F, then obtar extracts the backup image at the volume's current position.

If you specify cur, then obtar extracts the backup image at the volume's current position. This is the default.

If you specify file-number, then obtar extracts the backup image at the specified file position.

-H destination-host

Specifies the host to which the data will be restored. If you do not specify -H, then obtar restores the data to the local host.

-s,prefix,[replacement,]

Specifies where obtar should place the extracted files and directories. Use this option to extract files from a backup image and place them in a location that differs from the place from which you backed them up.

When you use -s, obtar substitutes the replacement string for prefix in the path name being restored. prefix must include the leftmost part of the original path name. For example, if you backed up the directory /home/jane/test, and if you wanted the data restored to /home/tmp/test, then you would specify the string as follows: -s,/home/jane,/home/tmp,.

If you omit the replacement string, then obtar assumes a null string, which causes obtar to remove the prefix from every pathname where it is found. The delimiter character, shown as a comma (,) in the syntax statement, can be any character that does not occur in either the prefix or the replacement string.

When you use -s, obtar displays the names of the files or directories as they are restored.

-k

Prevents obtar from overwriting any existing file that has the same name as a file in the backup image. In other words, obtar only restores files that do not already exist.

-p

Causes obtar to restore data with the same permissions and ownership that they had in the backup image. If you do not specify -p, then obtar applies the current umask to the restored permissions.

-O

Causes obtar to stop after restoring the requested files. If -O is not specified, then obtar searches the entire backup image for subsequent copies of the requested files.

-R

Causes obtar to run with root access. To use -R you must be a member of a class with the perform restores as privileged user right. You do not need to use -R if you are logged in as root.

-v [-v]

Displays the path names of the files and directories being restored. If you specify -v -v (or -vv), then obtar displays the path names of files and directories being restored and their permissions, owner, size, and date of last modification.

-z

Displays the volume label of the backup image if it has one.

-Z

Prevents obtar from uncompressing any data that was compressed previously with -Z. If you do not specify -Z, then obtar uncompresses any data that was compressed previously with -Z.

Examples

Extracting Files from a Backup Image

Example 4-15 extracts the contents of backup image 4, which is on the volume loaded on device tape1.

Example 4-15 Extracting Files from a Backup Image

obtar -x -f tape1 -F 4

Displaying the Contents of a Backup Image

Example 4-16 uses the -v option to display the contents of the backup image as it is being extracted.

Example 4-16 Displaying the Contents of a Backup Image

obtar -x -v -f tape1 -F 4

doc/
doc/chap1
doc/chap2
test/
test/file1
test/file2

Displaying the Volume Label

Example 4-17 uses the -z option to display the volume label of the volume being extracted.

Example 4-17 Displaying the Volume Label

obtar -x -z -f tape1 -F 4

Extracting Data to a Different Location

Use the -s option to place the extracted data in a location different from its original location. This option is particularly useful if you have backed up data and specified absolute path names. If you do not use -s, then obtar restores the data into the original directory, overwriting any existing data with that same name. Example 4-18 extracts the /doc directory and places it in a directory called /tmp/doc.

Example 4-18 Extracting Data to a Different Location

obtar -x -f tape1 -s,/doc,/tmp/doc, /doc

Example 4-19 prevents obtar from overwriting any files in the /doc directory that have the same names as files in the backup image:

Example 4-19 Preventing obtar from Overwriting Files

obtar -x -f tape1 -k /doc

Example 4-20 restores the contents of a raw file system partition. The partition is assumed to have been previously formatted and to be currently unmounted.

Example 4-20 Restoring a Raw File System Partition

obtar -x -f tape0 /dev/rdsk/dks0d10s1