What is relinking?
The predefined functions for any language are defined inside the library files for that language and it is required to Compile the code to create a binary format file (object file). The Object files are then linked together with OS libraries to create one executable file. Successful linking requires all the function definition should be found, Linking generates an executable from it’s component. The terms linking and relinking mean the same in this context and are used interchangeably. In both cases an executable is being built from pre-built components.
The types of files involved in relinking are:
- * .c (source code file)
- * .o (object file)
- * .a (archived file)
- * .so or .sl on HP/UX (PA-RISC) (library files)
What is relinking of Oracle Home Binaries?
The Oracle software is shipped in form of object files (.o files), archive files (.a files) and then grouped in a compressed jar format. These object files are then get “relinked” at the operating system level during installation to create usable executables. This guarantees a reliable integration with functions provided by the OS system libraries. Generally, during relinking the current executables are renamed and saved, while the new executables are being generated. Once the new executables are in place and you have successfully tested that the new executables are working, you can delete the old executables in the directory ORACLE_HOME/bin. Each old executable has an ‘O’ appended to it’s file name, for example, ‘exp’ is renamed to ‘expO’.
The advantage of providing the object file is that it reduces the patch/package size , instead of providing the whole libraries or program, only objects files are shipped which then linked with OS libraries to create usable executables.
The following are the directories where various object files and archive files will reside in Oracle Home.
/lib /usr/lib $ORACLE_HOME/lib $ORACLE_HOME/rdbms/lib $ORACLE_HOME/
There is file named “sysliblist” which lives in $ORACLE_HOME/rdbms/lib or $ORACLE_HOME/lib directory. It contains a list of other libraries, which need to be included.
Why Oracle Home Relinking is required?
Oracle Home relinking is required to link Oracle provided object files to the OS system library. Relinking guarantees a reliable integration with functions provided by the OS system libraries.
Relinking occurs automatically under these circumstances:
- An Oracle Database has been installed with Oracle Universal Installer (OUI)
- An Oracle Database Patchset has been applied via Oracle Universal Installer (OUI)
- An Oracle Database Patch has been applied using “opatch” utility
- Relinking can also be performed manually.
When Manual relinking is required?
Manual relinking is required in below situations.
- After OS upgrade, Generally OS Vendors guarantee operating system binary compatibility, therefore, no reinstall or relink of the Oracle software is required when upgrading these operating systems unless specifically stated otherwise. “However Oracle recommends performing manual relinking of Oracle Home binaries after OS upgrade”. Hardware changes does not require relinking.
- After Operating system has been patched.( Recommended ).
- Relinking phase during installation of Oracle Home has errors/warnings.
- Application of a RDBMS patch failed in relinking phase.
- Applications gives error for missing lib files in RDBMS home.
- Troubleshooting RDBMS home binaries issue.
- After manually modifying RDBMS home binary permissions.
- Verifying Integrity of Oracle Home Binaries.
- Resetting Oracle Home binaries permission.
- To recreate binary executables.
Is relinking required after an OS upgrade, Downgrade, Patching or removal of the patch?
Yes, Oracle recommends to perform manual relinking of Oracle Home Binaries after OS Upgrade, Patching, Downgrade or removal of the Patch or any change which impact OS library behavior. Successful relinking shows Oracle Executable are properly linked with OS binaries.
How to relink Oracle Home?
Below are the steps to relink Oracle Home Binaries.
1. Set Environment variables. When linking the following environment variables need to be set:
ORACLE_HOME PATH to include $ORACLE_HOME/bin LD_LIBRARY_PATH $ORACLE_HOME/lib:/usr/lib SHLIB_PATH $ORACLE_HOME/lib:/usr/lib (for HP-UX only)
2. Verify umask value is set as 022, in case umask value is not correct, set umask to 022 (run command “umask 022”)
3. Stop all oracle instances accessing this ORACLE_HOME, listener and sqlplus in case if any. For AIX OS only as root user run slibclean, after 5 minutes run slibclean once again. It is safe to run slibclean even if other database are up and running.
4. As Oracle user perform following Command:
Accepted values for options parameter:
The manual relinking logs can be collected using unix redirection feature as mentioned below:
$ $ORACLE_HOME/bin/relink all
The Output will be written to $ORACLE_HOME/install/relink.log file.
For 12.1 and 12.2 “Client” option is removed but you can use below option:
$ relink as_installed
5. Additional option available for 11GR2
18.104.22.168 Database onwards there is an another option to use “Oracle Universal Installer” to perform relinking as mentioned below:
Below option can be used with runinstaller
-relink : For performing relink actions on the oracle home
Usage: -relink -maketargetsxml [location of maketargetsxml] [-makedepsxml [location of makedepsxml]] [name=value]
$ORACLE_HOME/oui/bin/runInstaller -relink -waitForCompletion -maketargetsxml $ORACLE_HOME/inventory/make/makeorder.xml -logLocation $ORACLE_HOME/install ORACLE_HOME=$ORACLE_HOME > $ORACLE_HOME/install/relink.log 2>&1
6. relinking individual components:
You can manually relink any one executable or all executables at any one time using the supplied ‘MAKE’ files and providing an appropriate link_option. Below describes the command used to perform a manual relink:
$ make -f [makefile] [link_option]
To relink an executable the above command is executed by the user who is logged on to the system as the software owner. The command is executed from the LIB directory where the [makefile] resides, i.e.
where [product_name] could be oracle, forms45 or reports30 etc.
7. debugging relinking logs:
relinking script is a shell script and can be debugged as like any normal script as below:
$ sh -x relink all >relink_all.out 2>&1
The output will be written to relink_all.out file.
Where to find relinking logs?
linking during Oracle Home Installation or Patchset installation
relinking logs during installation of Oracle Home binaries can be found in below file:
Also you can find relinking logs in OUI logs for the database installation.
linking during Oracle patching using opatch
relinking occurs during patch (PSU or One off patch) installation using opatch and logs can be found in opatch logs.
The manual relinking logs can also be collected using unix redirection feature:
$ $ORACLE_HOME/bin/relink all >> relink.out
The logs will be redirected to relink.out file
Additional feature for 11gR2
Option 1 – If relink is performed using OUI then “$ORACLE_HOME/install/relink.log” is not created by default. To send the relink output to $ORACLE_HOME/install/relink.log we need to redirect the output explicitly.
$ORACLE_HOME/oui/bin/runInstaller -relink -waitForCompletion -maketargetsxml $ORACLE_HOME/inventory/make/makeorder.xml -logDir $ORACLE_HOME/install ORACLE_HOME=$ORACLE_HOME > $ORACLE_HOME/install/relink.log 2>&1
Option 2 – In case of ” relink all ” command, it always creates a new log file with a name “relink.log” and it will not append log information to the existing relink log file . The previous log will be saved with a timestamp (Ex: relinkActions2009-09-14_09-01-10-PM.log)
What are the known issues with manual relinking?
1. Relink all is a generic script and it will try to relink all the components irrespective of the fact whether the components is installed or not and will give errors .You need to verify if the components in installed or not (use “opatch lsinventory –details” command to list installed components).
For Oracle Client where not all the components is installed , “relink all” is likely to give many errors. The better way to relink a client home is to issue the below command:
$ relink client
2. Executing “relink all” will reset the ownership and permission for root owned files. After “relink all”, it is recommended to change the ownership and permission back.
How to troubleshoot relinking issues?
Relinking errors during Oracle Home installation or Applying Patchset.
1. Please check whether the database version you are trying to install is certified on your OS version or not.
2. Verify if the downloaded software is not corrupt.
3. Confirm whether you have verified all the OS pre-requirements.
4. Verify if below command’s are included in OS PATH variable:
$ which ar $ which ld $ which cc $ which gcc $ which make
If any of the above commands does not return the PATH of command it means the command PATH is not set and you have to set it manually. Also, try running these commands manually and see these commands working fine at OS level.
5. Check if enough space is availble in /tmp directory and filesystem where ORACLE_HOME Resides.
6. The relinking error while installation is gathered in the below log file:
$ORACLE_HOME/install/make.log and OUI log file
7. Identify the first occurrence of “warning” , “fatal” , “error” , “stop” , “exception” , “severe “, “Exit Code 1” messages and these messages will help you out in identifying the root cause if relinking failure. To find known issues check for known issues section in this document or search in MOS portal if any known issue exist for these messages.
What are the utilities to troubleshoot relinking issues?
nm – Used to list all symbols in an .o, .a and binary file. It is useful in finding where a symbol is defined. A useful command to use would be:
$ nm [file] | grep [symbol]
Where [file] states the name of the library you want to examine and [symbol] names the symbol you are actually looking for.
ar – Builds and maintains libraries and archives of .o files. Using this command you can group .o files into a single archive (.a) for use in creating executables. It is used to insert, delete & replace objects files from an archive library.
Symfind – A script available at below location.
looks for a symbol in the shared objects of Oracle. This script basically performs the two above commands.