oracle 11g在linux下的安装指引-tina

一、安装前准备工作
内存 1.5G,至少1G
#grep  MemTotal  /proc/meminfo

swap交换空间  3G
#grep SwapTotal  /proc/meminfo

磁盘  至少20G
#df –ah


二、安装所需的依赖包
1、首先要确认你的操作系统的位数和版本,依赖包必须要是相符的。
#getconf  LONG_BIT       
#cat  /etc/issue 
本指引以rhel5.7,64位的系统为例。注:不同版本的系统可能需要的包不同。
  
2、使用rpm –qa| grep 软件包名称  
逐个查看是否已经安装下方图中的所有包。

3、如果有未安装的包,可使用下面两种方式获取安装。
(1)使用yum工具
#cd /etc/yum.repos.d/
#lftp 10.0.15.33 
>get repo1/repos/rehl5.7.repo  获取ftp上的相应repo文件,也可以直接挂载iso文件。
yum list  安装包名     查找是否有需要的包,查找的时候最好不要带上后面的数字。  
yum install  安装包名    

(2)使用rpm安装
最直接的方式是去下载缺失的rpm文件,然后使用rpm –ivh  xxxxx.rpm 安装。
但是由于这些包之间有依赖关系,有些包安装的时候会提示conflict with另一个包。


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

三、创建oracle用户
#Groupadd oinstall     oracle安装组oinstall
#Groupadd dba          数据库管理员组dba
#makdir  /u01
#useradd –g oinstall –G dba  -d  /u01/oracle  oracle新建用户oracle  主组oinstall 其他组dba  主目录是/u01/oracle 
注意:如果不想用oracle这个用户名,标黄处需修改。
#passwd oracle   密码 oracle  

若想删除用户:
userdel –r oracle   会把/u01/oracle这个目录删掉,/u01保留


四、修改内核参数
vi  /etc/sysctl.conf  在下方加如下参数:

为了使上述配置生效而不重启系统,执行如下命令
#/sbin/sysctl –p
如果安装过程中修改了内核参数,就需要再次输入下面命令,使生效。
注:后面安装检测时,如果设置不达到要求,会有提示。

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2070413312
kernel.shmmni = 8192
kernel.sem = 550 32000 10100 1280
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 = 1048586


五、修改用户限制
#vi /etc/security/limits.conf 在下方加入如下内容:

注:此处的oracle是前面新建的数据库用户名称。
数据库的用户必须是linux的系统用户。
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

六、修改用户验证选项
#vi /etc/pam.d/login  在下方加入如下内容:
session   required    pam_limits.so


七、修改用户配置文件
#vi /etc/profile  在下方加入如下内容:
if [ $USER = "oracle" ];then
   if  [ $SHELL = "/bin/ksh" ];then
        ulimit -p 16384
        ulimit -p 65536
   else
        ulimit -u 16384 -n 65536
   fi
fi
 
