Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
This is the second installment of our nZDM Java process example. This blog post is specific for systems running on Oracle databases. First you should prepare the target hosts as described in the blog post nZDM Java Part 1: Prepare the Physical Host of your Target System.

For performing the system copy or cloning, you can use any procedure and tool you want. In our example we use Software Provisioning Manager (SWPM) and its database-specific homogeneous system copy procedure to create the target system. This method requires generally more time and effort than any of the virtualization-based cloning methods.

Performing the Database Backup on the Source System



NOTE: Keep in mind that throughout this blog post we use “database” when we mean “NetWeaver database”, for the sake of readability.



You need to create an online backup of your database system. Alternatively, you can use different approach provided by your database. There are several database-specific methods available, we describe just one of them.

For information see the System Copy – Target Databases Other than SAP HANA  relevant for your system, section Using a CONTROL.SQL File Created by the ORABRCOPY Tool.

1. Creating the database control file

For information see the System Copy – Target Databases Other than SAP HANA  relevant for your system, section Generating the Control File Structure.

You should generate the control file of the source system database. This file is used later during the system copy procedure. Note that it's very important that you execute all steps from the section Generating the Control File Structure.

  1. Login to the source system host as <oracle_user> (Linux) or <sid>adm (Windows). The OS user should have Oracle DBA privileges.

  2. Create the BRCopy directory, for example /oracle/<SID>/brcopy.

  3. Copy the ORABRCOPY.SAR archive from the directory where you unpacked the SWPM10SP<Support_Package_Number>_<Version_Number>.SAR file, and extract it using SAPCAR.


You can find the archive in the following directory:
<SWPM install durectory>\COMMON\INSTALL\ORA\ORABRCOPY.SAR


  1. Unpack the BRCopy SAR archive by executing the following command in your BRCopy directory:


SAPCAR -xvf ORABRCOPY.SAR


  1. Set your JAVA_HOME environment variable to point to the SAP JVM used by the system. On Linux, use the following command:


export JAVA_HOME=/sapmnt/<SID>/exe/jvm/linuxx86_64/sapjvm_6.x.xxx/sapjvm_6

Alternatively, edit the script ora_br_copy.sh (Linux) or ora_br_copy.bat (Windows) and set the path to the Java executable.

  1. Execute BRCopy with the following command line command depending on your operating system:




  • ora_br_copy.bat -generateFiles -targetSid <TARGET_DBSID> -password <system_password> -listenerPort <listener_port>



  • ora_br_copy.sh -generateFiles -targetSid <TARGET_DBSID> -password <system_password> -listenerPort <listener_port>



In the above command:

  • <TARGET_DBSID> is the target database SID. It should be the same as the source SID.

  • <password> is the password of ora<sid> (Linux) or <sid>adm (Windows).

  • <listener_port> is the Oracle Listener port. You can find this port by running lsnrctl status.


NOTE: Avoid using the parameter forceLogSwitches mentioned in the System Copy Guide, as using this parameter stops the database.

Upon successful execution, the following files should be generated: CONTROL.SQL, CONTROL.TRC, init<SID>.ora, ora_br_copy.log, and OraBRCopy.console.log.

  1. Copy the files CONTROL.SQL and init<SID>.ora to your SAP backup directory /oracle/<SID>/sapbackup.


2. Performing an online backup

See System Copy - Target Databases Other than SAP HANA  for your system, section Creating an Offline or Online Backup with BR*Tools.

