静默安装oracle soft & instance

本文涉及的产品
运维安全中心(堡垒机),免费版 6个月
运维安全中心(堡垒机),企业双擎版|50资产|一周时长
简介: 有的时候,我们无法启动Oracle的图形界面,那么一定要保持淡定、从容,显示身为一个DBA的专业性的时刻到了 打开黑底的terminal(crt、ssh都可以哈)开始进行静默安装oracle soft & instance。

有的时候,我们无法启动Oracle的图形界面,那么一定要保持淡定、从容,显示身为一个DBA的专业性的时刻到了

打开黑底的terminal(crt、ssh都可以哈)开始进行静默安装oracle soft & instance。

下面是在Linux平台上静默安装的栗子:

检查内存、磁盘空间、系统版本

[root@localhost ~]# grep MemTotal /proc/meminfo
MemTotal:       515308 kB

[root@localhost ~]# grep SwapTotal /proc/meminfo
SwapTotal:     1044216 kB

[root@localhost ~]# cat /proc/version
Linux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010

检查软件包

[root@localhost Server]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \binutils elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libgcc libstdc++ make sysstat
binutils-2.17.50.0.6-14.el5 (i386)
elfutils-libelf-0.137-3.el5 (i386)
elfutils-libelf-devel-0.137-3.el5 (i386)
gcc-4.1.2-48.el5 (i386)
gcc-c++-4.1.2-48.el5 (i386)
glibc-2.5-49 (i686)
glibc-common-2.5-49 (i386)
glibc-devel-2.5-49 (i386)
glibc-headers-2.5-49 (i386)
libaio-0.3.106-5 (i386)
libgcc-4.1.2-48.el5 (i386)
libstdc++-4.1.2-48.el5 (i386)
make-3.81-3.el5 (i386)
sysstat-7.0.2-3.el5 (i386)

创建用户及用户组

[root@localhost Server]# groupadd oinstall
[root@localhost Server]# groupadd dba
[root@localhost Server]# useradd -g oinstall -g dba -m oracle
[root@localhost Server]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

内核修改

修改配置文件: /etc/sysctl.conf ,, /etc/security/limits.conf,,/etc/pam.d/login

  • 修改 /etc/sysctl.conf 文件
[root@localhost Server]# vi /etc/sysctl.conf
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65535
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

"/etc/sysctl.conf" 44L, 1227C written

使刚刚的修改生效

[root@localhost Server]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65535
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
  • 修改/etc/security/limits.conf 文件
