`
gaoyuntao2005
  • 浏览: 303420 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Fedora下安装Oracle以及自动化脚本附完全删除方法(

阅读更多

在fedora14下文字界面安装oracle10gR2软件
 一.查看安装环境
1.内存和SWAP
[root@xinchang ~]# grep MemTotal /proc/meminfo 
MemTotal: 1026060 kB
[root@xinchang ~]# grep SwapTotal /proc/meminfo 
SwapTotal: 4194300 kB
 
2.系统架构
[root@xinchang ~]# uname -m
i686
 
3.CPU
[root@xinchang ~]# grep "model name" /proc/cpuinfo 
model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz
 
4.磁盘空间需求
/tmp空间至少有1G的可用空间,安装空间至少需要3.95G
[root@xinchang ~]# df -Th /tmp

文件系统           类型     容量    已用       可用    已用%%      挂载点

/dev/sda9          ext4     20G    8.7G       11G        46%           / 

tmpfs                tmpfs   1.5G    312K       1.5G       1%         /dev/shm

 /dev/sda11       ext4      4.9G  3.3G       1.4G        71%        /home

/dev/sda12        ext4       4.9G  4.2G       416M      92%        /usr 

5.系统运行级别
[root@xinchang ~]# who -r
      运行级别    5 2010-11-23 16:10
 

3或者5均可

6.查看并修改操作系统release-id(这里的步骤在个人PC下是可以不改的)
[root@xinchang ~]# yum -y install redhat-lsb
[root@xinchang ~]# lsb_release -id
Distributor ID: Fedora

Description: Fedora release 14 (Laughlin) 

[root@xinchang ~]# vim /etc/redhat-release
Fedora release 14 (Laughlin)
 
改成
Red Hat Enterprise Linux AS release 4 (Nahant Update 5) 
安装完成以后改回即可
7.内核
[root@xinchang ~]# uname -r
2.6.35.6-45.fc14.i686
 

需要2.6.9以上内核版本,不是的话可通过yum 来升级

[root@xinchang ~]# yum -y install kernel

二.安装依赖软件包

新建install.txt 将

binutils
compat-db
control-center
gcc
gcc-c++
glibc
glibc-common
gnome-libs
libstdc++
libstdc++-devel
make
pdksh(fedora14 已经淘汰pdksh所以我们可以装ksh)
sysstat
xscreensaver

三.自动话脚本的编写

创建用户、配置所需环境变量:新建1preuser.sh键入如下代码

echo "Now create two groups named 'oinstall' and 'dba', plus a user named 'oracle'.Also setting the Environment"
groupadd oinstall 
groupadd -g 502dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 oinstall
 
useradd -g oinstall -G dba,oper,asmadmin,oinstall -c "Oracle software owner" -d /home/oracle oracle 
echo "oracle" | passwd --stdin oracle
echo "export ORACLE_BASE=/u01/app" >> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/oracle' >> /home/oracle/.bash_profile
echo "export ORACLE_SID=orcl" >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/X11R6/lib' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/jdk/jre/lib/i386' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/jdk/jre/lib/i386/server' >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/rdbms/lib' >> /home/oracle/.bash_profile
echo 'export CLASS_PATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib' >> /home/oracle/.bash_profile
echo 'export CLASS_PATH=$CLASS_PATH:$ORACLE_HOME/rdbms/jlib' >> /home/oracle/.bash_profile
echo 'export CLASS_PATH=$CLASS_PATH:$ORACLE_HOME/network/jlib' >> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm" >> /home/oracle/.bash_profile
echo "export EDITOR=vi" >> /home/oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile
echo "The two groups named 'oinstall' and 'dba' plus the oracle user has been created."
echo "The Environment variable for oracle user also has been setted sussessfully."
 

2.创建目录-----2predir.sh

echo "Now create the necessary directory for oracle user and change the authention to oracle user..."

mkdir -p /u01/app/oracle

chown -R oracle:oinstall /u01 chown oracle:oinstall /home/oracle

echo "The necessary directory for oracle user and change the authention to oracle user has been finished

3.解除安装oracle所有者的shell---3prelimits.sh

echo "Now modify the /etc/security/limits.conf,but backup it named /etc/security/limits.conf.bak before"

cp    /etc/security/limits.conf     /etc/security/limits.conf.bak

echo "oracle soft nproc 2047" >>/etc/security/limits.conf

echo "oracle hard nproc 16384" >>/etc/security/limits.conf

echo "oracle soft nofile 1024" >>/etc/security/limits.conf

echo "oracle hard nofile 65536" >>/etc/security/limits.conf

echo "Modifing the /etc/security/limits.conf has been succeed."

4.修改登录文件---4prelogin.sh

echo "Now modify the /etc/pam.d/login,but with a backup named /etc/pam.d/login.bak" 
cp /etc/pam.d/login     /etc/pam.d/login.bak
 
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
 
echo "session required pam_limits.so" >>/etc/pam.d/login
 
echo "Modifing the /etc/pam.d/login has been succeed."
 

5.修改环境变量---5bpreprofile.sh

echo "Now modify the /etc/profile,but with a backup named /etc/profile.bak"
cp /etc/profile /etc/profile.bak
echo 'if [ $USER = "oracle" ]; then' >> /etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo 'ulimit -p 16384' >> /etc/profile
echo 'ulimit -n 65536' >> /etc/profile
echo 'else' >> /etc/profile
echo 'ulimit -u 16384 -n 65536' >> /etc/profile
echo 'fi' >> /etc/profile
echo 'fi' >> /etc/profile
echo "Modifing the /etc/profile has been succeed."
 

6.修改内核参数---6.presysctl.sh

echo "Now modify the /etc/sysctl.conf,but with a backup named /etc/sysctl.bak"
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "fs.file-max = 65536" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
echo "net.core.rmem_default=1048576" >> /etc/sysctl.conf
echo "net.core.rmem_max=262144" >> /etc/sysctl.conf
echo "net.core.wmem_default=262144" >> /etc/sysctl.conf
echo "net.core.wmem_max=262144" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
echo "Modifing the /etc/sysctl.conf has been succeed."
echo "Now make the changes take effect....."
sysctl -p
 

开始安装软件
1.准备response文件
 
[root@xinchang response]# ll
总用量 236
-rwxr-xr-x. 1 oracle oinstall 25278 7月 3 2005 custom.rsp
-rwxr-xr-x. 1 oracle oinstall 44600 7月 3 2005 dbca.rsp
-rwxr-xr-x. 1 oracle oinstall 8476 7月 3 2005 emca.rsp
-rwxr-xr-x. 1 oracle oinstall 71113 7月 3 2005 enterprise.rsp
-rwxr-xr-x. 1 oracle oinstall 5742 7月 3 2005 netca.rsp
-rwxr-xr-x. 1 oracle oinstall 71113 7月 3 2005 standard.rsp
[root@xinchang response]# pwd
/home/oracle/database/response
我把安装文件解压在/home/oracle目录下,database就是解压以后的安装目录。
我们这里是安装企业版的oracle数据库软件所以我们要将enterprise.rsp进行修改,修改如下内容:
 
UNIX_GROUP_NAME="dba"
ROM_LOCATION="../stage/products.xml"
ORACLE_HOME=/u01/app01/app
ORACLE_HOME_NAME="orcl"
ORACLE_HOSTNAME="czmmiao"
INSTALL_TYPE="EE"
s_nameForDBAGrp="dba"
s_nameForOPERGrp="dba"
n_configurationOption=3
保存退出
并将更改以后的rsp文件拷贝到一个指定目录中
 
[root@xinchang response]# cp enterprise.rsp /u01/app/
[root@xinchang oracle]# chown oracle:oinstall enterprise.rsp
确保rsp文件的用户和用户组分别为oracle和oinstall
2.软件安装

读者亦可选用“点下一步”的安装方式,这样也就无需配置enterprise.rsp文件,本文采用静默安装方式,具体如下 
[root@xinchang oracle]# su - oracle
[oracle@xinchang database]$ ./runInstaller -ignoreSysPrereqs -silent -noconfig -responseFile /u01/app/enterprise.rsp
这里会提示你用root用户运行root.sh和orainstRoot.sh两个脚本 
[root@xinchang ~]# /home/oracle/product/10.2/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle

ORACLE_HOME= /u01/app/ 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...

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.
[root@xinchang ~]# /home/oracle/oraInventory/orainstRoot.sh
更改权限/u01/app/oraInventory 到 770.
更改组名/u01/app/oraInventory 到 dba.
脚本的执行已完成
检测数据库软件是否安装成功
 
[root@xinchang ~]# su - oracle
[oracle@xinchang ~]$ sqlplus /nolog


SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 23 18:09:01 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL>

下面附linux下oracle的删除方法 
1. 运行   $ORACLE_HOME/bin/localconfig delete
2. rm -rf   $ORACLE_BASE/*
3. rm -f   /etc/oraInst.loc /etc/oratab
4. rm -rf  /etc/oracle
5. rm -f   /etc/inittab.cssd
6. rm -f /usr/local/bin/coraenv    /usr/local/bin/dbhome    /usr/local/bin/oraenv
7. 删除oracle用户以及用户组

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics