SUSE-Linux安装oracle#
20150401
参考
《Database Quick Installation Guide for Linux x86-64》
https://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCBCFDI
《Oracle Database Administrator's Guide》
https://docs.oracle.com/cd/E11882_01/server.112/e25494/create.htm#ADMIN11073
目录##
......ORACLE软件下载
......根据oracle版本,检查硬件要求和os版本
......解决软件安装包依赖
......创建所需的操作系统用户和用户组
......linux中与Oracle有关的内核用户资源参数配置
......创建oracle目录、设置环境变量
......静默安装oracle软件
......安装完成后配置环境变量
......配置监听程序
......用DBCA创建数据库实例
0. ORACLE软件下载##
chrome可以获取下载地址。
nohup commond& 可以在关闭远程终端后让命令继续执行。
wget是一个从网络上获取文件的程序。
wget -c --http-user=username --http-password=userpassword --output-document=linux.x64_11gR2_database_1of2.zip "http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip?AuthParam=1417279234_e1fdefa21aa5ab8dd4672e695a53e1d4"
1. 根据oracle版本,检查硬件要求和os版本##
1.1 最低配置
oracle:Database 11g Release 2 (11.2)
Minimum Memory: 1 GB of RAM (swap space:1.5 times the size of the RAM)
Minimum Disk:At least 1 GB of disk space in the /tmp directory,Requirement for Software Files (Enterprise Edition 4.7GB),Requirement for Data Files (Enterprise Edition 1.7GB).
The following or later versions of the operating system are required for Oracle Database 11g Release 2 (11.2):SUSE Linux Enterprise Server 10 SP2 or SUSE Linux Enterprise Server 11
The following are the kernel requirements for Oracle Database 11g Release 2 (11.2): 2.6.16.21 or later(On SUSE Linux Enterprise Server 10)or 2.6.27.19 or later (On SUSE Linux Enterprise Server 11)
1.2 My Server config###
architecture:x86_64
cup:1
memory:1GB
disk:20+60G (其中swap=1.5G)
OS:OpenSUSE 13.1 64位
注意:阿里云服务器不建议设置swap(如出现问题,参考论坛解决)
2. 解决软件安装包依赖##
The following or later version of packages for SUSE Linux Enterprise Server 10 must be installed:
binutils-2.16.91.0.5
compat-libstdc++-5.0.7
gcc-4.1.0
gcc-c++-4.1.2
glibc-2.4-31.63
glibc-devel-2.4-31.63
glibc-devel-32bit-2.4-31.63
ksh-93r-12.9
libaio-0.3.104
libaio-32bit-0.3.104
libaio-devel-0.3.104
libaio-devel-32bit-0.3.104
libelf-0.8.5
libgcc-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.80
numactl-0.9.6.x86_64
sysstat-8.0.4
unixODBC-32 bit-2.2.11 (32-bit) or later
unixODBC-2.2.11 (64-bit) or later
unixODBC-devel-2.2.11 (64-bit) or later
The following or later version of packages for SUSE Linux Enterprise Server 11 must be installed:
rpm -qa|grep binutils-2.19
rpm -qa|grep gcc-4.3
rpm -qa|grep gcc-32bit-4.3
rpm -qa|grep gcc-c++-4.3
rpm -qa|grep glibc-2.9
rpm -qa|grep glibc-32bit-2.9
rpm -qa|grep glibc-devel-2.9
rpm -qa|grep glibc-devel-32bit-2.9
rpm -qa|grep ksh-93t
rpm -qa|grep libaio-0.3.104
rpm -qa|grep libaio-32bit-0.3.104
rpm -qa|grep libaio-devel-0.3.104
rpm -qa|grep libaio-devel-32bit-0.3.104
rpm -qa|grep libstdc++33-3.3.3
rpm -qa|grep libstdc++33-32bit-3.3.3
rpm -qa|grep libstdc++43-4.3.3_20081022
rpm -qa|grep libstdc++43-32bit-4.3.3_20081022
rpm -qa|grep libstdc++43-devel-4.3.3_20081022
rpm -qa|grep libstdc++43-devel-32bit-4.3.3_20081022
rpm -qa|grep libgcc43-4.3.3_20081022
rpm -qa|grep libstdc++-devel-4.3
rpm -qa|grep make-3.81
rpm -qa|grep sysstat-8.1.5
rpm -qa|grep unixODBC-2.2.12 or later
rpm -qa|grep unixODBC-devel-2.2.12 or later
rpm -qa|grep unixODBC-32bit-2.2.12 (32-bit) or later
如果存在软件包依赖,请下载依赖软件包并安装:
rpm -ivh *.rpm
3. 创建所需的操作系统用户和用户组##
The following local operating system groups and users are required if you are installing Oracle Database:
The Oracle Inventory group (typically, oinstall)
The OSDBA group (typically, dba)
The Oracle software owner (typically, oracle)
The OSOPER group (optional. Typically, oper)
groupadd orainstall
groupadd oradba
groupadd oraoper
useradd -d /home/oracle -g orainstall -G oradba,oraoper ora
passwd ora
4. linux中与Oracle有关的内核用户资源参数配置##
4.1 Kernel Parameters###
Kernel Parameters:Verify that the kernel parameters shown in the following table are set to values greater than or equal to the minimum value shown.
Parameter | Minimum Value | File
semmsl 250 /proc/sys/kernel/sem
semmns 32000 /proc/sys/kernel/sem
semopm 100 /proc/sys/kernel/sem
semmni 128 /proc/sys/kernel/sem
shmall 2097152 /proc/sys/kernel/shmall
shmmax 536870912 /proc/sys/kernel/shmmax
shmmni 4096 /proc/sys/kernel/shmmni
file-max 6815744 /proc/sys/fs/file-max (A value that is 1 byte less than the physical memory)
ip_local_port_range 9000(MAX65500) /proc/sys/net/ipv4/ip_local_port_range
rmem_default 262144 /proc/sys/net/core/rmem_default
rmem_max 4194304 /proc/sys/net/core/rmem_
wmem_default 262144 /proc/sys/net/core/wmem_default
wmem_max 1048576 /proc/sys/net/core/wmem_max
aio-max-nr 1048576 /proc/sys/fs/aio-max-nr
*SUSE LINUX:On SUSE systems only, you must enter the GID of the oinstall group as the value for the parameter /proc/sys/vm/hugetlb_shm_group. Doing this grants members of oinstall a group permission to create shared memory segments.(NOTE:Only one group can be defined as the vm.hugetlb_shm_group.)
hugetlb_shm_group GID of the oinstall group /proc/sys/vm/hugetlb_shm_group
4.2 /proc虚拟文件系统###
通过/proc虚拟文件系统,Linux系统在运行时修改内核参数(/proc/sys或/etc/sysctl.conf)并不需要重新引导系统。在/proc/sys目录下存放着大多数的内核参数文件,这些文件被设计成可以在系统运行的同时进行更改,修改过后,保存配置文件就马上自动生效,但是重新启动机器后修改的参数值会失效。/etc/sysctl.conf这个文档主要是配置一些系统信息,它的内容对应于/proc/sys/这个目录的子目录及文件。通过修改/etc/sysctl.conf内的内核参数则可以永久保存配置变更。修改sysctl文件内的参数值后,设定的参数值会在操作系统重启后生效(注意,对于suse linux,需要执行/sbin/chkconfig boot.sysctl on,使OS重启时读取/etc/sysctl.conf文件),如果想使参数值修改马上生效,可以执行命令sysctl –p 。
4.3 Resource Limits###
Resource Limits:For each installation software owner, check the resource limits for installation.
Installation Owner Resource Limit Recommended Ranges.
Resource Shell Limit Resource Soft Limit Hard Limit
Open file descriptors | nofile | at least 1024 | at least 65536
Number of processes available to a single user | nproc | at least 2047 | at least 16384
Size of the stack segment of the process | stack | at least 10240 KB | at least 10240 KB, and at most 32768 KB
update the resource limits in the /etc/security/limits.conf.
5. 创建oracle目录、设置环境变量##
#The Oracle base directory
mkdir -p /app/oracle/app
chown -R ora:orainstall /app/oracle/app
chmod -R 775 /app/oracle/app
#创建/etc/oraInst.loc文件,内容如下
inventory_loc=/app/oracle/app/oraInventory
inst_group=orainstall
chown ora:orainstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
#创建/home/oracle/.bashrc,内容如下
umask 022
ORACLE_BASE=/app/oracle/app
ORACLE_SID=helowrd
export ORACLE_BASE ORACLE_SID
6. 静默安装oracle软件##
su - ora
#复制响应文件模板
cd /home/ora
mkdir response
cp /home/oracle/install/database/response/* /home/oracle/response/
chown -R ora:orainstall /home/oracle/response/*.rsp
#修改安装Oracle软件的响应文件/home/oracle/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY //29 行 安装类型
ORACLE_HOSTNAME=helowrd //37 行 主机名称
UNIX_GROUP_NAME=orainstall //42 行 安装组
INVENTORY_LOCATION=/app/oracle/app/oracle/oraInventory //47 行 INVENTORY目录
SELECTED_LANGUAGES=en,zh_CN,zh_TW //78 行 选择语言
ORACLE_HOME=/app/oracle/app/oracle/product/11.2.0/db_1 //83 行 oracle_home
ORACLE_BASE=/app/oracle/app/oracle //88 行 oracle_base
oracle.install.db.InstallEdition=EE //99 行 oracle版本
oracle.install.db.isCustomInstall=true //108行 自定义安装
oracle.install.db.DBA_GROUP=oradba //142行 dba用户组
oracle.install.db.OPER_GROUP=orainstall //147行 oper用户组
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //160行 数据库类型
oracle.install.db.config.starterdb.globalDBName=helowrd //165行 globalDBName
oracle.install.db.config.starterdb.SID=helowrd //170行 SID
oracle.install.db.config.starterdb.memoryLimit=512 //192行 自动管理内存的最小内存(M)
oracle.install.db.config.starterdb.password.ALL=ora //233行 设定所有数据库用户使用同一个密码
DECLINE_SECURITY_UPDATES=true //385行 设置安全更新
#进行静默安装Oracle软件
cd /home/oracle/install/database
./runInstaller -silent -ignorePrereq -force -responseFile /home/oracle/response/db_install.rsp
安装中,如果提示[WARNING]不必理会,此时安装程序仍在进行,如果出现[FATAL],则安装程序已经停止了。
#日志
cd $ORACLE_BASE/oraInventory/logs
tail -100f installActions*.log
报错分析:
[FATAL] [INS-13013] 目标环境不满足一些必需要求。
原因: 不满足一些必需的先决条件。有关详细信息, 请查看日志。/app/oracle/app/oraInventory/logs/installActions2015-03-30_08-48-11PM.log
操作: 从日志 /app/oracle/app/oraInventory/logs/installActions2015-03-30_08-48-11PM.log 中确定失败的先决条件检查列表。然后, 从日志文件或安装手册中查找满足这些先决条件的适当配置, 并手动进行修复。
增加-ignorePrereq 忽略报错。
7. 安装完成后配置环境变量##
#安装完成且执行完root.sh后,在/home/oracle/.bashrc中添加如下内容:
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
export ORACLE_OWNER=ora
export SPFILE_PATH=$ORACLE_HOME/dbs
export ORA_NLS10=$ORACLE_HOME/nls/data
#source ./.bashrc 使变量生效
8. 配置监听程序##
$ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/response/netca.rsp
9. 用DBCA创建数据库实例##
9.1 创建实例
#修改DBCA响应文件/home/oracle/response/dbca.rsp
GDBNAME="helowrd.helowrd" //78 行 全局数据库的名字=SID+主机域名
SID="helowrd" //149行 SID
CHARACTERSET="AL32UTF8" //415行 编码
NATIONALCHARACTERSET="UTF8" //425行 编码
#静默安装Database
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/response/dbca.rsp
9.2 linux下启动oracle实例###
su - oracle
sqlplus /nolog
conn /as sysdba
startup
exit
lsnrctl start
exit
9.3 linux下关闭oracle实例###
su - oracle
sqlplus /nolog
conn /as sysdba
shutdown immediate
exit
lsnrctl stop
exit
welcom to my page ---> http://www.helowrd.net