The BR*Tools are installed automatically on the database server in the execution directory. Get the value of instance profile parameter DIR_CT_RUN. Depending on your OS:


  • D:\usr\sap\/<SAPSID>\SYS\exe\uc\NTAMD64 (Windows)



  • /usr/sap/<SAPSID>/SYS/exe/uc/linuxx86_64 (Linux)




  1. Login to the source system db host as <oracle_user> (Linux) or <sid>adm (Windows).

  2. Go to execution directory directory.

  3. Run BR*tools:
    <run> BRTools.exe
    <select> "4" - Backup Database
    <select> "1" - Database Backup​

    Now change the following values and <select> "c"

    <set> device type = disk
    <set> type = online_cons
    <set> Database user = SYSTEM/xxxxxxxx

    The select operation continues until the procedure finishes successfully.
    <select> “c” - Archive Log Backup (BRARCHIVE)
    change value
    <set> "3" - Backup Device Type = disk
    <select> 4x "c" - BRARCHIVE - archive log files
    stop BRTools

    Upon successful execution, the directory sapbackup should contain a complete backup of your database, ready to be copied to the target system host.

  4. Copy the sapbackup folder to the target system host.





    • Create ORACLE_SID, ORACLE_HOME and SAPDATA_HOME system variables (Windows).

    • Create dba and oper group (Linux)
      groupadd -g 703 dba

      groupadd -g 704 oper



    • Create an Oracle user, for example ora<sid> or oracle on Linux.
      useradd -d /home/ora<sid> -g 703 -s /bin/csh -u 712 ora<sid>

      passwd ora<sid>


    • Create the Oracle SID directory. On Linux, execute the following commands:
      mkdir /oracle/<SID>

      chown ora<sid>:dba /oracle/<SID>


    • Copy the database backup to the target system host. Login to your source system host as <oracle_user> (Linux) or <sid>adm (Windows) and copy the entire /oracle/<SID>/sapbackup directory to the target system host.
      scp -p -r /oracle/<SID>/sapbackup ora<sid>@<target_hostname>:/oracle/<SID> (Linux)

      pscp -p -r -pw <password> D:\oracle\<SID>\sapbackup ora<sid>@<target_hostname>: D:\oracle\<SID>\sapbackup (Windows)





Starting the System Copy



  1. Login to your target system host as <administrator> user.

  2. Create the installation directory.

  3. Download the latest version of the Software Provisioning Manager 1.0 archive from here - Download Software Provisioning Manager to the installation directory.



  1. Copy SAPCAR from your source system kernel directory (DIR_CT_RUN) to your target system host installation directory.

  2. Unpack the Software Provisioning Manager archive by executing the following command in your installation directory:


SAPCAR -xvf SWPM10SPxxxxxxxx.SAR


  1. Start sapinst in your installation directory with the appropriate switches:


sapinst SAPINST_USE_HOSTNAME=<source_hostname> JAVA_COPY_REMOVE_INSTANCES_IN_DB=no

For additional information, see the nZDM Java user documentation for your system, section Creating the Target System.

Installing the Target System with all Instances on the Same Host


To do so, first install the database server software, and afterwards install the target system on one host or hosts.

1. Installing the target system with all instances on the same host

  1. Start SWPM to install target system. Choose following from product catalog:
    <SAP Product> -> Oracle -> System Copy -> Target System -> Standard System -> Based on Java -> Standard System

  2. Enter all required information in the system copy screens. Make sure that all parameters such as SID, instance numbers, ports, and passwords, exactly match the same parameters of the source system. Pay attention to the following screens:





    • On the Welcome to SAP Installation screen, choose the option that matches the release, database platform, and distribution of the source system.

    • On the SAP System Database screen, choose Homogeneous System Copy (Backup/Restore).

    • On the Java System Copy screen, leave Target System Will Replace Source System unselected.

    • Choose Local Domain

    • On the Create Oracle Storage Based System Copy screen, specify the location of the CONTROL.SQL file created by the BRCopy tool, for example /oracle/<SID>/sapbackup/CONTROL.SQL3. After the Parameter Summary screen, the system copy procedure starts and runs until the step Install database server software.




The system copy procedure runs until the step Backup/Restore database. In this step, it will stop and ask you to restore the backup before continuing. Execute section Restoring the Database Backup on Oracle database.

3. Return to the SAPinst GUI and click OK to continue the system copy. It resumes and runs without further manual steps to the end.


As a result of a successful execution, the target system is ready for use. The SCS and SMD Agent instances are running, and the Java instance is not running. You can start it manually at this point or follow the steps described in Copying Kernel and JVM Files from the Source System before starting it.

2. Installing the distributed system

If the system is distributed on several hosts, choose Distributed.

<SAP Product> -> Oracle -> System Copy -> Target System -> Distributed System -> Based on Java

All mandatory instances are distributed on separate hosts. Mandatory instances of an SAP system are:

  • Central services instance (SCS instance)

  • Database instance

  • Application server instance


You can have one or more additional application server instances. You can find the installation for additional application server instances in Additional SAP System Instances.

<SAP Product> -> Oracle -> Installation -> Additional SAP System Instances

