Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
cancel
Showing results for 
Search instead for 
Did you mean: 

moving raw device to filesystem

SOLVED
Go to solution
miki leon
Advisor

moving raw device to filesystem

Hi To All

i have an oracle database that seets on raw devices .

i want to move this data to file systems .

i think that i need to create the a new logical colume and file system and to do a dd from the raw device to the raw device of the new filesystem , but what about all the file header of the file system ,

so i m lost .

how can it be done ( from someone that did it )
love unix
13 REPLIES
harry d brown jr
Honored Contributor

Re: moving raw device to filesystem


Normally one would export the database, recreate your database in a filesystem, and then import.

I'm not sure that dd'ing a raw device file to some filename is going to work, but then again, I've never tried to either.

live free or die
harry
Live Free or Die
Leif Halvarsson_2
Honored Contributor

Re: moving raw device to filesystem

Hi

Leif Halvarsson_2
Honored Contributor

Re: moving raw device to filesystem

Sorry,
I hit the submit button by mistake.

Doing a dd from the Oracle raw device to another raw device will (at best) create another raw Oracle database (and destroy the filesystem). I have not done a such database move but I think you must do a Oracle export, create a complete new database and import the data to the new database.
Ashwani Kashyap
Honored Contributor

Re: moving raw device to filesystem

I think an export of the database from the raw devices anf then import into file systems is the best way to go for it .
Bill Hassell
Honored Contributor

Re: moving raw device to filesystem

A raw device, whether Oracle or Sybase or any other database contains no files at all. Instead, the database manages the space based on block address and nothing else. The only possible way to convert is to export the entire database. Note that the exported data may need a bit more space than the raw device since general-purpose HP-UX directories must be created.


Bill Hassell, sysadmin
稀里哗啦
Advisor

Re: moving raw device to filesystem

Hi, I think only export and import the tablespace is enough.
Yogeeraj_1
Honored Contributor
Solution

Re: moving raw device to filesystem

hi,

There is another way besides EXPORT/IMPORT. IT CAN BE DONE!

Below a quote from Oracle:

goal: How to convert datafile from raw device to file system
fact: Oracle Server - Enterprise Edition



fix:

Use RMAN to move datafiles from raw devices to file system.

1. Connect to the database:

$ sqlplus system/manager@orcl

2. Put the tablespace with the datafile, which should be converted, offline:

SQL> alter tablespace test_ts offline;

3. Start rman and connect it to the database:

$ rman nocatalog target rman/rman@orcl

4. Move the datafile to file system:

RMAN> run {
2> allocate channel c1 type disk;
3> copy datafile '/dev/raw1' to '/u01/oradata/orcl/test_ts.dbf';
4> }

5. Rename the moved datafile:

SQL> alter database rename file '/dev/raw1' to '/u01/oradata/orcl/test_ts.
dbf';

6. Put the tablespace back online:

SQL> alter tablespace test_ts online;


Notes:
======
1. If you are using RMAN as the backup tool then a backup after the performed
steps is recommended, because otherwise RMAN treats the copied file as a
backup.

2. Usually Oracle datafiles are moved from filesystem to raw devices using
the dd command. Using dd is the fastest method to accomplish it. However, it is
necessary to know how many blocks to skip in the raw device (e.g. it is
necessary to skip 64K on Tru64 Unix), so that the information necessary for
the Operating System is not overwritten. The information on how many blocks to
skip is different on the different platforms. Using RMAN there's no necessity
to know such platform specific information.



Hope this helps!
Best Regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
T G Manikandan
Honored Contributor

Re: moving raw device to filesystem

Leon,


you can bring down the database take a full cold backup.

Then you can use dd to copy the data from the raw datafiles to filesystem.
Like

dd if=/dev/r.... of=
Then you can do a
svrmgr>statup mount
svrmgr>alter database rename file '' to ''

The above command is to move a single datafile to another location.
If you have multiple files for each datafile you have to repeat the step.

Then you can do a alter database open
svrmgr>alter database open

If you have datafiles on raw devices for only one or two non-system tablespaces then you can follow the link given by Yogeeraj.

Taking the tablespace offline,moving the datafiles and again bringing back the tablespace online.


Also if you have less number of users then you can take a user level export and import it.


Thanks
miki leon
Advisor

Re: moving raw device to filesystem

Hi

First , thanks a lot for the reply .
i think that i will go with the way of T G Manikandan .

this was what i was thinking .


i will let you know which way i deside to do and if it work fine .

again thanks a lot for replying and helping me
love unix

Re: moving raw device to filesystem

Hi,

You can even use cp instad of dd. Example:

cp

Good luck!

Marcin
zhuchao
Advisor

Re: moving raw device to filesystem

Marcin Gonet is wrong. Raw device cannot be copied in this way. Use dd or rman.
Rman is the preferred way as id does not care about the lvm reserved blocks.
If you use dd, maybe you have to use dd skip=xx bs=xx.
www.happyit.net
Hein van den Heuvel
Honored Contributor

Re: moving raw device to filesystem

Bill Hassell,
Can you drop me a quick Email? (I could not find you in the HP ldap) Hein at hp dot com.

Bill: The only possible way to convert is to export the entire database. Note that the exported data may need a bit more space than the raw device since general-purpose HP-UX directories must be created.

I beg to differ, a block of data is a block of data. They are exactly the same whether in a file or on a raw device. The only gotcha is that raw devices (on some platforms) skip the disk header / label and thus when moving data you need to skip 64kb (dd skip / iseek / oseek).

I do agree that export/import is the only SUPPORTED way.

miki,

Just to satisfy our curiosity... why move?

Anyway, be sure to TRY with a TEST tablespace!
Just create a fresh (LVM) raw devive, plop in a table, transfer and see if you find your data back no?!

Also, check out the relatively unknown "TRANSPORTABLE TABLESPACES" as a supported way to perform bulk moves, and copies even between databases. (must have enterprise edition). See chapter 11 in the Database Administrators's guide: Managing Tablespaces... Transporting Tablespaces.

Finally, always use (soft) links for your DB files, such that you can avoid the 'alter database... rename' or 'create control file for'.

Regards,
Hein.

Re: moving raw device to filesystem

chao_ping,

Why are you saying I am wrong? Miki Leon was asking for a reply from a person who did it and I did it several times without any problem.

So nevertheless it is not a supported solution, you can use dd or even cp. It works.