redhat7静默安装oracle11gR2
所谓的静默安装是指不用安装redhat7桌面系统,并进入桌面利用界面安装oracle,这里采用最小化安装redhat7,直接在命令行下通过命令执行安装。 环境配置和用户设置基本和界面安装一致。就是进入/opt/app/database/database目录之后,运行./runInstall时,需要指定参数,让系统实现无需界面操作的静默安装。准备虚拟机:2g内存,20g硬盘,3g交换分
所谓的静默安装是指不用安装redhat7桌面系统,并进入桌面利用界面安装oracle,这里采用最小化安装redhat7,直接在命令行下通过命令执行安装。
环境配置和用户设置基本和界面安装一致。就是进入/opt/app/database/database目录之后,运行./runInstall时,需要指定参数,让系统实现无需界面操作的静默安装。
准备虚拟机:2g内存,20g硬盘,3g交换分区,刚装上的系统很小,如下图所示。
一、获取oracle-rdbms-server-11gR2-preinstall的yum源,并配置一个CenOS7的基础源
[root@dbserver ~]# curl -o /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@dbserver ~]# curl -o /etc/yum.repos.d/public-yum-ol7.repo http://public-yum.oracle.com/public-yum-ol7.repo
[root@dbserver ~]# curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7
[root@dbserver ~]# sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@dbserver ~]# yum repolist
[root@dbserver ~]# yum install -y oracle-rdbms-server-11gR2-preinstall.x86_64
安装之前可以通过yum search查看oracle-rdbms-server-11gR2-preinstall
yum安装
安装完成之后可以检查用户和相关系统参数
系统参数截图,通过yum install oracle-rdbms-server-11gR2-preinstall自动添加了用户和用户组,而且修改了系统参数。
我们可以通过日志查看自动添加用户和用户组修改系统参数以及安装相关依赖。日志路径:/var/log/oracle-rdbms-server-11gR2-preinstall/results/orakernel.log
Adding group oinstall with gid 54321
Adding group dba
Adding user oracle with user id 54321, initial login group oinstall, supplementary group dba and home directory /home/oracle
Changing ownership of /home/oracle to oracle:oinstall
Please set password for oracle user
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
Creating oracle user passed
Saving a copy of the initial sysctl.conf
Verifying kernel parameters as per Oracle recommendations...
Adding fs.file-max = 6815744
Adding kernel.sem = 250 32000 100 128
Adding kernel.shmmni = 4096
Adding kernel.shmall = 1073741824
Adding kernel.shmmax = 4398046511104
Adding kernel.panic_on_oops = 1
Adding net.core.rmem_default = 262144
Adding net.core.rmem_max = 4194304
Adding net.core.wmem_default = 262144
Adding net.core.wmem_max = 1048576
Adding net.ipv4.conf.all.rp_filter = 2
Adding net.ipv4.conf.default.rp_filter = 2
Adding fs.aio-max-nr = 1048576
Adding net.ipv4.ip_local_port_range = 9000 65500
Setting kernel parameters as per oracle recommendations...
Altered file /etc/sysctl.conf
Saved a copy of the current file in /etc/sysctl.d/99-oracle-rdbms-server-11gR2-preinstall-sysctl.conf
Check /etc/sysctl.d for backups
Verifying & setting of kernel parameters passed
Setting user limits using /etc/security/limits.conf
Verifying oracle user OS limits as per Oracle recommendations...
Adding oracle soft nofile 1024
Adding oracle hard nofile 65536
Adding oracle soft nproc 16384
Adding oracle hard nproc 16384
Adding oracle soft stack 10240
Adding oracle hard stack 32768
Adding oracle hard memlock 134217728
Adding oracle soft memlock 134217728
Setting oracle user OS limits as per Oracle recommendations...
Altered file /etc/security/limits.conf
Original file backed up at /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Nov-02-2017-20-58-02
Verifying & setting of user limits passed
Saving a copy of /etc/default/grub file in /etc/default/grub-initial.orabackup
Saving a copy of /etc/default/grub in /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Nov-02-2017-20-58-02...
Verifying kernel boot parameters as per Oracle recommendations...
old boot params: "rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet"
new boot params: "rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet numa=off"
old boot params: "rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet numa=off"
new boot params: "rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet numa=off transparent_hugepage=never"
Setting kernel boot parameters as per Oracle recommendations...
G_DIR=/boot/grub2
Getting the first entry available in /boot/grub2/grub.cfg for 3.10.0-123.el7.x86_64
Default kernel is -> 3.10.0-123.el7.x86_64
Default saved_entry is -> Red Hat Enterprise Linux Linux, with Linux 3.10.0-123.el7.x86_64
Default saved_entry_line is -> linux16 /vmlinuz-3.10.0-123.el7.x86_64
Saving a copy of grubenv... in /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Nov-02-2017-20-58-02
Generating grub configuration file ...
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 28519: /usr/sbin/grub2-probe
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 28519: /usr/sbin/grub2-probe
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7d075af17a9c4ec58e37c4be14f9f1d2
Found initrd image: /boot/initramfs-0-rescue-7d075af17a9c4ec58e37c4be14f9f1d2.img
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 28717: /usr/sbin/grub2-probe
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 28717: /usr/sbin/grub2-probe
done
The saved kernel 3.10.0-123.el7.x86_64 is now at position - 0
Boot parameters will be effected on next reboot
Altered file /etc/default/grub
Copy of the changed file is in - /etc/default/grub-oracle-rdbms-server-11gR2-preinstall.orabackup
Copy of the original file is in - /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Nov-02-2017-20-58-02
Verifying & setting of boot parameters passed
Trying to add NOZEROCONF parameter...
Taking a backup of existing file to /etc/sysconfig/network.orabackup
Successfully added parameter NOZEROCONF to /etc/sysconfig/network
Setting /etc/sysconfig/network parameters passed
Disabling Transparent Hugepages.
Refer Oracle Note:1557478.1
Disabling defrag.
Refer Oracle Note:1557478.1
Taking a backup of old config files under /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Nov-02-2017-20-58-02
安装两个小工具,用来上传数据库安装文件和解压安装文件
yum install -y lrzsz unzip//
二、设置oracle安装目录
[root@dbserver ~]# mkdir -p /opt/app/oracle
[root@dbserver ~]# mkdir -p /opt/app/database
[root@dbserver ~]# mkdir -p /opt/app/oraInventory
[root@dbserver ~]# chown -R oracle:oinstall /opt/app
[root@dbserver ~]# chmod 755 /opt/app
为oracle用户设置密码,后面需要切换到oracle用户下来安装
[root@dbserver ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@dbserver ~]# su - oracle
三、设置环境变量,注意,这里一定不要设置DISPLAY这个环境变量,否则运行安装runInstall的时候会报错。后面会贴出错误。
export PATH
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LANG=""
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
生效环境变量并配置oracle静默安装的配置文件,指定相关配置。这些配置很重要,如果不配置好,后面安装会出现很多问题。
[oracle@dbserver ~]$ source .bash_profile
[oracle@dbserver ~]$ ls
linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
[root@dbserver oracle]# unzip linux.x64_11gR2_database_1of2.zip -d /opt/app/database/
[root@dbserver oracle]# unzip linux.x64_11gR2_database_2of2.zip -d /opt/app/database/
[root@dbserver app]# vi database/database/response/db_install.rsp
四、修改静默安装数据库配置文件主要的配置项
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/opt/app/oraInventory
ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/opt/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.DBA_GROUP=oinstall
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.asm.ASMSNMPPassword=123456
DECLINE_SECURITY_UPDATES=true
以上这些参数基本都是必须的,缺少参数则会出现后面贴出的一些问题。
五、开始安装 -ignorePrereq选项可以忽略系统检查时的一些问题。后面会贴出这个错误。
[oracle@dbserver app]$ database/database/runInstaller -silent -force -ignorePrereq -responseFile /opt/app/database/database/response/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 13085 MB Passed
Checking swap space: must be greater than 150 MB. Actual 2999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-11-02_11-12-25PM. Please wait ...[oracle@dbserver app]$ You can find the log of this install session at:
/opt/app/oraInventory/logs/installActions2017-11-02_11-12-25PM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/opt/app/oraInventory/orainstRoot.sh
/opt/app/oracle/product/11.2.0/db_1/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.
切换到root用户,执行这两个脚本。
[oracle@dbserver app]$ su
Password:
[root@dbserver app]# /opt/app/oraInventory/orainstRoot.sh
Changing permissions of /opt/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /opt/app/oraInventory to oinstall.
The execution of the script is complete.
[root@dbserver app]# /opt/app/oracle/product/11.2.0/db_1/root.sh
Check /opt/app/oracle/product/11.2.0/db_1/install/root_dbserver_2017-11-02_23-20-43.log for the output of root script
根据运行提示,我们可以看看相关日志
[root@dbserver app]# more /opt/app/oracle/product/11.2.0/db_1/install/root_dbserver_2017-11-02_23-20-43.log
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/app/oracle/product/11.2.0/db_1
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
六、netca配置监听器(这里的命令很特别,指定参数就是斜线来指定,你没有看错)
[oracle@dbserver app]$ netca /silent /responseFile /opt/app/database/database/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /opt/app/database/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/opt/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
七、dbca创建数据库(Database Configuration Assistent)
[oracle@dbserver app]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName orcl
-sid orcl -sysPassword oracle -systemPassword oracle -storageType FS -datafileJarLocation $ORACLE_HOME/assistants/dbca/templates
-characterset AL32UTF8 -obfuscatedPasswords false -sampleSchema false
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 "/opt/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
[oracle@dbserver app]$
八、测试数据库连接
[oracle@dbserver app]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Nov 2 23:39:00 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn sys/oracle as sysdba;
Connected.
SQL>
九、Q&A:错误以及解决办法
更多推荐
所有评论(0)