Skip to content
Home » Oracle » How to Write Control File into Raw Device

How to Write Control File into Raw Device

Control File in Raw Device?

Since raw devices cannot be read/write as a normal file operation, you cannot write a controlfile directly into a raw device.

I guess DBA will have the problem on 9i or 10g, because 11g database does not support raw devices any longer, but 11g ASM does, and 11g ASM can take care itself through ASMCMD. For more information, please refer to the post below:
How to Copy Files From One ASM Instance to Another

One scenario you will meet is to copy a standby controlfile into a raw device to build a physical standby. Here are the steps:

  1. Create a standby controlfile when database is online or mount.
  2. SQL> alter database create standby controlfile as '/tmp/standby_control.ctl';
  3. Ship the controlfile to the standby server.
  4. $ rcp /tmp/standby_control.ctl standby:/tmp/standby_control.ctl
  5. Switch user to root on standby server, use "dd" to restore the standby controlfile into the raw devices.
  6. # dd if=/tmp/standby-control.ctl of=/dev/vg1/rlv01 bs=1024k
    # dd if=/tmp/standby-control.ctl of=/dev/vg1/rlv02 bs=1024k
    # dd if=/tmp/standby-control.ctl of=/dev/vg1/rlv03 bs=1024k

The key step is using dd to set input and output file stream to complete the data transfer, if you have many raw devices need to be copy, just repeat dd command with correct output path.

For avoiding bytes related errors, you may check the following post: How to Resolve dd: invalid number.

Leave a Reply

Your email address will not be published. Required fields are marked *