2.1. Installing the SCS instance

<SAP Product> -> Oracle -> System Copy -> Target System -> Distributed System -> Based on Java -> SCS instance

Fill in all required information in the system copy screens. Make sure that all parameters, such as SID, instance numbers, ports, and passwords, exactly match the same parameters of the source system. Pay attention to the following screens:

  • On the Welcome to SAP Installation screen, choose the option that matches the release, database platform, and distribution of the source system.

  • Choose Local Domain.


2.2. Installing the database instance

  1. Install the database server software. Afterwards, install the database instance itself according your database type.

  2. Start SWPM to install database instance. Choose the following from product catalog:


<SAP Product> -> Oracle -> System Copy -> Target System -> Distributed System -> Based on Java -> Database instance

3. Fill in all required information in the system copy screens. Make sure that all parameters, such as SID, instance numbers, ports, and passwords, exactly match the same parameters of the source system. Pay attention to the following screens:






    • On the Welcome to SAP Installation screen, choose the option that matches the release, database platform, and distribution of the source system.

    • On the SAP System Database screen, choose Homogeneous System Copy (Backup/Restore).

    • On the Java System Copy screen, leave Target System Will Replace Source System unselected.

    • Choose Local Domain

    • On the Create Oracle Storage Based System Copy screen, specify the location of the CONTROL.SQL file created by the BRCopy tool, for example /oracle/<SID>/sapbackup/CONTROL.SQL




After the Parameter Summary screen, the system copy procedure starts and runs until the step Install database server software.

The system copy procedure runs until the step Backup/Restore database. In this step, it stops and asks you to restore the backup before continuing. Execute section Restoring the Database Backup on Oracle database.

4. Return to the SAPinst GUI and click OK to continue the system copy. The system copy procedure resumes and hopefully runs to the end without further manual steps.


As a result of a successful execution, the target DB instance is ready for use.

Performing the Database Restore on the Target System



  1. Execute all steps in System Copy – Target Databases Other than SAP HANA  for your system, section Preparing the Target System (Oracle). In addition, create the below directory if it exists on the source system.
    <drive>:\oracle\<TARGET_DBSID>\oraflash


  2. Execute all steps in System Copy – Target Databases Other than SAP HANA  for your system, section Restoring the Database Files on the Target System with BR*ToolsProcedure”. Execute:brrecover -u / -t reset -b last -f <DB_SID> -pw <wallet password> -c force

  3. Shut down the Oracle database instance as follows. Go to bin directory D:\oracle\<SID>\<version>\BIN or /oracle/<SID>/<version>/bin of the oracle and execute:
    sqlplus /nolog
    connect / as sysdba
    shutdown immediate
    exit​



Finishing the System Copy


Return to the SAPinst GUI and click OK to continue the system copy. The procedure resumes and runs without further manual steps to the end. The warning message An error occurred updating the system history for Java... might appear. You can ignore it and continue.


Installing Application Server Instances


If the system is distributed on several hosts, install the Application Server instances.

  • On the Welcome to SAP Installation screen, choose the option that matches the release, database platform, and distribution of the source system.

  • On the Java System Copy screen, leave Target System Will Replace Source System unselected.

  • Choose Local Domain


As a result of a successful execution, the target system is ready for use. The SCS and SMD Agent instances are running, and the Java instance is not running. You can start it manually at this point or follow the steps described in section Copying Kernel and JVM Files from the Source System before starting it.

For additional information, see the nZDM Java user documenattion for your system, section Creating the Target System.

Copying Kernel and JVM Files from the Source System


For additional information, see the nZDM Java user documentation for your system, section Creating the Target System.

To have a completely identical target system, we recommend you copy the kernel and JVM files from the source system. In some cases, you may be forced to do this if you have issues with starting the Java instance due to a kernel that is too old for the OS.

1. Copying kernel and JVM files on Linux OS

  1. Make sure that all target system instances (SCS and Java) are stopped. On Linux, you can stop them by logging as <sid>adm and executing the following command for each instance:


sapcontrol -nr <nr> -function Stop

