一,这里主要使用oracle-validated包来简化安装oracle软件的一些配置。
二,安装10.2.0.1.0的oracle数据库软件。
三,升级10.2.0.2.0的oracle数据库软件。
一、配置本地yum环境
1.创建介质装载目录/media/disk:
[root@ocm1 ~]# mkdir /media/disk
2.插入OEL DVD光盘
3.装载目录:
[root@ocm1 ~]# mount /dev/cdrom /media/disk/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@ocm1 ~]#
4. 创建yum 配置文件:
[root@ocm1 ~]# cd /etc/yum.repos.d/
[root@ocm1 yum.repos.d]# ll
total 0
[root@ocm1 yum.repos.d]# vi public-yum-el5.repo
[oel5]
name=Oracle Liunx server 5.4 i386 dvd
baseurl=file:///media/disk/Server/
gpgcheck=0
enabled=1
[root@ocm1 yum.repos.d]# cat public-yum-el5.repo
[oel5]
name=Oracle Liunx server 5.4 i386 dvd
baseurl=file:///media/disk/Server/
gpgcheck=0
enabled=1
二、安装oracle-validated软件包
5.正式安装oracle-validated软件包环境,使用yum install oracle-validated 命令:
使用oracle-validated包来配置oracle搭建所需的系统环境。
这个是oracle linux特有的包,减少大家在搭建oracle时安装各种系统包,调整系统参数,建用户和组等。
这个是oracle linux特有的包,减少大家在搭建oracle时安装各种系统包,调整系统参数,建用户和组等。
[root@ocm1 yum.repos.d]# yum install oracle-validated
Loaded plugins: security
oel5 | 1.1 kB 00:00
oel5/primary | 795 kB 00:00
oel5 2278/2278
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracle-validated.i386 0:1.0.0-18.el5 set to be updated
--> Processing Dependency: compat-gcc-34 for package: oracle-validated
--> Processing Dependency: libXp for package: oracle-validated
--> Processing Dependency: elfutils-libelf-devel for package: oracle-validated
--> Processing Dependency: libstdc++-devel for package: oracle-validated
--> Processing Dependency: libaio-devel for package: oracle-validated
--> Processing Dependency: gdb for package: oracle-validated
--> Processing Dependency: glibc-devel for package: oracle-validated
--> Processing Dependency: sysstat for package: oracle-validated
--> Processing Dependency: unixODBC for package: oracle-validated
--> Processing Dependency: kernel-headers for package: oracle-validated
--> Processing Dependency: glibc-headers for package: oracle-validated
--> Processing Dependency: unixODBC-devel for package: oracle-validated
--> Processing Dependency: gcc-c++ for package: oracle-validated
--> Processing Dependency: gcc for package: oracle-validated
--> Processing Dependency: compat-db for package: oracle-validated
--> Processing Dependency: compat-gcc-34-c++ for package: oracle-validated
--> Running transaction check
---> Package compat-db.i386 0:4.2.52-5.1 set to be updated
---> Package compat-gcc-34.i386 0:3.4.6-4 set to be updated
---> Package compat-gcc-34-c++.i386 0:3.4.6-4 set to be updated
---> Package elfutils-libelf-devel.i386 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libelf-devel-static-i386 = 0.137-3.el5 for package: elfutils-libelf-devel
---> Package gcc.i386 0:4.1.2-46.el5 set to be updated
--> Processing Dependency: libgomp >= 4.1.2-46.el5 for package: gcc
---> Package gcc-c++.i386 0:4.1.2-46.el5 set to be updated
---> Package gdb.i386 0:6.8-37.el5 set to be updated
---> Package glibc-devel.i386 0:2.5-42 set to be updated
---> Package glibc-headers.i386 0:2.5-42 set to be updated
---> Package kernel-headers.i386 0:2.6.18-164.el5 set to be updated
---> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
---> Package libaio-devel.i386 0:0.3.106-3.2 set to be updated
---> Package libstdc++-devel.i386 0:4.1.2-46.el5 set to be updated
oel5/filelists | 2.3 MB 00:00
---> Package sysstat.i386 0:7.0.2-3.el5 set to be updated
---> Package unixODBC.i386 0:2.2.11-7.1 set to be updated
---> Package unixODBC-devel.i386 0:2.2.11-7.1 set to be updated
--> Running transaction check
---> Package elfutils-libelf-devel-static.i386 0:0.137-3.el5 set to be updated
---> Package libgomp.i386 0:4.4.0-6.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
oracle-validated i386 1.0.0-18.el5 oel5 15 k
Installing for dependencies:
compat-db i386 4.2.52-5.1 oel5 1.7 M
compat-gcc-34 i386 3.4.6-4 oel5 4.1 M
compat-gcc-34-c++ i386 3.4.6-4 oel5 11 M
elfutils-libelf-devel i386 0.137-3.el5 oel5 24 k
elfutils-libelf-devel-static i386 0.137-3.el5 oel5 66 k
gcc i386 4.1.2-46.el5 oel5 5.2 M
gcc-c++ i386 4.1.2-46.el5 oel5 3.4 M
gdb i386 6.8-37.el5 oel5 3.4 M
glibc-devel i386 2.5-42 oel5 2.0 M
glibc-headers i386 2.5-42 oel5 614 k
kernel-headers i386 2.6.18-164.el5 oel5 1.0 M
libXp i386 1.0.0-8.1.el5 oel5 22 k
libaio-devel i386 0.3.106-3.2 oel5 11 k
libgomp i386 4.4.0-6.el5 oel5 70 k
libstdc++-devel i386 4.1.2-46.el5 oel5 2.9 M
sysstat i386 7.0.2-3.el5 oel5 170 k
unixODBC i386 2.2.11-7.1 oel5 830 k
unixODBC-devel i386 2.2.11-7.1 oel5 743 k
Transaction Summary
===============================================================================================
Install 19 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 37 M
Is this ok [y/N]: y
Downloading Packages:
-----------------------------------------------------------------------------------------------
Total 2.2 GB/s | 37 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel-headers 1/19
Installing : glibc-headers 2/19
Installing : glibc-devel 3/19
Installing : libstdc++-devel 4/19
Installing : compat-gcc-34 5/19
Installing : unixODBC 6/19
Installing : compat-gcc-34-c++ 7/19
Installing : libXp 8/19
Installing : compat-db 9/19
Installing : sysstat 10/19
Installing : libgomp 11/19
Installing : gcc 12/19
Installing : gcc-c++ 13/19
Installing : gdb 14/19
Installing : unixODBC-devel 15/19
Installing : libaio-devel 16/19
Installing : elfutils-libelf-devel 17/19
Installing : elfutils-libelf-devel-static 18/19
Installing : oracle-validated 19/19
Installed:
oracle-validated.i386 0:1.0.0-18.el5
Dependency Installed:
compat-db.i386 0:4.2.52-5.1 compat-gcc-34.i386 0:3.4.6-4
compat-gcc-34-c++.i386 0:3.4.6-4 elfutils-libelf-devel.i386 0:0.137-3.el5
elfutils-libelf-devel-static.i386 0:0.137-3.el5 gcc.i386 0:4.1.2-46.el5
gcc-c++.i386 0:4.1.2-46.el5 gdb.i386 0:6.8-37.el5
glibc-devel.i386 0:2.5-42 glibc-headers.i386 0:2.5-42
kernel-headers.i386 0:2.6.18-164.el5 libXp.i386 0:1.0.0-8.1.el5
libaio-devel.i386 0:0.3.106-3.2 libgomp.i386 0:4.4.0-6.el5
libstdc++-devel.i386 0:4.1.2-46.el5 sysstat.i386 0:7.0.2-3.el5
unixODBC.i386 0:2.2.11-7.1 unixODBC-devel.i386 0:2.2.11-7.1
Complete!
6.查看/etc/sysctl.conf
[root@ocm1 yum.repos.d]# cat /etc/sysctl.conf
# Kernel sysctl configuration file for Oracle Enterprise Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1
# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 8192
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 1073741824
fs.file-max = 327679
kernel.msgmni = 2878
kernel.sem = 250 32000 100 142
kernel.shmmni = 4096
net.core.rmem_default = 262144
# For 11g recommended value for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# For 10g uncomment the following line, comment other entries for this parameter and re-run sysctl -p
# net.core.rmem_max=2097152
net.core.wmem_default = 262144
net.core.wmem_max = 262144
fs.aio-max-nr = 3145728
net.ipv4.ip_local_port_range = 1024 65000
[root@ocm1 yum.repos.d]#
7.查看/etc/security/limits.conf
[root@ocm1 yum.repos.d]# cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#<domain> <type> <item> <value>
#Where:
#<domain> can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to
# - rtprio - max realtime priority
#<domain> <type> <item> <value>
#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
# End of file
oracle soft nofile 131072
oracle hard nofile 131072
oracle soft nproc 131072
oracle hard nproc 131072
oracle soft core unlimited
oracle hard core unlimited
oracle soft memlock 3500000
oracle hard memlock 3500000
# Recommended stack hard limit 32MB for oracle installations
# oracle hard stack 32768
[root@ocm1 yum.repos.d]#
8.查看环境变量,这里需要自己配置
[root@ocm1 yum.repos.d]# cat /home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
[root@ocm1 yum.repos.d]#
三、安装数据库软件
9.建立/u01目录,并更改其目录的属组
[root@ocm1 yum.repos.d]# mkdir /u01
[root@ocm1 yum.repos.d]# chown -R oracle:oinstall /u01
10.更改oracle用户的密码
[root@ocm1 yum.repos.d]# id oracle
uid=500(oracle) gid=501(oinstall) groups=501(oinstall),500(dba)
[root@ocm1 yum.repos.d]# 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@ocm1 yum.repos.d]#
11.上传oracle安装包,解压,移动到/u01目录。(我这里使用Xmanager4的Xftp来上传的)
[root@ocm1 media]# unzip 10201_database_linux32.zip
[root@ocm1 media]# mv database/ /u01
[root@ocm1 media]# cd /u01/
[root@ocm1 u01]# ll
total 4
drwxr-xr-x 6 root root 4096 Jul 3 2005 database
[root@ocm1 u01]# chown -R oracle:oinstall database/
[root@ocm1 u01]# ll
total 4
drwxr-xr-x 6 oracle oinstall 4096 Jul 3 2005 database
12.配置oracle用户的环境变量
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$ORACLE_HOME/bin:$PATH
13.启动Xmanager4-Passive,以便在本机以图形界面安装oracle
本机ip地址是192.168.1.104
[root@ocm1 ~]# xhost+
-bash: xhost+: command not found
[root@ocm1 ~]# export DISPLAY=192.168.1.104:0.0
[root@ocm1 ~]# su - oracle
[oracle@ocm1 ~]$ cd /u01/database/
[oracle@ocm1 database]$ ll
total 28
drwxr-xr-x 9 oracle oinstall 4096 Jul 3 2005 doc
drwxr-xr-x 5 oracle oinstall 4096 Jul 3 2005 install
drwxr-xr-x 2 oracle oinstall 4096 Jul 3 2005 response
-rwxr-xr-x 1 oracle oinstall 1327 Jul 3 2005 runInstaller
drwxr-xr-x 9 oracle oinstall 4096 Jul 3 2005 stage
-rwxr-xr-x 1 oracle oinstall 5213 Jul 3 2005 welcome.html
[oracle@ocm1 database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking installer requirements...
Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
Passed
All installer requirements met.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-04-12_04-16-52PM. Please wait ...[oracle@ocm1 database]$
1.安装的第一个界面,选择“Advanced Installation”。
2.之前配置环境变量后,这里默认,点击“Next”。
3.选择企业版,“Enterprise Edition”。
4.自动带出设置的环境变量,默认,“Next”。
5.先决条件检查,全通过,点击“Next”。
6.这里选择只安装数据库软件,“Install database Software only”。因为之后要手动创建一个PROD的数据库。
7.显示的摘要信息,默认,点击“Install”。
8.安装过程中,会弹出如下,在root用户下运行以下两个脚本。
[root@ocm1 ~]# /u01/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
[root@ocm1 ~]# /u01/app/oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_1
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@ocm1 ~]#
9.oracle软件安装完毕。
[oracle@ocm1 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 12 20:52:05 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
四、升级数据库软件
14. 这里安装是10.2.0.1.0的oracle软件,而考试的环境是10.2.0.2.0,所有这里我升级了下。
打补丁,升级为10.2.0.2
[root@ocm1 media]# unzip p4547817_10202_LINUX.zip
[root@ocm1 media]# mv Disk1/ /u01/
[root@ocm1 media]# cd /u01/
[root@ocm1 u01]# ll
total 12
drwxrwx--- 3 oracle oinstall 4096 Apr 12 16:17 app
drwxr-xr-x 6 oracle oinstall 4096 Jul 3 2005 database
drwxr-xr-x 5 root root 4096 Feb 25 2006 Disk1
[root@ocm1 u01]# chown -R oracle:oinstall Disk1/
[root@ocm1 u01]# ll
total 12
drwxrwx--- 3 oracle oinstall 4096 Apr 12 16:17 app
drwxr-xr-x 6 oracle oinstall 4096 Jul 3 2005 database
drwxr-xr-x 5 oracle oinstall 4096 Feb 25 2006 Disk1
[root@ocm1 u01]#
[root@ocm1 u01]# su - oracle
[oracle@ocm1 ~]$ cd /u01/Disk1/
[oracle@ocm1 Disk1]$ ll
total 472
-rw-r--r-- 1 oracle oinstall 343141 Feb 25 2006 10202_buglist.htm
drwxr-xr-x 4 oracle oinstall 4096 Feb 6 2006 install
-rw-r--r-- 1 oracle oinstall 110645 Feb 25 2006 patchnote.htm
drwxr-xr-x 2 oracle oinstall 4096 Feb 6 2006 response
-rwxr-xr-x 1 oracle oinstall 1430 Feb 6 2006 runInstaller
drwxr-xr-x 9 oracle oinstall 4096 Feb 25 2006 stage
[oracle@ocm1 Disk1]$ ./runInstaller
Starting Oracle Universal Installer...
Checking installer requirements...
Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
Passed
All installer requirements met.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-04-12_08-57-24PM. Please wait ...[oracle@ocm1 Disk1]$ Oracle Universal Installer, Version 10.2.0.2.0 Production
Copyright (C) 1999, 2006, Oracle. All rights reserved.
1. 欢迎界面,默认,点击“Next”。
2.默认,注意,Name和Path和安装10.2.0.1.0一致。
3.摘要,默认,点击“Install”。
4.开始安装。
#############################################################################################################
安装过程中,出现以下错误是因为我在一个窗口中使用sqlplus连接了oracle数据库,"exit"退出后,点击“Retry”即可。
[oracle@ocm1 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 12 20:52:05 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> exit
Bus error
[oracle@ocm1 ~]$
#################################################################################################################
5.弹出需要运行的脚本,在root用户下执行脚本。
[root@ocm1 ~]# /u01/app/oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
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@ocm1 ~]#
6.安装成功,再次使用sqlplus登录,即会看见是10.2.0.2.0的oracle的版本。
[oracle@ocm1 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.2.0 - Production on Sat Apr 12 21:38:52 2014
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL>