To run saplikey command, switch to <sid>adm user.
su - <sid>adm
The saplikey command follows the below syntax.
saplikey pf=<profile> [trace=<level>] <command>
Here in <profile> we give our instance profile path.
The <command> parameter takes the below listed values.
-help => displays the usage text
-version => displays the version of the license key library
-get => displays system information along with hardware key
-number => fetches installation number
-install <filename> => Install permanent license keys from a file
-show \=> Display all installed license keys
-temp <product> \=> Creates a temporary license key for the given product
-delete <SID> <HW Key> <product> => deletes license keys
So to get the hardware key of a system, use the get command as follows.
saplikey pf=<instance profile path> -get get
To list out existing licenses (both valid and invalid) in a system, we use the show command. (NOTE: Here the hardware keys for which the licenses are generated would be displayed. So the hardware key here and the one obtained from -get command will differ if the license is invalid).
saplikey pf=<instance profile path> -show
Deleting an existing license is done as given below.
saplikey pf=<instance profile path> -delete <SID> <Hardware key> <Product mentioned in license key>
To install a new license, we first login to SAP marketplace. Then go to license keys option. Then generate and download the required license.
Place the downloaded file in any path in the host (Here for example we placed it under /usr/sap/).
Then use saplikey install command.
saplikey pf=<profile> -install /usr/sap/license.txt