You can monitor the status of the instance processes by running GetProcessList, and the status of the Java processes by running sapcontrol -nr <nr> -function J2EEGetProcessList.

  1. Rename all target system executable directories. On Linux, login to your target system host as <sid>adm and execute the following commands:
    cd /usr/sap/<SID>/SYS/exe/uc/
    mv linuxx86_64 linuxx86_64.1
    cd /usr/sap/<SID>/SYS/exe/jvm/
    mv linuxx86_64 linuxx86_64.1
    cd /usr/sap/<SID>/J<nr>
    mv exe exe.1
    cd /usr/sap/<SID>/SCS<nr>
    mv exe exe.1​


  2. Copy all executable directories from the source system host. On Linux, login to your source system host as <sid>adm and execute the following commands:
    cd /usr/sap/<SID>/SYS/exe/uc/
    scp -p -r ./linuxx86_64 <sid>adm@<hostname1>:/usr/sap/<SID>/SYS/exe/uc/
    cd /usr/sap/<SID>/SYS/exe/jvm/
    scp -p -r ./linuxx86_64 <sid>adm@<hostname1>:/usr/sap/<SID>/SYS/exe/jvm/
    cd /usr/sap/<SID>/J<nr>
    scp -p -r ./exe <sid>adm@<hostname1>:/usr/sap/<SID>/J<nr>/
    cd /usr/sap/<SID>/SCS<nr>
    scp -p -r ./exe <sid>adm@<hostname1>:/usr/sap/<SID>/SCS<nr>/​


  3. Edit the Java instance profile and specify the correct value for the SAPJVM_VERSION parameter.

  4. Start all instances that were previously running. On Linux, you do that by logging as <sid>adm and executing the following command for each instance:
    sapcontrol -nr <nr> -function Start​

    or you can use sapstart if it exists:

    sapstart


  5. You can perform the above steps to copy the kernel and JVM files also for the SMD Agent instance. Make sure you login as the correct user since this instance is installed under a different SID, usually DAA.


2. Copying kernel and JVM files on Windows OS

  1. Make sure that all target system instances (SCS and Java) are stopped.

  2. Rename all target system executable directories:





    • <drive>:\usr\sap\<SID>\SYS\exe\uc\NTAMD64 to <drive>:\usr\sap\<SID>\SYS\exe\uc\NTAMD64.old

    • <drive>:\usr\sap\<SID>\SYS\exe\jvm\NTAMD64 to <drive>:\usr\sap\<SID>\SYS\exe\jvm\NTAMD64.old

    • <drive>:\usr\sap\<SID>\J<nr>\exe to <drive>:\usr\sap\<SID>\J<nr>\exe.old





  1. Copy all executable directories from the source system host to the target system host. From the target system copy do the following:





    • Copy \\<Source_System_IP>\saploc\<SID>\SYS\exe\uc\NTAMD64 to <drive>:\usr\sap\<SID>\SYS\exe\uc\NTAMD64

    • Copy \\<Source_System_IP>\saploc\<SID>\SYS\exe\jvm\NTAMD64 to <drive>:\usr\sap\<SID>\SYS\exe\jvm\NTAMD64

    • Copy \\<Source_System_IP>\saploc\<SID>\J<nr>\exe to <drive>:\usr\sap\<SID>\J<nr>\exe





  1. Edit the Java instance profile and specify the correct value for the SAPJVM_VERSION parameter:





    1. Open folder <drive>:\usr\sap\<SID>\SYS\exe\jvm\NTAMD64 and check name of folder sapjvm_<digits> (The <digits> are the value of the SAPJVM_VERSION)

    2. Open file <drive>:\usr\sap\<SID>\SYS\profile\<SID>J<nr><source_system>

    3. Change value of SAPJVM_VERSION to <digits>

    4. Save the file.





  1. Start all instances.

  2. Copying Kernel and JVM Files from the Source System to the Target System SMD Agent


Perform the above steps to copy the kernel and JVM files also for the SMD Agent instance.

This instance is installed under a different SID, usually DAA.

  • Instead of J<nr> use SMD<xx>.

  • For parameter SAPJVM_VERSION use the value from <drive>:\usr\sap\DAA\SMDA<xx>\exe\sapjvm_<nr>\buildinfo.txt -> parameter vmVersion.


Connecting to the Target System


Connect to the target system via IP address or target hostname of the target system. You should not use virtual host names (in this case it is source host names), as it is the same for both source and target system.

Also, you should use IP address to connect to the source system in nZDM Java UI to connect to the source system.

Also see the following resources: