首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

Fedora上安装Oracle以及自动化脚本附完全删除方法(原创)

2012-07-02 
Fedora下安装Oracle以及自动化脚本附完全删除方法(原创)在Fedora14下文字界面安装oracle10gR2软件?一.查看

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

在Fedora14下文字界面安装oracle10gR2软件
?一.查看安装环境
1.内存和SWAP
# grep MemTotal /proc/meminfo
MemTotal:??????? 3096372 kB
# grep SwapTotal /proc/meminfo
SwapTotal:?????? 5119996 kB
2.系统架构
# uname -m
i686
3.CPU信息

# grep "model name" /proc/cpuinfo
model name??? : Intel(R) Core(TM)2 Duo CPU???? T5870? @ 2.00GHz
model name??? : Intel(R) Core(TM)2 Duo CPU???? T5870? @ 2.00GHz
4.磁盘空间需求
/tmp空间至少有1G的可用空间,安装空间至少需要3.95G

# df -Th ? ? /tmp
Filesystem??? Type????? Size?? Used?? Avail?? Use%?? Mounted on
/dev/sda1?????? ext4? ? ? 15G??? 4.9G??? 9.4G??? 35% ? ?? /tmp

5.系统运行级别
# who -r
run-level 5? 2011-06-02 10:00

3或者5均可

6.查看并修改操作系统release-id(这里的步骤在个人PC下是可以不改的)
# yum -y install redhat-lsb

# lsb_release -id
Distributor ID:??? Fedora
Description:??? Fedora release 15 (Lovelock)

# vim /etc/redhat-release
Fedora release 15 (Lovelock)
改成
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
安装完成以后改回即可
7.内核

# uname? -r
2.6.38.6-27.fc15.i686.PAE

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

# 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

执行

#yum install -y `cat install.txt`

三.自动话脚本的编写

创建用户、配置所需环境变量:新建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/oracle" >> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1' >> /home/oracle/.bash_profile
echo "export ORACLE_SID=czmmiao" >> /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/product/10.2.0/db_1

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文件
# 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="oinstall"
FROM_LOCATION="/u01/database/stage/products.xml"
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_HOME_NAME="czmmiao"

ORACLE_HOSTNAME="oraInventory"
SELECTED_LANGUAGES={"en","zh_CN","zh_TW"}
COMPONENT_LANGUAGES={"en","zh_CN","zh_TW"}
INSTALL_TYPE="EE"
s_nameForDBAGrp="dba"
s_nameForOPERGrp="oper"
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用户以及用户组

参考至:http://www.51099.com/comp/daor/20101123/363094_2.html
? ? ? ? ? ? ? ? http://happyforever82.iteye.com/blog/448939

特别感谢Asher Huang老师的亲切指导

原创文章,转载请注明出处

如有错误,欢迎指正

邮箱:czmcj@163.com

热点排行