CentOS 5.11 x64静默安装(slient install)oracle 11.2.0.4 x64

2015-03-24

linux静默安装oracle 11.2.0.4不需要到服务器现场,相对图形界面安装也比较快,需要指定的参数也不算多,。

参考:
http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCGJCEA
http://blog.itpub.net/27042095/viewspace-1193482/

1、准备CentOS系统,准备11.2.0.4安装包
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip

2、yum安装依赖的软件包
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-2.5-24 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5 (32 bit)
glibc-headers-2.5
ksh-20060214
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel 4.1.2
make-3.81
sysstat-7.0.2
libXp-devel
openmotif

yum -y install binutils compat-libstdc++ compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ make sysstat unixODBC unixODBC-devel

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers bison

3、修改系统文件,添加指定内容

1)、/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

2)、vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
3)、vi /etc/pam.d/login
session required pam_limits.so
session required /lib64/security/pam_limits.so
4)、/etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
5)、添加oinstall/dba组及oracle用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

6)、切换到oracle用户
su - oracle
修改/home/oracle/.bash_profile
ORACLE_BASE=/u02/oracle
ORACLE_HOME=$ORACLE_BASE/11.2.0
ORACLE_SID=viewerdb
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
PATH=$PATH:$ORACLE_HOME/bin
NLS_LANG=AMERICAN_CHINA.AL32UTF8
#NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
#NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH NLS_LANG
alias ssqlplus='rlwrap sqlplus "/as sysdba"'

4、安装rlwrap
http://utopia.knoware.nl/~hlub/rlwrap/rlwrap-0.37.tar.gz
./configure --prefix=/usr
make;make install

5、准备安装数据库路径
mkdir -p /u02/oracle/11.2.0
mkdir -p /data1/oracle
chown oracle:oinstall /u02
chown oracle:oinstall /data1

6、如果遇到有库文件找不到
Locate filename
ln -s /usr/lib/libstdc++-v3/libstdc++.so.5 /usr/lib

7、如果用图形界面安装,直接用oracle用户登录
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
cd database
./runInstaller安装即可

8、如果只能通过ssh远程访问,没有图形界面,我们需要通过静默安装,准备响应文件
登陆oracle用户
cp /opt/11.2.0.4/database/response/db_install.rsp ~/ee.rsp
修改参数:
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=db05
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u02/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW,ko,ja
ORACLE_HOME=/u02/oracle/11.2.0
ORACLE_BASE=/u02/oracle
oracle.install.db.InstallEdition=EE

或者图形界面安装时候将配置保存成响应文件。
SELECTED_LANGUAGES=en,zh_CN,zh_TW,ko,ja可以支持多种语言。

9、 修改/etc/hosts 增加主机名,否则安装oracle时会提示主机错误之类的
127.0.0.1 db01

10、安装oracle
cd /opt/11.2.0.4/database

./runInstaller -ignoreSysPrereqs

./runInstaller -silent -responseFile ~/ee.rsp
各参数含义如下:
-silent 表示以静默方式安装,不会有任何提示
-force 允许安装到一个非空目录
-noconfig 表示不运行配置助手netca
-responseFile 表示使用哪个响应文件,必需使用绝对路径

等出现setup success就安装完成了。

11、dbca创建数据库,字符集指定AL32UTF8,你可以根据需要修改,比如ZHS16GBK
dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname mydb -sid mydb -responseFile NO_VALUE -characterSet AL32UTF8 -memoryPercentage 40 -emConfiguration none(启动em)

dbca -help查看参数
[-sysPassword ]
[-systemPassword ]
[-emConfiguration <CENTRAL|LOCAL|ALL|NONE>]
[-characterSet ]
[-nationalCharacterSet ]

dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname chatdb -sid chatdb -responseFile NO_VALUE -characterSet AL32UTF8 -memoryPercentage 40 -sysDBAUserName sys -sysDBAPassword 123456(不启动em)
等出现100%就创建成功了

dbca -silent -deleteDatabase -sourcedb orcl -sid orcl -sysDBAUserName orcl -sysDBAPassword 123456

如何Oracle报错 :There are no databases present on the system

是因为在/etc/oratab文件中没有数据库的记录信息。手动在文件中添加数据库的信息即可。

crmdb:/u02/oracle/12.2.0:N

12、执行ssqlplus检查数据是否正常
sqlplus> select count(*) from tab;
sqlplus> show sga
sqlplus> show parameter sga

13、创建表空间和用户
create tablespace DB_CORE_TS datafile '/data1/oracle/db_core_ts_201503_1.dbf' SIZE 512M AUTOEXTEND ON NEXT 256M MAXSIZE UNLIMITED BLOCKSIZE 16k;

create user db_core identified by db123456 default tablespace DB_CORE_TS;
grant dba,resource,connect to db_core;

14、shutdown immediate
15、启动监听lsnrctl start;
netstat -ntlp检查1521端口是否开启
16、启停em
emctl start dbconsole
emctl stop dbconsole

17、停止oracle大端口 big port
alter system set dispatchers='(PROTOCOL=TCP)(disp=0)';
alter system set dispatchers='(PROTOCOL=TCP)(disp=0)';
SELECT NAME,NETWORK FROM V$DISPATCHER;
!netstat -ntl

18、dbca静默删除数据库
dbca -silent -deleteDatabase -sourceDB mydb -sysDBAUserName sys -sysDBAPassword db123456

分类:数据库 | 标签: |

相关日志

评论被关闭!