一、安装依赖包
yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
二、创建用户名
groupadd oinstall groupadd dba useradd -m -d /home/oracle -g oinstall -G dba oracle passwd oracle
三、安装jdk
yum install java-1.8.0-openjdk* -y
四、#设置swap 服务器有忽略
dd if=/dev/zero of=/home/swap bs=1024 count=5120000 mkswap /home/swap swapon /home/swap
五、修改内核
# vim /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 1200000000 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576
六、修改用户的限制文件
# vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 修改/etc/pam.d/login文件,添加: session required /lib64/security/pam_limits.so session required pam_limits.so 创建安装目录、修改文件权限 mkdir -p /data/app/oracle/product/11.2.0 mkdir /data/app/oracle/oradata mkdir /data/app/oracle/inventory mkdir /data/app/oracle/fast_recovery_area chown -R oracle:oinstall /data/app/oracle chmod -R 775 /data/app/oracle
七、设置环境oracle变量
vim /home/oracle/.bashrc ORACLE_BASE=/data/app/oracle ORACLE_HOME=$ORACLE_BASE/product/11.2.0 ORACLE_SID=orcl PATH=$PATH:$ORACLE_HOME/bin export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH # source /home/oracle/.bashrc
八、root下编辑静默安装响应文件
cp /data/database/response/db_install.rsp /data/database/response/db_install.rsp.bak #ORACLE_HOSTNAME = 主机名(hostname) vim /data/database/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=VM_0_5_centos UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/data/app/oracle/inventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/data/app/oracle/product/11.2.0 ORACLE_BASE=/data/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba DECLINE_SECURITY_UPDATES=true
九、启动
su - oracle ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /data/database/response/db_install.rsp 出现如下则安装正常: /data/app/oracle/inventory/orainstRoot.sh /data/app/oracle/product/11.2.0/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts 4. Return to this window and hit "Enter" key to continue Successfully Setup Software. 查看安装情况日志 tailf /data/app/oracle/inventory/logs/installActions2018-11-29_10-45-46PM.log
十、执行sh文件
#在root下执行L sh /data/app/oracle/inventory/orainstRoot.sh sh /data/app/oracle/product/11.2.0/root.sh
十一、用oracle用户登录配置监听
su - oracle #设置DISPLAY变量 export DISPLAY=localhost:0.0 netca -silent -responseFile /data/database/response/netca.rsp Oracle Net Listener Startup: Running Listener Control: /data/app/oracle/product/11.2.0/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0 查看监听状态:stop start lsnrctl status netstat -lntup|grep 1521 tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 28351/tnslsnr
十二、建立新库,同时建立对应的实例
切换到root用户,编辑 /data/database/response/dbca.rsp 修改以下参数: TOTALMEMORY 设置oracl管理内存 GDBNAME = "orcl" SID = "orcl" SYSPASSWORD = "oracle" SYSTEMPASSWORD = "oracle" SYSMANPASSWORD = "oracle" DBSNMPPASSWORD = "oracle" DATAFILEDESTINATION =/u01/app/oracle/oradata RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area CHARACTERSET = "ZHS16GBK" TOTALMEMORY = "1638" su - oracle dbca -silent -responseFile /data/database/response/dbca.rsp 看到如下安装完成: Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/data/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
十三、测试 sqlplus / as sysdba
sqlplus / as sysdba SQL> shutdown; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 413372416 bytes Fixed Size 2213896 bytes Variable Size 268437496 bytes Database Buffers 138412032 bytes Redo Buffers 4308992 bytes Database mounted. Database opened. SQL> oracle静默安装完成
原文地址:https://www.cnblogs.com/zhaojingyu/p/10041728.html
时间: 2024-10-05 19:38:55