Installing Oracle Database on Debian: A Step-by-Step Guide
This guide outlines the key steps to install Oracle Database on Debian, covering both manual and automated (one-click script) methods. Follow these steps carefully to ensure a successful deployment.
1. Pre-Installation Preparation
Before starting, verify your Debian system meets Oracle’s minimum requirements (e.g., CPU, memory, disk space). Ensure the system is updated and has a stable internet connection for downloading packages. Upload the Oracle software package (e.g., p13390677_112040_linux-x86-64.zip) and one-click installation script (e.g., oracleshellinstall) to a directory like /soft.
2. Install Required Dependencies
Oracle relies on specific libraries for compilation and operation. Run the following command to install all necessary dependencies:
sudo apt-get update
sudo apt-get install -y gcc make binutils libmotif3 libaio1 libdb3 awk libc6-dev libc6
This ensures the system has tools for building Oracle binaries and libraries for asynchronous I/O (AIO) and other core functions.
3. Create Oracle User and Groups
Oracle requires dedicated user and group accounts for security and isolation. Execute these commands to create them:
sudo groupadd oinstall # Owner group for Oracle files
sudo groupadd dba # Group for database administrators
sudo useradd -g oinstall -G dba -m oracle # Create 'oracle' user with oinstall/dba membership
sudo passwd oracle # Set a strong password for the 'oracle' user
The oracle user will own all Oracle software and database files.
4. Configure Installation Directories and Permissions
Create a directory for Oracle software and data files, then set ownership and permissions to restrict access:
sudo mkdir -p /u01/app/oracle # Base directory for Oracle files
sudo chown -R oracle:oinstall /u01/app/oracle # Assign ownership to 'oracle' user and 'oinstall' group
sudo chmod -R 755 /u01/app/oracle # Grant read/execute permissions to all users (write only for owner)
This structure follows Oracle’s best practices for file organization.
5. Modify Kernel Parameters
Oracle requires specific kernel settings for memory management and process handling. Edit /etc/sysctl.conf and add/modify these lines:
kernel.shmall = 2097152 # Total shared memory in pages (adjust based on system RAM)
kernel.shmmax = 536870912 # Maximum shared memory segment size (512MB)
kernel.shmmni = 4096 # Maximum number of shared memory segments
kernel.sem = 250 32000 100 128 # Semaphore settings for inter-process communication
fs.file-max = 65536 # Maximum number of open files
net.ipv4.ip_local_port_range = 1024 65000 # Range for ephemeral ports
net.core.rmem_default = 262144 # Default receive buffer size
net.core.rmem_max = 4194304 # Maximum receive buffer size
net.core.wmem_default = 262144 # Default send buffer size
net.core.wmem_max = 1048576 # Maximum send buffer size
fs.aio-max-nr = 1048576 # Maximum number of asynchronous I/O requests
Apply the changes immediately with:
sudo sysctl -p
These settings prevent kernel-related errors during installation.
6. Adjust Resource Limits
Oracle needs higher limits for processes, open files, and memory usage. Edit /etc/security/limits.conf and append these lines:
oracle soft nproc 2047 # Soft limit for number of processes
oracle hard nproc 16384 # Hard limit for number of processes
oracle soft nofile 1024 # Soft limit for open files
oracle hard nofile 65536 # Hard limit for open files
oracle soft memlock 33554432 # Soft limit for locked memory (32GB)
oracle hard memlock 33554432 # Hard limit for locked memory (32GB)
These limits ensure Oracle can allocate sufficient resources for database operations.
7. Configure Security Settings
Ensure the PAM (Pluggable Authentication Modules) system applies resource limits. Edit /etc/pam.d/login and verify this line exists:
session required /lib64/security/pam_limits.so
This line enables PAM to enforce the limits set in /etc/security/limits.conf.
8. Set Environment Variables for Oracle User
Configure environment variables for the oracle user to simplify Oracle command execution. Edit /home/oracle/.bashrc and add:
export ORACLE_BASE=/u01/app/oracle # Base directory for Oracle software
export ORACLE_HOME=/u01/app/oracle/product/19.3.0.0/dbhome_1 # Path to Oracle home (adjust version)
export ORACLE_SID=orcl # Default database instance name
export PATH=$ORACLE_HOME/bin:$PATH # Add Oracle binaries to PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib # Add Oracle libraries to LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK # Character set (adjust as needed)
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS' # Default date format
Apply the changes by running:
source /home/oracle/.bashrc
These variables are essential for Oracle to function correctly.
9. Install Oracle Using One-Click Script
For simplified installation, use a one-click script like oracleshellinstall. Navigate to the script directory and execute:
cd /soft
./oracleshellinstall -lf ens33 \ # Local network interface (e.g., ens33)
-n debian12 \ # Hostname
-h oracle \ # Oracle database username
-p your_password \ # Oracle user password
-d /u01 \ # Software installation base directory
-s /u01/oradata \ # Database data file directory
-o luci # Optional: Database name
The script automates dependency checks, directory creation, and Oracle configuration. Follow on-screen prompts to complete the installation.
10. Post-Installation Verification
After installation, verify Oracle is running correctly. Switch to the oracle user and connect to SQL*Plus:
su - oracle
sqlplus / as sysdba
If prompted for a password, enter the one you set during installation. A successful login displays the SQL> prompt, indicating the database is accessible.
By following these steps, you can successfully install Oracle Database on Debian. Always refer to Oracle’s official documentation for version-specific requirements and troubleshooting tips.
以上就是关于“Debian Oracle安装步骤详解”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm