How to move Oracle DB to New Oracle Home on Same Windows Server

Nov 25, 2013 / By Suresh Karthikeyan

Tags: , , ,

I have been thinking about writing a Pythian blog for long time, and today I finally took the opportunity.

In the DBA life, it’s common to get a request to move the database across servers due to a RDBMS upgrade plan or receiving new hardware. It’s not common, however, to receive a request to move RDBMS Oracle home within the same server. This request may arrive due to improper planning of creating the Oracle home into the root mount point on Unix platforms, and C:\\ drive on Windows platforms(system mountpoint/drive).

The cloning feature introduced by Oracle from the 10gR2 version become handy to work with on this request. The use of clone.pl script on Unix platform is quite straightforward, as we have full control over Unix processes. The thread architecture on Windows platform makes this a bit different, but not complex.

Let’s assume the current Oracle home is located at “C:\\oracle\\product\\11.1.0″ directory, and the new directory planning to move is “D:\\oracle\\product\\11.1.0″ for example. As usual, keep the database name as TEST. The steps below describe the activities required.

Step 1. Log into Windows server as local server user, which is part of local administrator and ora_dba groups. Let the existing Oracle database run and start to copy the entire contents from “C:\\oracle\\product\\11.1.0″ directory to “D:\\oracle\\product\\11.1.0″ directory. Ensure the copy process is completed without any issues.

Step 2. Take existing Oracle home inventory details for reference. Open a command prompt window (Window I) and execute these commands.

C:\>set ORACLE_HOME=C:\\oracle\\product\\11.1.0
C:\>set PATH=C:\\oracle\\product\\11.1.0\\OPatch;C:\\oracle\\product\\11.1.0\\bin;%PATH%
C:\>opatch version
C:\>opatch lsinventory

Step 3. Open a new command prompt (Window II) and set the environment variables appropriately.

C:\>set PERL5LIB=D:\\oracle\\product\\11.1.0\\perl\\5.8.3\\lib ==> This depends on Perl version exists under oracle home, may differ from version to version.
C:\>set PATH=D:\\oracle\\product\\11.1.0\\perl\\5.8.3\\bin\\MSWin32-x86-multi-thread;%PATH%

Step 4. Run the clone.pl script from Window II.
C:\>perl clone.pl ORACLE_HOME=”D:\\oracle\\product\\11.1.0″ ORACLE_HOME_NAME=”OraDB11gR1_home” ORACLE_BASE=”D:\\oracle”

Execution of this command should complete without any issues. Review the log file C:\\Program Files\\Oracle\\Inventory\\logs\\cloneActions<DATE>.log for the verification.

Excerpts from the log file:
————————————
INFO: ca page to be shown: false
INFO: exitonly tools to be excuted passed: 0
INFO:
*** End of Installation Page***
The cloning of OraDB11gR1_home was successful. ==> Should get this message.

Step 5. Execute the following commands from window II for the newly cloned home configuration verfication.
C:\\>set ORACLE_HOME=D:\\oracle\\product\\11.1.0
C:\\>set PATH=D:\\oracle\\product\\11.1.0\\OPatch;D:\\oracle\\product\\11.1.0\\bin;%PATH%
C:\\>opatch version ==> Output should match with the output obtained on step 2.
C:\\>opatch lsinventory ==> Output should match with the output obtained on step 2.

Step 6. Get maximum 15 minutes downtime for the database and bring down the TEST database. Open the services utility and stop “OracleOraDB11g_homeTNSListener” service and “OracleServiceTEST” service.

Step 7. On Window I, execute this command to delete the existing listener service from the server.
C:\\>C:\\oracle\\product\\11.1.0\\bin\\netca.bat

Step 8. Execute this command from Window I to delete the existing database services from the server.
C:\\>ORADIM -DELETE -SID TEST

Step 9. Open the services utility and confirmed all the services belongs to old oracle home including “Oracle TEST VSS Writer Service” and “OracleJobSchedulerTEST” are deleted.

Step 10. Invoke Oracle Net Configuration Assistant from Window II to configure new listener service.
C:\\>D:\\oracle\\product\\11.1.0\\bin\\netca.bat

Step 11. Create new database service from new oracle home from Window II.
C:\\>ORADIM -NEW -SID TEST -SYSPWD *** -STARTMODE auto -SPFILE

Note: This command would start the database instance too.

Step 12. Open services utility and confirmed the following services got created from new oracle home.Modify the “Startup Type” for these services accordingly.
OracleOraDB11gR1_homeTNSListener
OracleServiceTEST
Oracle TEST VSS Writer Service
OracleJobSchedulerTEST

Now work with your application administrator, and confirm that everything works fine :)

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>