Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

add raw device as datafile to Oracle on HP-UX

Nina Tang
Occasional Visitor

add raw device as datafile to Oracle on HP-UX

This is what I use on Solaris:
ALTER TABLESPACE ADD DATAFILE '/dev/rdsk/cNtNdNs2';

And Oracle automatically figured out how large the raw device was, and added it as a datafile accordingly.

But this doesn't seem to work on HP-UX. When I used the same type of statement (cNtNdN, without the s2), I get an error:

00010: ORA-01257: cannot reuse database file /dev/rdsk/c7t0d7, unknown file size

How do I get Oracle to figure out how large the raw device is on HP-UX? Or how do I add a raw device as datafile in this case?

Thanks,
Nina
5 REPLIES
Steven E. Protter
Exalted Contributor

Re: add raw device as datafile to Oracle on HP-UX

Oracle can use any sized raw device file in HP-UX.

You are attempting to use the disk directly.

Can't do that.

You have to do this:

#my example assumes vg02 is the oracle one

lvcreate -C y /dev/vg02 a new logical volume this will give you a name
lvextend -L /dev/vg02/lvol## /dev/rdsk/cNtNdNs2

The lxextend command says extend this logical volume to size whatever on disk whatever.

Then go to /dev/vg02 and change ownership with chown to oracle:dba or whatever id and group the oracle binaries are owned by.

Now you can use sqlplus to bring the data container online.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Nina Tang
Occasional Visitor

Re: add raw device as datafile to Oracle on HP-UX

So I can't use a raw device directly on HP for Oracle? I can mount a FS directly on a raw device though...

OK, so I need to wrap the device in a volume. But how do I add the volume as a datafile to Oracle?

I tried this before:

ALTER TABLESPACE ADD DATAFILE '/dev/ninadg/vol1';

And it gives me an error saying:

ORA-01119: error in creating database file '/dev/ninadg/vol1'
ORA-27038: skgfrcre: file exists
A. Clay Stephenson
Acclaimed Contributor

Re: add raw device as datafile to Oracle on HP-UX

Actually, you can use the raw disks as well but you have to use the WHOLE disk (e.g. /dev/rdsk/c7t0d7) and specify the size and reuse. HP-UX hasn't supported disk slices since HP-UX 10.10 (I think). For that reason LVM raw logical volumes are almost always used on HP-UX which can be sized much more conveniently as well as changed "on the fly". I strongly suggest that you do not use raw devices directly but rather add a symbolic link so that to oracle you use something like "/oradata/user01.raw" and then symbolically link to the actual raw LVOL. That way data can be easily moved (even back to "cooked" files) to other devices with absolutely no Oracle changes.

Finally, unless this is Oracle RAC, you just might find that there is no advantage to using raw vs cooked i/o.
If it ain't broke, I can fix that.
Nina Tang
Occasional Visitor

Re: add raw device as datafile to Oracle on HP-UX

I tried specifying the exact size of the disk & used "REUSE", it finally worked.
Thanks!!!

We'll have to re-evaluate to see if we really want to implement this.
Ken_109
Advisor

Re: add raw device as datafile to Oracle on HP-UX

I would highly recommend not using symbolic links to RAW devices. It just creates an extra layer of abstraction or confusion. Moving data from a raw device is easily accomplished just use dd ... And renameing a datafile in oracle is trivial. this is even more important, when using a shared disk subsystem. As the raw volumes are typically the same name across hosts. So if a datafile is added using symlinks, then the symlink to the raw device would need to be created ahead of time on the other host, prior to adding the datafile. If this is not done, and the data file is accessed via the second instance (and it will be sooner or later) the tablespace is put into a needs media recovery type mode since it the datafile is not accessible.