[root@localhost ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# End of file

"/etc/security/limits.conf" 53L, 1897C written
  • 修改 /etc/pam.d/login 文件
[root@localhost ~]# vi /etc/pam.d/login
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth       include      system-auth
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    include      system-auth
session    required     pam_loginuid.so
session    optional     pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open
session    optional     pam_keyinit.so force revoke
session required pam_limits.so

"/etc/pam.d/login" 15L, 674C written

创建Oracle所需目录

[root@localhost ~]# cd /opt
[root@localhost opt]# mkdir oracle
[root@localhost opt]# mkdir software
[root@localhost opt]# chown -R oracle:oinstall /opt/oracle/
[root@localhost opt]# chown -R oracle:oinstall software/
[root@localhost opt]# ls -l
total 16
drwxr-xr-x 2 oracle oinstall 4096 Sep  5 01:03 oracle
drwxr-xr-x 2 oracle oinstall 4096 Sep  5 01:12 software

开始安装oracle软件

[oracle@localhost database]$./runInstaller -silent -debug -force \
>FROM_LOCATION=/opt/software/database/stage/products.xml \
>oracle.install.option=INSTALL_DB_SWONLY \
>UNIX_GROUP_NAME=dba \
>INVENTORY_LOCATION=/opt/oracle/oraInventory \
>ORACLE_HOME=/opt/oracle/product/11.2.0/db \
>ORACLE_HOME_NAME="Oracle111" \
>ORACLE_BASE=/opt/oracle \
>oracle.install.db.InstallEdition=EE \
>oracle.install.db.isCustomInstall=false \
>oracle.install.db.DBA_GROUP=dba \
>oracle.install.db.OPER_GROUP=dba \
>DECLINE_SECURITY_UPDATES=true
......
<u>As a root user, execute the following script(s):
        1. /opt/oracle/oraInventory/orainstRoot.sh
        2. /opt/oracle/product/11.2.0/db/root.sh</u>
Successfully Setup Software.
copying /opt/oracle/oraInventory/logs/oraInstall2012-09-05_01-32-48AM.out to /opt/oracle/product/11.2.0/db/cfgtoollogs/oui/oraInstall2012-09-05_01-32-48AM.out
copying /opt/oracle/oraInventory/logs/oraInstall2012-09-05_01-32-48AM.err to /opt/oracle/product/11.2.0/db/cfgtoollogs/oui/oraInstall2012-09-05_01-32-48AM.err
copying /opt/oracle/oraInventory/logs/installActions2012-09-05_01-32-48AM.log to /opt/oracle/product/11.2.0/db/cfgtoollogs/oui/installActions2012-09-05_01-32-48AM.log
copying /opt/oracle/oraInventory/logs/silentInstall2012-09-05_01-32-48AM.log to /opt/oracle/product/11.2.0/db/cfgtoollogs/oui/silentInstall2012-09-05_01-32-48AM.log
  • 在以上的输出中提到了,需要使用root用户的运行脚本:
[root@localhost logs]# /opt/oracle/oraInventory/orainstRoot.sh
Changing permissions of /opt/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /opt/oracle/oraInventory to dba.
The execution of the script is complete.
[root@localhost logs]# /opt/oracle/product/11.2.0/db/root.sh
Check /opt/oracle/product/11.2.0/db/install/root_localhost.localdomain_2012-09-05_02-01-01.log for the output of root script
  • 登录数据库检查版本:
[oracle@localhost database]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 星期三 9月 5 02:02:09 2012
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.
SQL>

可以正常登录数据库即可,由于目前还没有创建数据库实例,所以会显示为“an idle instance”。

开始静默建库

  • 由于我们采用的是静默安装(不启动图形),那么在安装过程中那些需要交互的值,需要我们提前编辑到配置文件中去。如:数据库名称,字符集设置 等。。
[oracle@localhost response]$ cat /opt/software/database/response/mydb.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "ora11g"
SID = "ora11g"
TEMPLATENAME = "New_Database.dbt"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION ="/opt/oracle/oradata"
STORAGETYPE=FS
CHARACTERSET = "ZHS16GBK"
DATABASETYPE = "MULTIPURPOSE"
AUTOMATICMEMORYMANAGEMENT = "FALSE"
  • 一切准备就绪之后,可以开始静默安装数据库实例了。

进入到漫长的等待时间中。。由于没有了进度条,还好oracle会有进度 xx%的提示。

[oracle@localhost response]$ dbca -silent -responseFile /opt/software/database/response/mydb.rsp
Creating and starting Oracle instance
1% complete
3% complete
Creating database files
4% complete
7% complete
Creating data dictionary views
8% complete
9% complete
10% complete
11% complete
12% complete
13% complete
14% complete
16% complete
17% complete
18% complete
19% complete
Adding Oracle JVM
25% complete
30% complete
36% complete
38% complete
Adding Oracle Text
39% complete
40% complete
41% complete
Adding Oracle XML DB
43% complete
44% complete
45% complete
49% complete
Adding Oracle Multimedia
50% complete
60% complete
Adding Oracle OLAP
61% complete
62% complete
64% complete
Adding Oracle Spatial
65% complete
66% complete
67% complete
71% complete
Adding Enterprise Manager Repository
73% complete
75% complete
Adding Oracle Application Express
78% complete
82% complete
Adding Oracle Warehouse Builder
86% complete
90% complete
Completing Database Creation
91% complete
92% complete
93% complete
96% complete
100% complete
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ora11g/ora11g.log" for further details.
  • 此时我们也可以通过日志文件,知晓数据库安装过程中的详细信息。

检查建库是否成功

[oracle@localhost response]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on 星期三 9月 5 17:57:40 2012
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> select instance_name,version from v$instance;
INSTANCE_NAME    VERSION
-------------------------- -----------------
ora11g                  11.2.0.3.0

SQL> select name,open_mode from v$database;
NAME             OPEN_MODE
---------        --------------------
ORA11G           READ WRITE
目录
相关文章
|
Oracle 关系型数据库 Linux
Oracle 19c Centos7 静默安装记录整理 2
Oracle 19c Centos7 静默安装记录整理
|
Oracle 关系型数据库 大数据
Oracle 19c Centos7 静默安装记录整理 1
Oracle 19c Centos7 静默安装记录整理
|
7月前
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
288 0
|
Oracle 关系型数据库 MySQL
Oracle 19C 静默安装 GoldenGate
十年以上 MySQL Oracle DBA从业者,MySQL 5.7 OCP, 个人公众号:jinjusk
190 0
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2(下)
服务器Centos7 静默安装Oracle Database 12.2(下)
334 0
|
Oracle 安全 关系型数据库
服务器Centos7 静默安装Oracle Database 12.2(上)
服务器Centos7 静默安装Oracle Database 12.2(上)
133 0
|
Oracle 网络协议 关系型数据库
静默安装Oracle11g(无图形化界面)
准备工作 已经通过安装oracle-rdbms-server-11gR2-preinstall包把环境准备好。
196 0
|
Oracle 关系型数据库 数据库
在RHEL 6.5上静默安装Oracle 18c
在RHEL 6.5上静默安装Oracle 18c
97 0
|
Oracle 关系型数据库
静默安装Oracle 11g单机环境软件
静默安装Oracle 11g单机环境软件
181 0
|
Oracle 关系型数据库
静默安装Oracle 12c单机环境软件
静默安装Oracle 12c单机环境软件
188 0