注:[ ]这个符号中间的内容一定不能挨着符号,要空格  如果没有空格,那么切换用户的时候可能会报错,-bash[oracle:command cannot find. 
USER的名字必须与前面新建的oracle一致。
[root@oratest u01]# su - oracle
[oracle@oratest ~]$ pwd
/u01/oracle


八、安装目录配置
#mkdir -p  /u01/oraInventory    -P是指如果父目录不存在,就新建。
#chown -R  oracle:oinstall  /u01/    这里是将/u01/目录及其所有子目录的属主改为组oinstall下的oracle用户,后续添加进来的文档,会保持原有的属主,因此若有新增内容,可重新修改属主。
#chmod -R 755 /u01/    将/u01的权限修改rwxr-xr-x


九、修改用户bash shell
#su – oracle 切换到oracle用户,在他的家目录下/u01/oracle下有一个.bash_profile
注:如果前面没有指定,那么默认就是/home/用户名目录下。
#vi .bash_profile,在下方加如下内容:
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01
export ORACLE_HOME=$ORACLE_BASE/oracle
export ORACLE_SID=tinadb
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$ORALCE_HOME/lib:/usr/lib


#env |grep ORA 可以查看环境变量是否完成。
[oracle@oratest ~]$ env |grep ORA
ORACLE_SID=tinadb
ORACLE_BASE=/u01
ORACLE_HOME=/u01/oracle
注:也可以使用root用户vi /etc/profile,添加相同内容。


十、开始安装
1、安装工具
由于使用secure.CRT使用协议SSH2,只能使用命令行,不能图形化。因此我们可以使用一个Xmanager工具进行图形化安装。在所有程序打开Xmanager-Passive,此时不会弹出窗口,但右下角有一个图标。
切换到oracle用户
$export DISPLAY=10.0.11.89:0.0   此IP地址是你本地的ip地址。
$xhost +

可能会报错:
-bash: xhost: command not found
http://archive.download.redhat.com/pub/redhat/linux/ 可以下载需要的包  我直接忽略了

补充说明:
xhost + 是使所有用户都能访问Xserver.
xhost + ip使ip上的用户能够访问Xserver.
xhost + nis:user@domain使domain上的nis用户user能够访问
xhost + inet:user@domain使domain上的inet用户能够访问。


2、解压安装包
unzip XXX.zip  将oracle的安装包直接解压,解压成一个database的目录。
[root@oratest tmp]# yum install -y unzip
[oracle@oratest tmp]$ unzip p10404530_112030_Linux-x86-64_1of7.zip
[oracle@oratest tmp]$ unzip p10404530_112030_Linux-x86-64_2of7.zip

3、运行安装脚本,这个脚本在database目录里面
./runInstaller

[oracle@oratest database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB.   Actual 41787 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3967 MB    Passed
Checking monitor: must be configured to display at least 256 colors
    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<
Some requirement checks failed. You must fulfill these requirements before
continuing with the installation,
Continue? (y/n) [n]

pdksh有的时候跟ksh不兼容,要先卸载ksh
6.4版本的必须安装pdksh,不能安装ksh。
先使用rpm -e 卸载已经安装的ksh,再安装pdksh
[root@oratest tmp]# rpm -qa |grep ksh
ksh-20120801-28.el6_7.3.x86_64
[root@oratest tmp]# rpm -e ksh-20120801-28.el6_7.3.x86_64
[root@oratest tmp]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
warning: pdksh-5.2.14-37.el5_8.1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY
Preparing...                ########################################### [100%]
   1:pdksh                  ########################################### [100%]

>>> Ignoring required pre-requisite failures. Continuing...
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-12-09_05-11-38PM. Please wait ...[oracle@oratest database]$ Exception in thread "main" jaa.lang.UnsatisfiedLinkError: /tmp/OraInstall2015-12-09_05-11-38PM/jdk/jre/lib/amd64/xawt/libmawt.so: libXext.so.6: cannot open shared object file: No such file o directory
这里安装
yum install -y libXp  libXp-devel  libXpm  libXpm-devel

4、弹出安装界面
第1步:配置安全更新
此处都可以不填,不勾选。

第2步:下载软件更新
一般不用更新,勾选跳过
Skip software updates

第3步:安装选项
根据需要,选择创建和配置一个数据库
Create and configure a database

第4步:系统类
桌面类
服务器类
根据需要,选择服务器类。
Server Class

第5步:网络安装选项
根据需要,选择单实例数据库安装
Single instance database installation you want to perform

第6步:安装类型
典型安装
高级安装
一般情况下,我们可以选择典型安装,但如果要设置一些参数,最好选择高级安装。
高级安装步骤相对多一些,此处不一一截图,根据需要选择即可,没有特别要求的情况下默认既可。

注:我们的测试和开发环境,字符集设置为AL32UTF8,如下图所示。
安装完成后再设置,一般都很难成功,因此要特别注意。
Advanced install

第7步:数据库版本:Enterprise Edition(4.5GB)

第8步:安装位置:选择刚刚定义好的ORACLE_BASE目录和ORACLE_HOME目录
/u01  和 /u01/oracle

第9步:create inventory
/u02/orainventory

第10步:Configuration Type
General Purpose/Transaction Processing

第11步:Database Identifiers
Global database name :tinadb
Oracle service identifier(sid):tinadb

第12步:Configuration options
Memory:拖动进度条  调整合适的内存大小
Character sets :Use Unicode(AL32UTF8)

第13步:Management options:默认即可

第14步:Database storage
File system:  一般选这个
Specify database file location :/u01/oradata  一般都是ORACLE_BASE/oradata
Oracle automatic storage management  自动存储管理ASM,安装了此软件的话就选这个

第15步:
Backup and recovery
Do not enable automated backups

第16步:Schema passwords:
Use the same password for all accounts
根据需要设置

第17步:Operating system groups
选择osdba和osoper的用户组

第18步:Prerequisite checks 先决条件检查
根据报错提示解决问题,然后点击check again


此处会自动检测,是否符合安装要求,检测若是出错,请根据提示进行相应修改。
常见错误有
1、该机器的名称为cnsz03v10132
报如下错误时,只需要vi /etc/hosts
添加机器的ip地址 和该名称即可。


2、内核参数的设置不达期望值,或者某一个依赖包未安装。
根据提示修改或者安装,再重新检测。
注:此检测过程虽失败,但并不需要退出安装,待修改后重新检测通过既可。

第19步:Install
安装过程中,会提示用root执行两个脚本。提示如下:
(1)执行第一个脚本:
/u01/orainventory/orainstRoot.sh
[root@oratest oraInventory]# ./orainstRoot.sh
Changing permissions of /u01/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/oraInventory to oinstall.
The execution of the script is complete.

(2)执行第二个脚本,需要填写bin的路径/usr/bin
/u01/oracle/root.sh
[root@oratest oracle]# ./root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/oracle
Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/bin

安装完成
安装完成后,在oracle用户下进行连接测试。
$sqlplus /nolog
SQL>conn / as sysdba
connected  连接成功!

补充说明:
1、使用dbca在已有的数据库上新建实例
#su – oracle
$cd $ORACLE_HOME/bin
同样可以使用图形化界面进行安装
$export DISPLAY=10.0.11.89:0.0  
$xhost +
执行命令
./dbca
新建过程与前面类似,根据实际需要选择即可。

2、配置网络服务
#su – oracle
$cd $ORACLE_HOME/bin
./netmgr

以上为全部指引内容。

猜你喜欢

转载自906179271.iteye.com/blog/2262972