This is largely dependent on the differences is Oracle version, and OS version. IF both are at the same version, and Oracle is patched in the same manor then the answer becomes a factor of:
IF all of the database related files will reside in the same place THEN
...do a cold clean shutdown of the database
...copy the datafiles, temp, undo, redo logs, control files AND instance related files (initINST.ora, spfileINST.ora, orapwINST, etc) in $ORACLE_HOME/dbs
...setup the instance in the oratab file (or, if it is Windows, use ORADIM to create the instance related windows service)
...startup normally
IF the file structure will change, but the instance name will not THEN
...do a cold clean shutdown of the database
...copy the datafiles, undo, redo logs AND instance related files (initINST.ora, spfileINST.ora, orapwINST, etc) in $ORACLE_HOME/dbs
...do not copy controlfiles
...setup the instance in the oratab file (or, if it is Windows, use ORADIM to create the instance related windows service)
...startup nomount
...recreate the controlfiles using the "create controlfile reuse ~ noresetlogs" command
...add back in TEMP tablespace
IF the file structure will change AND the instance name will as well THEN
...do a cold clean shutdown of the database
...copy the datafiles, undo, redo logs AND instance related files (initINST.ora, spfileINST.ora, orapwINST, etc) in $ORACLE_HOME/dbs
...do not copy controlfiles, temp or redo logs
...setup the instance in the oratab file (or, if it is Windows, use ORADIM to create the instance related windows service)
...startup nomount
...recreate the controlfiles using the "create controlfile set ~ resetlogs" command
...add back in TEMP tablespace
This is the typical, old-style clone technique. Normally, I am a fan of the RMAN DUPLICATE, but if this is a one time thing, I probably wouldn't worry about it. If this isn't 11g, you would be taking a separate backup, transporting that for use by rman. If it is 11g, duplicate can use the "from active database" clause, so long as the instances can reach each other on the network.
Best Answer
One can use rman to duplicate a database. Here is the Database Backup and Recovery User's Guide.
But now let's assume that you have a copies of these files that where made when the database was down and where already copied to the places of the target system.
On the target server 1 you have the same type of perating system as on the source server 1. On the target server you have the same Oracle version with the same patch level as on the source server. You can check this by setting the oracle environment and executing the command
and compare the output of both servers.
If you don't have the right environment you can clone the Oracle software from the source server using Oracle Universal Installer.
So let's assume that you have the correct software installed and set the correct environment of the Oracle instance of the target server.
what happens if you do a
startup nomount
of the database in sqlplus?sqlplus first searches for
if such a file does not exist it searches for
and oracle is started with the parameters given in this files. I am not 100% sure about that. Maybe sqlplus starts oracle executable and the oracle executable searches for these files. But that does not matter for our purposes.
So the parameters of these file should have sensible values. This means, the pathes in these files should point to the correct files.
If not, you have to change them. The init.ora file can be modified with a text editor. An spfile must be transformed to a init.ora file by executing
in sqlplus while the instance is not running.
&absolute_spfile_path
must be substituted by the correct path.then you can edit the file
/tmp/myfile.tx
with a text editor. You can change the pathes, if an instance name is in the file it must be modified, too. Memory parameters can be adapted. Underline parameter written by the instance should be removed, e.g. '_sga_target' and similar parameters.and then create a modified spfile by issuing
Before you start you can make a copy of your files so that you can start again when something went wrong.
Make a copy of the init.ora and spfile.ora, the control files, the redo log files and the datafile of th SYS, SYSAUX and undo tablespaces. the datafile of the remaining tablespaces make readonly with the appropriate Linux command(chmod) so they can't be modified by oracle. Tempfiles are not needed from the source database.
Now you can start the instance with
check the alert log if everything is ok. If there are errors then repair tthem.
If everything is fine then mount the dtabase
Now the control file is read. You can rename all files now. In the control file their old name is stored. you can see this if you do a
issue an
until all datafile are removed.
The same command can be used to rename the log files.
shows you the names of the redo log files in the controlfile.
You can put the tempfiles offline to avoid eror messages when openinf the database
shows you then namesof the temp files.
puts the file offline.
Now you can open the database
Now add new temp files with correct path and size to your temp tablespaces.
and then remove the old ones
If you have made the daatafiles read only then shutdown the database, make the files read/write and start the database again.
Now you are done.