Oracle11gR2 在 Linux CentOS 5.3,RHEL 5.4 上的安装 <转
Oracle11gR2 在 Linux CentOS 5.3,RHEL 5.4 上的安装 作者: Zinc Chen 邮箱: zinc.chen@live.cn 一. 安装操作系统 操作平台 : VMWARE 7.0.0 build-197124+CentOS-5.4-x86_64-bin-DVD.iso 数据库版本 : Oracle11gR2 针对 32/64 位 Linux ,请选用对应版本的
Oracle11gR2 在 Linux CentOS 5.3,RHEL 5.4 上的安装
作者: Zinc Chen 邮箱: zinc.chen@live.cn
一. 安装操作系统
操作平台 :
VMWARE 7.0.0 build-197124+CentOS-5.4-x86_64-bin-DVD.iso
数据库版本 :
Oracle11gR2 针对 32/64 位 Linux ,请选用对应版本的 Oracle
下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip
辅助软件 :
SecureCRT( 用于远程执行命令 ) 、 winscp( 用于远程文件传输 )
要求内存不小于 1G ; / 更新:测试机不满足要求,但是在安装的时候可以选择忽略
在内存小于 4G , SWAP 应该是内存的 1.5 倍;
内存 4 到 16G , SWAP 和内存相同大小即可
内存超过 16G , SWAP 是 16G ;
( 我的虚拟机物理内存设置为 2G , SWAP 设置为 3G) ;
由于 11gR2 对于共享内存要求变大,因此系统共享内存应该大于 512* 进程数;
如果共享内存不足的话,会造成 ORA-845 或 ORA-1078 错误;
要求 /tmp 分区不少于 400M ,安装目录应大于 4G ;
4. 我的虚拟机配置情况:
宿主配置为四核心 Q9550, 内存 8G DDR2 800 的,主板 Intel G45 ,硬盘采用 320G*3 前段组 RAID0, 后段组 RAID5 ,操作系统为 Vista 64bit SP2
虚拟操作系统配置: CPU 双核心,内存 2048G ,硬盘 160G
硬盘分区情况如下:
SWAP 3072M
/boot 300M
/ 15G
/ora 15G
/oradata 90G
/orabak 30G
/更新:实际使用中,先划分前面的分区,然后根据硬盘剩余对后面的空间进行划分,建议采用 LVM2 对分区进行管理,这样可以在线调整分区大小,灵活性比较高。
5. 默认服务器开启了 SSH ,在配置防火墙的时候注意检查一下,这样可以使用 SecureCRT 连接进入控制,使用 FileZilla 传输文件;
6. 安装系统的时候,可以直接选择依赖包,以解决 Oracle 安装的时候依赖关系,当然也可以在安装完基本系统以后再补充安装依赖包,建议采用后者,以避免操作太多导致混乱;
7. VM 中安装的话,需要安装 VM 相关的驱动 ( 点击 VM->Install VMware Tools) :
进入光盘路径: mount /media/cdrom /dev/cdrom
cd /media/cdrom
安装 VMwareTools : rpm –ivh VMwareTools-7.8.6-185404.i386.rpm
初始化图形界面: /usr/bin/vmware-config-tools.pl
重新启动 X : ctrl+alt+backspace
弹出 VM 的驱动光盘,挂载默认的系统盘,后面要用
二.配置系统,准备安装
检查硬件情况 ( 虚拟机情况 ) :
[root@ora ~]# grep "model name" /proc/cpuinfo model name : Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz model name : Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz [root@ora ~]# grep MemTotal /proc/meminfo MemTotal: 2075560 kB [root@ora ~]# grep SwapTotal /proc/meminfo SwapTotal: 3113340 kB [root@ora ~]# free total used free shared buffers cached Mem: 2075560 1000572 1074988 0 59336 814732 -/+ buffers/cache: 126504 1949056 Swap: 3113340 0 3113340 [root@ora ~]# df -k /dev/shm 文件系统 1K- 块 已用 可用 已用 % 挂载点 tmpfs 1037780 0 1037780 0% /dev/shm [root@ora ~]# df -k /tmp 文件系统 1K- 块 已用 可用 已用 % 挂载点 /dev/sda5 9920592 3165436 6243088 34% / |
检查软件情况 (CentOS 5.3 的情况, RHEL 无需改动 ) :
[root@ora ~]# cat /proc/version Linux version 2.6.18-128.el5 (mockbuild@builder16.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Jan 21 10:44:23 EST 2009 [root@ora ~]# uname -a Linux ora.libcms.net 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686 i686 i386 GNU/Linux [root@ora ~]# more /etc/issue CentOS release 5.3 (Final) Kernel \r on an \m [root@ora ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 ora.libcms.net ora localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 |
将 CentOS 系统伪装成 RedHat
Vi /etc/redhat-release 修改为 : Red Hat Enterprise Linux Server release 5.3 (Tikanga) |
#cat /proc/partitions 查看现在分区
#cd /mnt 进入挂载目录
#mkdir cdrom 创建光盘挂载区
#mkdir usb 创建U盘挂载区
#mount /dev/sdb /mnt/usb 例如将sdb设备挂载到/mnt/usb目录下
#umount /mnt/usb 使用完毕后将设备卸载
linux的硬件设备在/dev目录下,光驱也是其中。
/dev/cdrom表示光驱,挂载光驱的方法如下(以root身份):
mkdir /mnt/cdrom
mount -t auto -o ro /dev/cdrom
/mnt/cdrom #不加参数也能自动挂上。
以下是操作的屏幕复制内容:
linux@cdyemail:/$ ls /mnt #查看mnt下面有没有cdrom目录 ,这个是随意的目录。
cdrom iso usb winc wind
linux@cdyemail:/$ mount /dev/cdrom /mnt/cdrom #挂载发现没有权限
mount: 只有 root 才能进行此操作
linux@cdyemail:/$ su #切换到root用户,也可以用sudo 来取得root权限。
密码:
root@cdyemail:/# mount -t auto -o ro /dev/cdrom /mnt/cdrom #-t auto类型自动, -o ro只读模式
root@cdyemail:/# ls -l /mnt/cdrom #查看光盘内容
root@cdyemail:/# umount /mnt/cdrom #删除挂载的光驱
root@cdyemail:/# eject /dev/cdrom #弹出光驱
root@cdyemail:/#
附:
对于iso镜像文件可以进行挂载
mount -t iso9660 -o loop iso文件 /mnt/iso
你想安装:gcc-4.1.2-46.SEL5_4.2.i386.rpm的软件包,需要先安装相关的软件包,这都有依赖性。 如果,你只想安装gcc-4.1.2-46.SEL5_4.2.i386的软件包的话,就多加一个 --nodeps 的参数就好了
如:rpm -ivh --nodeps gcc-4.1.2-46.SEL5_4.2.i386.rpm
这就无需依赖其他的安装包了
rpm -ivh gcc-c++-4.1.2-46.el5.x86_64.rpm --nodeps --force
安装系统的依赖包 ( 注意对应版本 , 安装系统的时候如果已经处理,这里就无需要安装了 )
// 下面是 redhat 5.4 64bit 版本的命令 cd /media/cdrom cd Server rpm -ivh binutils-2.17.50.0.6-12.el5.x86_64.rpm rpm -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm rpm -Uvh elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm --nodeps rpm -ivh elfutils-libelf-devel-0.137-3.el5.x86_64.rpm rpm -ivh elfutils-libelf-0.137-3.el5.x86_64.rpm rpm -Uvh elfutils-devel-static-0.137-3.el5.x86_64.rpm --nodeps rpm -ivh elfutils-libs-0.137-3.el5.x86_64.rpm rpm -ivh elfutils-devel-0.137-3.el5.x86_64.rpm rpm -ivh glibc-headers-2.5-42.x86_64.rpm rpm -ivh glibc-2.5-42.i686.rpm rpm -ivh glibc-devel-2.5-42.i386.rpm rpm -ivh glibc-2.5-42.x86_64.rpm rpm -ivh glibc-common-2.5-42.x86_64.rpm rpm -ivh glibc-devel-2.5-42.x86_64.rpm rpm -ivh gcc-4.1.2-46.el5.x86_64.rpm rpm -ivh gcc-c++-4.1.2-46.el5.x86_64.rpm rpm -ivh kernel-headers-2.6.18-164.el5.x86_64.rpm rpm -ivh ksh-20080202-14.el5.x86_64.rpm rpm -ivh libaio-0.3.106-3.2.i386.rpm rpm -ivh libaio-0.3.106-3.2.x86_64.rpm rpm -ivh libaio-devel-0.3.106-3.2.i386.rpm rpm -ivh libaio-devel-0.3.106-3.2.x86_64.rpm rpm -ivh libgcc-4.1.2-46.el5.i386.rpm rpm -ivh libgcc-4.1.2-46.el5.x86_64.rpm rpm -ivh libgomp-4.4.0-6.el5.x86_64.rpm rpm -ivh libstdc++-4.1.2-46.el5.x86_64.rpm rpm -ivh libstdc++-devel-4.1.2-46.el5.x86_64.rpm rpm -ivh make-3.81-3.el5.x86_64.rpm rpm -ivh sysstat-7.0.2-3.el5.x86_64.rpm rpm -ivh unixODBC-2.2.11-7.1.i386.rpm rpm -ivh unixODBC-devel-2.2.11-7.1.i386.rpm rpm -ivh unixODBC-2.2.11-7.1.x86_64.rpm rpm -ivh unixODBC-devel-2.2.11-7.1.x86_64.rpm |
增加必须要的用户组与用户
[root@ora ~]# groupadd oinstall [root@ora ~]# groupadd dba [root@ora ~]# adduser -g oinstall -G dba oracle [root@ora ~]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@ora ~]# df -h [root@ora ~]# mkdir -p /ora/app/oracle/product/ [root@ora ~]# chown -R oracle:oinstall /ora [root@ora ~]# chmod -R 775 /ora [root@ora ~]# chown -R oracle:oinstall /oradata [root@ora ~]# chmod -R 775 /oradata [root@ora ~]# chown -R oracle:oinstall /orabak [root@ora ~]# chmod -R 775 /orabak |
修改内核参数
[root@ora ~]#vi /etc/sysctl.conf kernel.shmmni = 4096 # semaphores: semmsl, semmns, semopm, semmni kernel.sem = 250 32000 100 128 fs.file-max = 6815744 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 = 1048576 fs.aio-max-nr= 1048576 [root@ora ~]#/sbin/sysctl -p [root@ora ~]#/sbin/sysctl -a |
为 oracle 用户设置 Shell 限制
[root@ora ~]# vi /etc/security/limits.conf 增加: oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 vi /etc/pam.d/login file 增加: session required pam_limits.so\ vi /etc/profile 增加: if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi vi /etc/csh.login 增加: if ( $USER == "oracle" ) then limit maxproc 16384 limit descriptors 65536 endif |
修改用户的启动脚本
su oracle echo $SHELL cd /home/oracle vi .bash_profile 增加如下内容: ORACLE_BASE=/ora/app/oracle ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 ORACLE_HOME_LISTNER=$ORACLE_BASE/product/11.2.0/dbhome_1 ORACLE_SID=orcl PATH=$ORACLE_HOME/bin:$PATH export ORACLE_BASE ORACLE_HOME ORACLE_HOME_LISTNER ORACLE_SID PATH ORACLE_TERM=xterm export ORACLE_TERM TNS_ADMIN=$ORACLE_HOME/network/admin export TNS_ADMIN #set the user languages #NLS_LANG="SIMPLIFIED CHINESE_CHINA".GBK #LC_CTYPE=zh_CN.GBK #LC_ALL=zh_CN.UTF8 #LANG=zh_CN.GBK LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib CLASSPATH=$ORACLE_HOME/jdk/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_LANG LC_CTYPE LC_ALL LANG LD_LIBRARY_PATH CLASSPATH umask 022 载入启动脚本: source .bash_profile |
上传 oracle 的安装文件到服务器,采用 SFTP 协议传输。
以 oracle 用户上传之 /ora 文件夹 [oracle@ora ora]$ unzip linux_11gR2_database_1of2.zip [oracle@ora ora]$ unzip linux_11gR2_database_2of2.zip |
二.安装 Oracle11gR2
cd /ora/database
./runInstaller 开始安装 .
选择高级安装 , 进行自定义安装
在 CentOS 的安装中 , 提示 pdksh 包找不到是正常现象, redhat5 以上的版本已经更名 pdksh 为 ksh 包了,前面我们已经安装了,所以可以忽略
在 CentOS 的安装中 , 会出现一个关于 oraInventory 目录的警告 , 点击 OK, 不用理会继续即可 , 在随后的窗口中将 /oraInventory 修改为 /ora/app/oraInventory
随后参数都是默认 , 在安装中会弹出一个要求执行
/ora/app/oraInventory/oraIinstRoot.sh 和 /ora/app/oracle/product/11.2.0/dbhome_1/root.sh 的提示框 , 可在命令行中 , 以 ROOT 用户执行这两个文件 , 进入 End of installtion 窗口 , 安装结束 .
[oracle@test database]$ ./runInstaller
正在启动 Oracle Universal Installer...
检查临时空间: 必须大于 120 MB。 实际为
117329 MB 通过
检查交换空间: 必须大于 150 MB。 实际为 1983 MB 通过
检查监视器: 监视器配置至少必须显示 256 种颜色
>>> 无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色。请检查是否设置了 DISPLAY 变量。 未通过
未通过某些要求检查。必须先满足这些要求,
然后才能继续安装,那时将重新检查这些要求。
是否继续? (y/n) [n] y
原因:
当时是通过vnc登录的root,然后通过root切换到oracle用户的,注销通过oracle登录就可以!
三.连接测试
如果启动有问题lsnrctl: error while loading shared libraries: /home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1: cannot restore segment prot after reloc: Permission denied
执行
semanage fcontext -a -t textrel_shlib_t
/ora/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
restorecon -R -v
/ora/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
启动监听器: lsnrctl start
登陆: sqlplus "/as sysdba"
启动数据库: startup
关闭数据库: shutdown
关闭监听器: lsnrctl stop
启动 EM : emctl start dbconsole
关闭 EM : emctl stop dbconsole
启动 iSQL*Plus : isqlplusctl start
关闭 iSQL*Plus : isqlplusctl stop
如果希望让服务器自动启动,那么需要修改 /etc/oratab 中:
orcl:/ora/app/oracle/product/11.2.0/dbhome_1:Y
四.添加系统服务
作为 root 用户创建一个叫做 /etc/init.d/dbora 的文件,包括下面的内容:
#!/bin/sh # description: Oracle auto start-stop script. # chkconfig: - 20 80 # # Set ORA_HOME to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; # # Set ORA_OWNER to the user id of the owner of the # Oracle database in ORA_HOME. ORA_HOME=/ora/app/oracle/product/11.2.0/dbhome_1
ORA_OWNER=oracle if [ ! -f $ORA_HOME/bin/dbstart ] then echo "Oracle startup: cannot start" exit fi case "$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" su - $ORA_OWNER -c "emctl start dbconsole" ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" su - $ORA_OWNER -c "emctl stop dbconsole" ;; 'restart') $0 stop $0 start ;; esac |
修改权限为 750
chmod 750 /etc/init.d/dbora |
设置服务自动启动
chkconfig --level 345 dbora on |
如果你遇上: cannot restore segment prot after reloc: Permission denied, 应该是 SELinux 的问题,可以考虑把它关闭。
四.添加自动备份服务
作为 root 用户创建一个叫做 /orabak/backup.sh 的文件,包括下面的内容:
#!/bin/bash
source /home/oracle/.bash_profile # 初始化 Oracle 数据库
rq=$(date +%Y%m%d) # 把当天日期赋予变量 rq
rm /orabak/backup/full_$rq.dmp # 清空旧文件
exp system/springland file=/orabak/backup/full_$rq.dmp log=/orabak/backup/full_$rq.log full=y compress=y |
修改权限为 750
chmod 750 /orabak/backup.sh |
设置 Cron 计划自动执行
nano /orabak/backup.txt 30 23 * * * /orabak/backup.sh crontab –u root /orabak/backup.txt crontab –l /etc/init.d/crond restart |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...
