To run the root.sh script, you must log in as the root user, navigate to your Oracle Home directory, and execute the script from the command line. The script performs critical post-installation and patching tasks that require superuser privileges, such as configuring permissions and system resources.
***Disclaimer:*The root.sh script is an essential part of an Oracle installation, but it should only be executed as instructed during the installation or patching process. Never run this script without a clear understanding of its purpose, as it makes system-level changes.
Part 1: How to run root.sh
Prerequisites
Before running the root.sh script, ensure you have:
- Root access: You must be logged in as the
rootuser or havesudoprivileges to execute the script. - Active Oracle installation: The Oracle database or client software should already be installed, typically by the
oracleuser, with the installation process prompting you to runroot.sh.
Step-by-step procedure
-
Log in as
root: Open a terminal and log in with therootaccount.sh$ su - rootUse code with caution.
Alternatively, you can use
sudofor a single command if your user has the necessary permissions. -
Navigate to the Oracle Home: Change to the Oracle Home directory (
$ORACLE_HOME), which contains theroot.shscript. The path will vary depending on your Oracle version and installation choices.sh# cd /opt/oracle/product/18.0.0/Use code with caution.
You can also use the
$ORACLE_HOMEenvironment variable if it is set. -
Execute the script: Run the script using the
./notation.sh# ./root.shUse code with caution.
For SAP-specific installations, you may need to provide the SAP system ID (SID) as an argument.sh
# ./oraroot.sh <SID>Use code with caution.
-
Monitor the output: The script will print its progress to the screen and also write a detailed log file in the
$ORACLE_HOME/installdirectory.``` Performing root user operation... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /opt/oracle/product/18.0.0 Copying dbhome to /usr/local/bin ... ... Finished running generic part of root script. -
Review the log file: After the script finishes, examine the log file for any errors or warnings. The log file is typically named
root_<server_hostname>_<timestamp>.log.
Part 2: What root.sh does and why it's necessary
The root.sh script is a crucial part of the Oracle installation, ensuring that Oracle has the proper permissions and access to necessary system resources.
Key actions performed
- Creates standard environment scripts: It copies standard scripts, such as
oraenv,coraenv, anddbhome, to a common system directory like/usr/local/bin. These scripts help users and applications correctly set up the Oracle environment variables. - Updates the
/etc/oratabfile: It creates or updates the/etc/oratabfile, which is a list of Oracle databases on the system. This is used for database startup/shutdown and by the environment scripts. - Sets permissions: The script sets the correct ownership and permissions for the Oracle executables and directories. This ensures the Oracle software can be run with the necessary privileges while maintaining system security.
- Configures Clusterware (for RAC installations): In a Real Application Clusters (RAC) environment,
root.shperforms more advanced tasks, including:- Configuring and formatting the Oracle Cluster Registry (OCR) and voting disks.
- Creating OCR backups and network socket directories.
- Starting Clusterware daemons and adding them to the system's
inittab.
- Updates central inventory: It registers the Oracle Home with the Oracle Central Inventory (
oraInventory). - Handles post-patching tasks: For Oracle patches and Release Updates (RUs), running
root.shagain ensures that any new or updated binaries have the correct permissions set by the root user.
Part 3: When to run root.sh
Initial software installation
You run root.sh for the first time immediately after completing the initial installation of Oracle software (e.g., database or grid infrastructure). The installer typically prompts you to run it in a separate terminal. For silent installations, you must execute the script manually after the installer finishes.
Post-patching and upgrades
After applying a patch or release update, it is a recommended practice to run root.sh again. This ensures that any changes to binaries or permissions introduced by the patch are correctly applied. The instructions for this are typically found in the patch's README file.
Oracle Restart and Clusterware configurations
In single-instance environments using Oracle Restart or RAC environments using Clusterware, root.sh may be run to configure and start the high-availability services and manage resources.
Part 4: Troubleshooting and best practices
If you forget to run root.sh
If the Oracle installation was performed by the oracle user and you forget to run root.sh, you will encounter permission errors or other configuration issues when trying to start or manage Oracle services. You must log in as root and run the script to correct the permissions and complete the setup.
Review before and after
- Before: You can open
root.shwith a text editor to see what actions it will perform, though for standard Oracle installations this is not usually necessary. - After: Always review the log file generated by the script to confirm that all operations completed successfully.
Script idempotency
The root.sh script is designed to be run multiple times. If you run it again, it will detect existing configurations and make the necessary changes without causing issues, such as overwriting existing environment scripts if you choose not to.
Silent installations
For automated silent installations, it is a standard practice to include the root.sh execution as a separate step in the installation script, running it with root or sudo privileges after the main Oracle installation completes.