Home Database Mysql Tutorial Redhat Linux下Oracle 10g安装说明

Redhat Linux下Oracle 10g安装说明

Jun 07, 2016 pm 04:57 PM
oracle redhat

Redhat linux下oracle 10g 安装说明 (以下步骤是直接在服务器上的gnome下安装。) (以下代码转自互联网上的多篇文章,为了便于

RedHat linux下Oracle 10g 安装说明 (以下步骤是直接在服务器上的gnome下安装。)
(以下代码转自互联网上的多篇文章,为了便于学习,经过整理和完善。)
RHEL5 ()安装redhat5时要独立分配磁盘给SWAP,空间大小应该是内存大小*2
最好使用内存>1G的机器
系统检查命令:
检查内存情况
# grep MemTotal /proc/meminfo -内存大小
# grep SwapTotal /proc/meminfo --交换分区大小swap
/tmp分区
# df -k /tmp 要求/tmp 400MB
cpu信息
# grep "model name" /proc/cpuinfo
操作系统型号
# cat /etc/issue
内核型号
# uname -r
oracle 分64位和32位 因此 你的机器,rehat as5,oracle 应同样是64位 或32位
RHEL5 安装oracle10所应该注意的
1 .由于orcale10不支持 RHEL5 所以需要修改/etc/redhat_realease 将 Red Hat Enterprise Linux Server release 5 (Tikanga) 改为Red Hat Enterprise Linux Server release 4 (Tikanga)
2 .修改/etc/hosts 文件将127.0.0.1改为你的ip 否则网络检查通不过
3 .依次安装下面的包
rpm -q libXp openmotif compat libaio ---检查是否有安装
rpm -ivh libXp-1.0.0-8.i386.rpm
...
libXp-1.0.0-8.i386.rpm
openmotif22-2.2.3-18.i386.rpm
compat-db-4.2.52-5.1.i386.rpm
compat-gcc-34-3.4.6-4.i386.rpm
compat-gcc-34-c++-3.4.6-4.i386.rpm
compat-libstdc++-33-3.2.3-61.i386.rpm
libaio-0.3.106-3.2.i386.rpm
4 .因为中文有乱码所以设置用英文安装 export LC_ALL=en_US
5 .在安装过程中选择高级安装,并将数据库语言选中文 字符集选GBK的。
6.
RHEL5 上 安装 Oracle 10.2.0.1 步骤
以root的身份完成下面的工作:
修改内核参数
增加下面的内容到文件 /etc/sysctl.conf 中:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
附加说明:
编辑文件 /etc/sysctl.conf,修改以下项目,如果没有可以自己添加。
kernel.shmall = 2097152 # 可以使用的共享内存的总量。
kernel.shmmax = 2147483648 # 最大共享内存段大小。
kernel.shmmni = 4096 # 整个系统共享内存段的最大数目。
kernel.sem = 250 32000 100 128 # 每个信号对象集的最大信号对象数;系统范围内最大信号对象数;每个信号对象支持的最大操作数;系统范围内最大信号对象集数。
fs.file-max = 65536 # 系统中所允许的文件句柄最大数目。
net.ipv4.ip_local_port_range = 1024 65000 # 应用程序可使用的IPv4端口范围。
net.core.rmem_default = 1048576 # 套接字接收缓冲区大小的缺省值
net.core.rmem_max = 1048576 # 套接字接收缓冲区大小的最大值
net.core.wmem_default = 262144 # 套接字发送缓冲区大小的缺省值
net.core.wmem_max = 262144 # 套接字发送缓冲区大小的最大值
注:内核参数并非必须修改,可以根据自己实际情况而定。
运行下面的命令使得内核参数生效:
/sbin/sysctl -p
然后,应该检查一下上面的操作是否正确:
# /sbin/sysctl -a | grep sem
# /sbin/sysctl -a | grep shm
# /sbin/sysctl -a | grep file-max
# /sbin/sysctl -a | grep ip_local_port_range
增加下面的内容到文件 /etc/security/limits.conf 文件中:
soft nproc 2047
hard nproc 16384
soft nofile 1024
hard nofile 65536
增加下面的内容到文件 /etc/pam.d/login 中:
session required /lib/security/pam_limits.so
session required pam_limits.so
因为SELINUX对oracle有影响,所以把secure linux设成无效,编辑文件 /etc/selinux/config :
SELINUX=disabled
当然你也可以用图形界面下的工具 (系统 > 管理 > 安全级别和防火墙). 选择SELinux页面并且设为无效.
安装(以下安装命令没有执行,只是安装3列出的软件包即可)
安装下面的包:
# 从RedHat AS5 光盘1
cd /media/cdrom/Server
rpm -Uvh setarch-2* U为更新软件包。
rpm -Uvh make-3*
rpm -Uvh glibc-2*
rpm -Uvh libaio-0*
cd /
eject
# 从RedHat AS5 光盘2
cd /media/cdrom/Server
rpm -Uvh compat-libstdc++-33-3*
rpm -Uvh compat-gcc-34-3*
rpm -Uvh compat-gcc-34-c++-3*
rpm -Uvh gcc-4*
rpm -Uvh libXp-1*
cd /
eject
# 从RedHat AS5 光盘3
cd /media/cdrom/Server
rpm -Uvh openmotif-2*
rpm -Uvh compat-db-4*
cd /
eject
新增组和用户:
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
创建Oracle的安装目录,并把权限付给oracle用户:
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
登录到oracle 用户并且配置环境变量(增加下面的内容到文件 .bash_profile
# Oracle Settings
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=$PATH: $ORACLE_HOME/bin ; export PATH
如果本机有Xserver图形界面的话以下这段可以不写
DISPLAY=192.168.0.11:0,0; export DISPLAY
ORACLE_TERM=xterm; export ORACLE_TERM
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORAC LE_HOME/rdbms/jlib; export CLASSPATH
配置好后用 source .bash_profile 命令使配置生效 。
对 Bourne、Bash、Korn shell,用编辑器 qedit 在文件/etc/profile 中加入下面的行:(备注以下的命令添加后,会提示ulimit 出错:-bash: ulimit: pipe size: cannot modify limit: Invalid argument)
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
注释:$oracle_home 可以自己定;为效率有的人单独为oracle 分配磁盘空间 主目录自己定的情况下
现在终于可以安装Oracle了。
重新登录到oracle用户.
到刚才解压出来的目录用下面的命令,启动Oracle智能安装向导(Oracle Universal Installer ),就出现了图形界面,再按照提示一步一步安装:
./runInstaller
#如出现Xlib: connection to ":0.0″ refused by server错误,可以运行xhost + ,如果不是在本地安装,可能还需要指定DISPLAY=IP:0.0 & export DISPLAY
安装时根据说明操作即可,在选择字符集时,可选Unicode standard utf-8 al32utf8,并选择"Create database with sample schemas"; 另外在
Specify database schema passwords处,选择Use the same password for all the accounts(根据需要)
#如出现/usr/lib/libstdc++.so.5: No such file or directory错误,可以安装compat-libstdcxxx.rpm
查看以下三个.ora文件中的主机与端口
/u01/app/oracle/product/10.2.0/db_1/network/admin
listener.ora sqlnet.ora tnsnames.ora
安装快完成好的时候,会出现提示,必须以root 的身份执行两个脚本。
最后,单击完成按钮,完成安装。
结束安装
编辑 /etc/redhat-release 文件把RHEL的版本信息改回去:
Red Hat Enterprise Linux Server release 5 (Tikanga)
安装后要做的工作
3.1 Oracle系统初始化
用root用户登录,然后运行$ORACLE_HOME/root.sh进行Oracle的系统初始化工作,通常一路按回车用默认值即可。
3、登陆并启动数据库的操作。
检查:$oracle_home/ network/admin/listener.ora 的配置是否正确
[oracle@oracle oracle]$ lsnrctl start
[oracle@oracle oracle]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.0 - Production on Sat Mar 12 22:58:53 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> shutdown immediate 关闭数据库(OR "dbshut" command)
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup; 启动数据库
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
//以下脚本未做测试
4, dbstart脚本修改
数据库创建完成后,,修改vi /etc/oratab,把orcl:/opt/oracle/oracle/product/10g:N那一行最后的N改成Y,
然后执行dbstart启动数据库数据库可能无法启动,报告Can't find init file ...的错误,需要复制一个初始化文件:
cp /opt/oracle/admin/ge01/pfile/init.ora.* /opt/oracle/product/10.2.0/dbs/initge01.ora
重新执行dbstart就可以了。
修改vi /opt/oracle/product/10g/bin/dbstart中ORACLE_HOME_LISTNER=/opt/oracle/oracle/product/10g /
vi /etc/rc.local 加入下面一行 起动ORACLE ON system boot
/opt/oracel/product/10g/bin/dbstart
5. 编写启动脚本(OPTION)
为了方便管理,可以写一个启动脚本ora10g:
以root身份进入,编写以下脚本:
#!/bin/bash
#
# chkconfig: 2345 91 19
# description: starts the oracle listener and instance
status() {
pid=`ps -ef | grep ora_pmon | grep -v grep | awk '{print $8}'`
if [ "X$pid" = "X" ]
then
echo "oracle10g is not running."
exit 1
else
echo "oracle10g is running."
exit 0
fi
}
case "$1" in
start)
#startup the listener and instance
echo -n "oracle begin to startup: "
su - oracle -c "lsnrctl start"
su - oracle -c dbstart
echo "oracle10g started"
;;
stop)
# stop listener, apache and database
echo -n "oracle begin to shutdown:"
su - oracle -c "lsnrctl stop"
su - oracle -c dbshut
echo "oracle10g shutdowned"
;;
reload|restart)
$0 stop
$0 start
;;
'status')
status
;;
*)
echo "Usage: ora10g [start|stop|reload|restart]"
exit 1
esac
exit 0
存为ora10g后,然后
chmod a+x ora10g
ln -s /opt/oracle/product/10.2.0/bin/ora10g /etc/rc.d/init.d/
即可在以后以root身份运行/etc/rc.d/init.d/ora10g start |stop 来管oracle的启动和停止了。
如果要将这个脚本加入到系统中使其可开机运行,那么要运行以下命令:
chkconfig --level 345 ora10g on
或者可在/etc/rc.d/rc.local中加入如下:
su - oracle -c "lsnrctl start"
su - oracle -c "dbstart"
6, 关于数据库删除重新安装的问题:
把ORACLE安装目录删除及/etc/ora*.*删除就行了
#rm -f /etc/ora*.*
7.修改Oracle10g数据库字符集
SQL> connect sys/oracle as sysdba
SQL> startup mount
SQL> alter session set sql_trace=true;
Session altered.
SQL> alter system enable restricted session;
System altered.
SQL> alter system set job_queue_processes=0;
System altered.
SQL> alter system set aq_tm_processes=0;
System altered.
SQL> alter database open;
Database altered.
SQL> set linesize 120;
SQL> alter database character set zhs16gbk;
alter database character set zhs16gbk
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
SQL> ALTER DATABASE character set INTERNAL_USE zhs16gbk; # 使用INTERNAL_USE可以跳过超集的检查,ALTER DATABASE character set INTERNAL_USE
Database altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
SQL> select name,value$ from props$ where name like '%NLS%';
NLS_CHARACTERSET
ZHS16GBK
8. oracle database备份
(1)vi bachupDb.sh
#!/bin/sh
#oracle用户下
#crontab -e 增加 "35 4 * * * /home/oracle/dbbackup/backupDb.sh",保存后自动安装
#或echo "35 4 * * * /home/oracle/dbbackup/backupDb.sh" > backupDb.cron
#crontab backupDb.cron
#############
修改为本机数据库home目录
export ORACLE_HOME=/opt/oracle/product/10g
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
# 注意字符集必须和数据库的字符集一致,以避免字符集转化失败
export NLS_LANG=AMERICAN_AMERICA.zhs16gbk
125修改为要备份的oracle的ip地址的最后一段
dmpfile="`echo ~/`dbbackup/gedb_`date +%w`.dmp"
logfile="`echo ~/`dbbackup/gedb_`date +%w`.log"
if [ -w $dmpfile ]
then
echo "rm -f $dmpfile"
rm -f "$dmpfile"
fi
ip地址修改为要备份的oracle的主机地址
exp USERID=gedb/gedb@10.248.1.5/ge01 file=$dmpfile log=$logfile owner=gedb grants=y
(2)copy bachupDb.sh 到slave oracle srever 相应目录,
chown oracle.oinstall bachupDb.sh
chmod 744 bachupDb.sh
vi bachupDb.sh 以符合安装情况
(3)以oracle user role
crontab -e
35 4 * * * /home/oracle/dbbackup/backupDb.sh
9. restore oracle backup
su - oracle
imp USERID=gedb/gedb file=gedb_6.dmp log=implogfile commit=y grants=y full=y 附1 Oracle 10g对硬件环境的要求
物理内存
基本 - 512MB
推荐 - 1024MB
内存交换分区相对于物理内存的比例
物理内存1024MB~2048MB - 150%
物理内存2049MB~8192MB - 100%
物理内存大于8192MB - 75%
磁盘空间
/tmp目录所在的分区至少要有400MB空闲磁盘空间。
根据安装类型,安装Oracle服务器软件的分区至少要有1.5GB到3.5GB的空闲磁盘空间。
1.2GB磁盘空间用于数据库预配置文件系统存储(可选)
附2 Oracle 10g对软件环境的要求
操作系统
Red Hat Enterprise Linux AS/ES 3.0 (update 4 or later)
Red Hat Linux 4.0
SUSE Linux Enterprise Server 9.0 with SP 2 or later
Asianux 1.0
Asianux 2.0
软件包
X11相关的库 (软件包名视操作系统而定,故不一一列出)
gcc (版本至少为2.96-124)
make (版本至少为3.79)
binutils (版本至少为2.11)
openmotif (版本至少为2.1.30)
setarch (版本至少为1.3)
compat-db (版本至少为4.0.14.5)
compat-gcc (版本至少为7.3-2.96.122)
compat-gcc-c++ (版本至少为7.3-2.96.122)
compat-libstdc++ (版本至少为7.3-2.96.122)
compat-libstdc++-devel (版本至少为7.3-2.96.122)
sysstat (版本至少为5.0.5-1)
libaio (版本至少为0.3.103-3)
libaio-devel (版本至少为0.3.103-3)
4 结束语
现在Oracle 10g的安装已经完成,在任何一台电脑上装个Oracle客户端就可以对它进行管理了。
如果要卸载Oracle,只须运行
$./runInstaller -silent -deinstall -removeallfiles -removeAllPatches "REMOVE_HOMES={$ORACLE_HOME}" -responseFile

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How long will Oracle database logs be kept? How long will Oracle database logs be kept? May 10, 2024 am 03:27 AM

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

