If you are running out of memory, you will see the following error message:
java.lang.OutOfMemoryError
When you are running out of memory, either the Mirror Replication Agent drops out of Replicating state or the entire Mirror Replication Agent server stops executing.
To support adjusting the amount of memory available to the JRE, all of the executable scripts (or batch files) in the Mirror Replication Agent bin directory refer to an environment variable named RA_JAVA_MAX_MEM. All Mirror Replication Agent instance RUN scripts also reference the RA_JAVA_MAX_MEM environment variable.
Mirror Replication Agent 15.2 does not set the RA_JAVA_MAX_MEM environment variable in the executable or RUN scripts, enabling the JVM to use the default maximum heap size. In Java 6, the default maximum heap size is the smaller of the following two values:
one quarter of the physical memory
1 GB
See the Java 6 documentation for information about the default initial and maximum heap sizes and for recommendations on how to set the defaults.
The default maximum memory can be set in three ways:
By setting RA_JAVA_MAX_MEM in the RUN script file
By setting the RA_JAVA_MAX_MEM environment variable
By setting RA_JAVA_MAX_MEM in the ma script file.
The setting of RA_JAVA_MAX_MEM in the RUN script file overrides the setting of the RA_JAVA_MAX_MEM environment variable and the setting of RA_JAVA_MAX_MEM in the ma script file. If RA_JAVA_MAX_MEM is not set in the RUN script file, the setting of the RA_JAVA_MAX_MEM environment variable overrides any value set for RA_JAVA_MAX_MEM in the ma script file. The setting for RA_JAVA_MAX_MEM in the ma script file is used only if RA_JAVA_MAX_MEM is set neither in the RUN script file nor in the RA_JAVA_MAX_MEM environment variable.
You can override the JVM default for the maximum amount of memory available to the JRE for all instances of Mirror Replication Agent or for one specific instance of Mirror Replication Agent.
Overriding the default for all instances
Open the ma script file for editing.
For Windows, edit the %SYBASE%\MA-15_2\bin\ma.bat file.
For UNIX, edit the $SYBASE/MA-15_2/bin/ma.sh file.
Uncomment lines in the ma script file.
For Windows, uncomment the following line:
set RA_JAVA_MAX_MEM=512m
For UNIX, uncomment the following lines:
RA_JAVA_MAX_MEM=512m
export RA_JAVA_MAX_MEM
If necessary, replace “512m” with a value appropriate for your replication environment.
Save the ma script file.
Overriding the default for one instance
Open the RUN script file for editing.
For Windows, edit the %SYBASE%\MA-15_2\<instance>\RUN_<instance>.bat file.
For UNIX, edit the $SYBASE/MA-15_2/<instance>/RUN_<instance>.sh file.
Here, <instance> is the name of the Mirror Replication Agent instance.
Uncomment lines in the RUN script file:
For Windows, uncomment the following line:
set RA_JAVA_MAX_MEM=512m
For UNIX, uncomment the following lines:
RA_JAVA_MAX_MEM=512m
export RA_JAVA_MAX_MEM
In the UNIX RUN file, spaces are
not allowed on either side of the = sign.
If necessary, replace “512m” with a value appropriate for your replication environment.
Save the RUN script file.