Restoring to Raw Devices

To restore a backup to a raw device, the device must be large enough to hold both the dbspace and the space reserved for the operating system.

Query the system tables to determine whether the raw device is large enough:
SELECT segment_type, file_name, block_count,
data_offset, block_size, 
(block_count * block_size) + data_offset AS raw_size
FROM SYS.SYSIQFILE, SYS.SYSIQINFO 
where segment_type !='Msg' ORDER BY 1,2
The query returns results similar to this:
segment_type  file_name           block_count  data_offset block_size  raw_size
Main          iqdemo.iq           12800        65536       8192        104923136
Main          iqdemo_main.iq       2800        65536       8192        104923136
Temp          iqdemo.iqtmp         3200        65536       8192         26279936
Columns returned by the query:
Column Name Description
segment_type

Main or Temp segments, but not message files (type Msg).

file_name

Dbspace name.

block_count

Number of blocks in use.

data_offset

Number of bytes reserved for the operating system.

block_size

Number of bytes per block.

raw_size

Minimum raw device size, in bytes required to restore the dbspace. The target device must be at least 10MB larger than the original raw device.

Example

In this scenario, the database iquser resides on a raw device. This command performs a FULL database backup to two tape devices:
BACKUP DATABASE
TO '/dev/rmt/0n'
TO '/dev/rmt/1n'
WITH COMMENT 'Jan 18 full backup of iquser'
The catalog store is backed up first, to /dev/rmt/0n. The IQ store is backed up next, to both tapes.
Assume that a media failure occurs and the raw partition is now unusable. To restore a user-defined dbfile named IQ_USER to a new raw partition, / dev/rdsk/c1t5d2s1:
RESTORE DATABASE 'iquser'
FROM '/dev/rmt/0n'
FROM '/dev/rmt/1n'
RENAME IQ_SYSTEM_MAIN TO '/dev/rdsk/c2t0d1s1'
RENAME IQ_SYSTEM_TEMP TO '/dev/rdsk/c2t1d1s1'
RENAME IQ_SYSTEM_MSG TO 'iquser.iqmsg'
RENAME IQ_USER TO '/dev/rdsk/c1t5d2s1'
You can also issue these commands using only the last RENAME clause, since only one dbspace is being restored to a new location. Listing all of the files or raw partitions, as shown here, ensures that you know exactly where each will be restored.
Related concepts
Database Restore
Verifying Database Backups
Displaying Header Information
Restoring Cache Dbspaces
Moving Database Files
Restoring Multiplex Stores
Error Recovery