linux命令行oracle安装
linux命令行oracle安装详细介绍
在 Linux 命令行安装 Oracle 数据库,一般可以按以下步骤操作:
1. 环境准备
- 创建用户和组:需要创建一个
oinstall组和dba组,并且创建一个oracle用户并将其添加到这两个组中。
bash
oinstalldba
oinstall dba oracle
oracle
- 设置系统参数:编辑
/etc/sysctl.conf文件,添加以下内容:
plaintext
fs.file-max = 6815744kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
执行以下命令使配置生效:
bash
- 设置用户限制:编辑
/etc/security/limits.conf文件,添加以下内容:
plaintext
oracle soft nproc 2047oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
- 创建安装目录:
bash
/u01/app/oracleoracle:oinstall /u01/app/oracle
/u01/app/oracle
2. 上传并解压安装文件
将下载好的 Oracle 安装文件上传到服务器,一般是两个zip文件,然后使用unzip命令解压:
bash
- oraclelinuxx64_19c_database.zip /u01/app/oracle
3. 配置环境变量
编辑~/.bashrc文件,添加以下内容:
plaintext
export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORACLE_SID=ORCL
export PATH=$PATH:$ORACLE_HOME/bin
执行以下命令使配置生效:
bash
~/.bashrc
4. 运行安装程序
bash
/u01/app/oracle/database./runInstaller
之后会弹出图形化安装界面,按照提示完成安装。如果服务器没有图形化界面,可以使用X11转发功能。
5. 执行脚本
安装完成后,根据提示以root用户身份执行两个脚本:
bash
/u01/app/oracle/oraInventory/orainstRoot.sh/u01/app/oracle/product/19.3.0/dbhome_1/root.sh
6. 检查安装
可以使用以下命令检查数据库是否正常启动:
bash
ora_
912 | ora_
以上步骤适用于 Oracle 19c 数据库,不同版本的安装步骤可能会有细微差别。