How to safely eject a tablespace oracle and move it to another machine

oracleoracle-12c

I've a tablespace created on a external hardisk with one big datafile. If there are no connections to it, is it safe to eject the disk and plug it into a new machine? And how to map the tablespace to the oracle in the new machine?

Best Answer

If there are no connections to it, is it safe to eject the disk and plug it into a new machine?

No. Absolutely not.

Database != File

Unless you shutdown the entire database, there is no guarantee that changes have been written from the Buffer Cache into the data files that make up that Tablespace.

Making a Tablespace transportable does forces that write activity to happen (and then prevents any more) but without the downtime. But then, as you say, you have to muck about "mapping" that Tablespace into the new database. Don't make work for yourself.

Your best option, though (i.e. easiest, most reliable, best supported but, perhaps, not fastest to execute), is to dump (datapump) the data out of one database and into the new one. Depending on your network connectivity, you might be able to do this over a database link, or might have to resort to moving the dump file between machines.