Function to calculate the number of days between two dates in oracle Function to calculate the number of days between two dates in oracle May 08, 2024 pm 07:45 PM

The function in Oracle to calculate the number of days between two dates is DATEDIFF(). The specific usage is as follows: Specify the time interval unit: interval (such as day, month, year) Specify two date values: date1 and date2DATEDIFF(interval, date1, date2) Return the difference in days

The order of the oracle database startup steps is The order of the oracle database startup steps is May 10, 2024 am 01:48 AM

The Oracle database startup sequence is: 1. Check the preconditions; 2. Start the listener; 3. Start the database instance; 4. Wait for the database to open; 5. Connect to the database; 6. Verify the database status; 7. Enable the service (if necessary ); 8. Test the connection.

How much memory does oracle require? How much memory does oracle require? May 10, 2024 am 04:12 AM

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

How to use interval in oracle How to use interval in oracle May 08, 2024 pm 07:54 PM

The INTERVAL data type in Oracle is used to represent time intervals. The syntax is INTERVAL <precision> <unit>. You can use addition, subtraction, multiplication and division operations to operate INTERVAL, which is suitable for scenarios such as storing time data and calculating date differences.

How to see the number of occurrences of a certain character in Oracle How to see the number of occurrences of a certain character in Oracle May 09, 2024 pm 09:33 PM

To find the number of occurrences of a character in Oracle, perform the following steps: Get the total length of a string; Get the length of the substring in which a character occurs; Count the number of occurrences of a character by subtracting the substring length from the total length.

How to replace string in oracle How to replace string in oracle May 08, 2024 pm 07:24 PM

The method of replacing strings in Oracle is to use the REPLACE function. The syntax of this function is: REPLACE(string, search_string, replace_string). Usage steps: 1. Identify the substring to be replaced; 2. Determine the new string to replace the substring; 3. Use the REPLACE function to replace. Advanced usage includes: multiple replacements, case sensitivity, special character replacement, etc.

Oracle database server hardware configuration requirements Oracle database server hardware configuration requirements May 10, 2024 am 04:00 AM

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

See all articles