My colleague has got this error message:

$ opatch lsinventory
OPatch/opatch: line 750: bc: command not found
Invalid maximum heap size: -Xmxm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

OPatch failed with error code 1

A "bc" is an arbitrary precision calculator language (witch is often required for math calculation in Bash scripts, when you are using floating-point numbers for example) and many of us are using the bc command as simple command-line calculator and now OPatch does it the as well. It is used just for setting maximum heap size for JRE (this is being done in setUpJREMemoryOPtions() function of opatch command) which in newer versions is using "bc" command. The idea behind this post is beacause many Linux/Unix (power) users don't know about "bc", surprisingly even some SysAdmins.

$ OPatch_old/opatch version
OPatch Version: 12.1.0.1.7

OPatch succeeded.

$ OPatch_new/opatch version
OPatch_new/opatch: line 750: bc: command not found
Invalid maximum heap size: -Xmxm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

OPatch failed with error code 1

# rpm -ih bc-1.06.95-13.el7.x86_64.rpm
################################## [100%]
Updating / installing
################################## [100%]

$ OPatch_new/opatch version
OPatch Version: 12.1.0.1.12

OPatch succeeded.

To solve the issue simply execute (to install the bc package):

# yum install bc

and put the bc-*.rpm to your list of required packages by Oracle software.

 

Update 20.3.2017:

Recently I have tested Opatch utility shipped in Oracle Database 12c Release 2 (Opatch version 12.2.0.1.6). Following error message appears if "bc" package is not installed while opatch_env.sh exists in OPatch main directory.

./opatch lsinventory
./opatch: line 908: bc: command not found
Invalid maximum heap size: -Xmxm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

OPatch failed with error code 1

If opatch_env.sh is missing in OPatch main directory "bc" package is not required. Anyway I still recommend to have "bc" package installed by default.