el*?
[root@localhost Desktop]# uname -a
Linux localhost.localdomain 2.6.39-400.17.1.el6uek.x86_64 #1
SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
注:el6系统上安装oracle 10g,版本至少要升级到10.2.0.4以上
一. 安装oracle10g
1.安装系统、网络配置及软件补丁包
1).安装系统
OracleLinux-R6-U4-Server-x86_64-dvd.iso
2).网络配置
vim /etc/hosts => 192.168.137.7 wyzc.com wyzc # 设置 IP 主机名全称 主机名简写
保留hosts文件里的127.0.0.1行为默认值,注意该文件对于Other组有读权限。
[root@localhost Desktop]# hostname wyzc.com
[root@localhost Desktop]# hostname
wyzc.com
配置yum源
虚拟机挂载rhel7的镜像文件,这里以Vmware为例,虚拟机->可移动设备-》CD/DVD(SATA)->设置,然后“连接”刚挂载的镜像文件。
cd /etc/yum.repos.d/
yum-config-manager --add="file:///mnt"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-*
yum repolist
# enabled=1/0 当某个软件仓库被配置成enabled=0时,yum在安装或升级软件包时不会将该仓库做为软件包提供源。使用这个选项,可以启用或禁用软件仓库。
3).软件补丁包
yum install oracle-rdbms-* -y
查看:
[root@wyzc ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
[root@wyzc ~]# passwd oracle =>密码改为oracle
[root@wyzc ~]# vi /etc/sysctl.conf #内核参数已改
.................
\# oracle-rdbms-server-12cR1-preinstall setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
\# oracle-rdbms-server-12cR1-preinstall setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
\# oracle-rdbms-server-12cR1-preinstall setting for fs.aio-max-nr
is 1048576
fs.aio-max-nr = 1048576
\# oracle-rdbms-server-12cR1-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
# 此为11g/12c安装配置参数。如果安装10g,将两者分别改为1024和65000
[root@wyzc ~]# vim /etc/security/limits.conf # oracle资源限制也改好了
4). 配置安装目录等
[root@wyzc ~]# mkdir /u01 # oracle安装目录
[root@wyzc ~]# chown -R oracle:oinstall /u01
[root@wyzc ~]# 10G --> /u01/oracle/10g^C
[root@wyzc ~]# 11g --> /u01/oracle/11g^C
[root@wyzc ~]# 12c --> /u01/oracle/12c^C
[root@wyzc ~]# grid --> /u01/grid/12c 只能装一套grid产品
用户与组
groupadd -g 110 oinstall
groupadd -g 111 dba
groupadd -g 112 asmadmin
groupadd -g 114 asmdba
groupadd -g 115 asmoper
useradd -u 110 -g oinstall -G dba,asmdba oracle
passwd oracle
useradd -u 111 -g oinstall -G dba,asmdba,asmadmin,asmoper grid
passwd grid
若用了grid,就需要设置以下变量:
echo "
export ORACLE_BASE=/u01/oracle
export DB_HOME=/u01/oracle/11g
export ORACLE_HOME=$DB_HOME
export ORACLE_SID=wyzc10g
export PATH=$ORACLE_HOME/bin:$PATH
">>
.bash_profile
目录权限:
[root@wyzc /]# mkdir -p /u01/oracle/11g
[root@wyzc /]# mkdir -p /u01/grid/11g
[root@wyzc ~]# chown -R oracle.oinstall /u01/oracle
[root@wyzc ~]# chown -R grid.oinstall /u01/grid
[root@wyzc ~]# mkdir /u01/oralnventory
[root@wyzc ~]# setfacl -R -d -m u:oracle:rw /u01/oralnventory
[root@wyzc ~]# setfacl -R -d -m u:grid:rw /u01/oralnventory
2. 安装oracle10g 10.2.0.1
[root@wyzc /]# umount /dev/cdrom
#虚拟机挂载oracle软件镜像10.2.0.5.iso
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@wyzc /]# ls /mnt
10201_clusterware_linux32.zip
oracle-rdbms-server-11gR2-preinstall-1.0-3.el6.x86_64.rpm
10201_clusterware_linux_x86_64.cpio.gz
# 上面为64位 oracle 10g 10.2.0.1安装介质
oracle-validated-1.1.0-14.el5.src.rpm
10201_database_linux32.zip
oracle-validated-1.1.0-14.el5.x86_64.rpm
10201_database_linux_x86_64.cpio.gz
oracle-validated-1.1.0-14.el6.src.rpm
55-openiscsi.rules
oracle-validated-1.1.0-14.el6.x86_64.rpm
asm-el5.4-64bit
oracle-validated-1.1.0-14.ol6.src.rpm
asm-rpm
oracle-validated-1.1.0-14.ol6.x86_64.rpm
el6-isan-udev.txt
p8202632_10205_Linux-x86-64.zip
\# 上面为64位 oracle10g 10.2.0.5 升级安装介质
iscsidev.sh
p8202632_10205_LINUX.zip
jdk-6u20-linux-i586.bin
p8350262_10205_Generic.zip
oracle-rdbms-server-11gR2-preinstall-1.0-3.el6.src.rpm
updba-oracle-install-10.2.0.5-el5.noarch.rpm
[root@wyzc /]# zcat /mnt/10201_database_linux_x86_64.cpio.gz | cpio -idmv
[root@wyzc /]# xhost +
access control disabled, clients can connect from any host
[root@wyzc /]# su - oracle
[oracle@wyzc ~]$ cd database/
[oracle@wyzc database]$ ls
doc install response runInstaller stage welcome.html
[oracle@wyzc database]$ ./runInstaller
./runInstaller: /home/oracle/database/install/.oui: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[root@wyzc ~]# umount /dev/cdrom
\#虚拟机挂载下载的系统镜像文件OracleLinux-R6-U4-Server-x86_64-dvd.iso
[root@wyzc /]# mount /dev/cdrom /media
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@wyzc /]# yum -y install ld_linux.*
Loaded plugins: refresh-packagekit, security
Setting up Install Process
No package ld_linux.* available.
Error: Nothing to do
[root@wyzc /]#
\#虚拟机挂载镜像文件11.2.0.3-64bit.iso
[root@wyzc ~]# umount /dev/cdrom
[root@wyzc ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@wyzc mnt]# cp rpm.txt /root
\#虚拟机挂载系统镜像文件OracleLinux-R6-U4-Server-x86_64-dvd.iso
[root@wyzc ~]# umount /mnt
[root@wyzc /]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@wyzc /]# yum install \`cat /root/rpm.txt\` # --skip-broken
[root@wyzc /]# ls /lib/ld-linux*
/lib/ld-linux.so.2
[root@wyzc /]# rpm -qf /lib/ld-linux.so.2
glibc-2.12-1.107.el6.i686
具体安装oracle过程中,可能会提示系统版本信息不通过,这是因为Oracle 10g只能安装在Linux 4以前的版本,
我们只需要把操作系统版本信息更改一下,把/etc/redhat-release里面的版本信息改下,改成4就好了。
比如:Red Hat Enterprise Linux AS release 6.4 # 把 6.4 改成 4.4 即可
[root@wyzc ~]# vim /etc/sysctl.conf
net.ipv4.ip_local_port_range = 1024(9000) 65500 # 这里把9000 改为 1024
[root@wyzc /]# sysctl -p #执行一下sysctl,让修改的参数生效
[root@wyzc ~]# /u01/oracle/10g/root.sh #执行后,会生成文件/etc/oralnst.loc
[root@wyzc ~]# /u01/oracle/10g/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/oracle/10g
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.
\# 执行完,会生成文件/etc/oratab和/etc/oracle-release
[root@wyzc ~]# ls /etc/oratab
/etc/oratab
[root@wyzc ~]# ls /etc/oracle-release
/etc/oracle-release
3. 升级oracle10g 10.2.0.1 -> 10.2.0.5
\# 虚拟机挂载10.2.0.5.iso镜像
[root@wyzc Desktop]# umount /dev/cdrom
[root@wyzc Desktop]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[oracle@wyzc ~]$ unzip /mnt/p8202632_10205_Linux-x86-64.zip
[oracle@wyzc ~]$ pwd
/home/oracle
[oracle@wyzc ~]$ cd Disk1/
[root@wyzc ~]# xhost +
access control disabled, clients can connect from any host
[oracle@wyzc Disk1]$ ./runInstaller
[root@wyzc ~]# /u01/oracle/10g/root.sh
4.设置环境变量
[root@wyzc Desktop]# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
[oracle@wyzc ~]$ vi .10g
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=/u01/oracle/10g
export ORACLE_SID=wyzc10g
export PATH=$ORACLE_HOME/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
[oracle@wyzc ~]$ . .10g
[oracle@wyzc ~]$ which netca
/u01/oracle/10g/bin/netca
[oracle@wyzc ~]$ which dbca
/u01/oracle/10g/bin/dbca
[oracle@wyzc ~]$ which sqlplus
/u01/oracle/10g/bin/sqlplus
[oracle@wyzc ~]$ netca
[oracle@wyzc ~]$ netmgr
[oracle@wyzc ~]$ lsnrctl stop #停止监听
[oracle@wyzc ~]$ lsnrctl start #启动监听
5.建库
[oracle@wyzc ~]$ dbca # 建库
提示上面错误,是因为没有打em补丁,暂时这里忽略。
[oracle@wyzc ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Feb 5 06:19:32 2018
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
SQL> select name from v$database;
NAME
---------
WYZC10G
SQL>
常见问题:
http://wyzc:5560/isqlplus 打不开:
1.用命令:netstat -an 查看端口5560是否打开
2.用isqlplusctl start 启动,然后即可打开http://wyzc:5560/isqlplus
6. 打em补丁
二. 安装oracle11g
1.安装 grid
\# 虚拟机挂载oracle11g 11.2.0.3.iso
[root@wyzc ~]# umount /dev/cdrom
[root@wyzc ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@wyzc ~]# cp /mnt/p10404530_112030_Linux-x86-64_3of7.zip /root
[root@wyzc /]# chmod 777 p10404530_112030_Linux-x86-64_3of7.zip
[root@wyzc /]# xhost +
[root@wyzc /]# mkdir /u01/grid/11g
[root@wyzc /]# chown oracle:oinstall /u01/grid/11g
[root@wyzc /]# chmod 755 /u01/grid/11g
[oracle@wyzc ~]$ unzip /p10404530_112030_Linux-x86-64_3of7.zip
[oracle@wyzc ~]$ cd grid
[oracle@wyzc ~]$ ./runIn...
[root@wyzc ~]# vi /etc/sysctl.conf
.................
net.ipv4.ip_local_port_range = 9000 65500
[root@wyzc /]# sysctl -p
[root@wyzc ~]# /u01/grid/11g/root.sh
[root@wyzc ~]# /u01/grid/11g/perl/bin/perl -I/u01/grid/11g/perl/lib
-I/u01/grid/11g/crs/install /u01/grid/11g/crs/install/roothas.pl
[root@wyzc ~]# ls /etc/init/oracle-ohasd.conf
[root@wyzc ~]# ls /etc/init.d/init.ohasd
[oracle@wyzc ~]$ cp .10g .grid11g
[oracle@wyzc ~]$ vi .grid11g
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=/u01/grid/11g
export PATH=$ORACLE_HOME/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin
:/sbin:/usr/local/bin:/usr/
bin:/bin:/root/bin
[oracle@wyzc ~]$ . .grid11g
[oracle@wyzc ~]$ netca
2.安装 database
\# 虚拟机挂载oracle11g 11.2.0.3-64bit.iso
[root@wyzc ~]# umount /dev/cdrom
[root@wyzc ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@wyzc ~]# cp /mnt/p10404530_112030_Linux-x86-64_1of7.zip
/mnt/p10404530_112030_Linux-x86-64_2of7.zip /
[root@wyzc ~]# chmod 777 /p10404530_112030_Linux-x86-64_*.zip
[root@wyzc ~]# xhost +
[oracle@wyzc ~]$ unzip /p10404530_112030_Linux-x86-64_1of7.zip ;
unzip /p13390677_112040_Linux-x86-64_2of7.zip
[oracle@wyzc ~]$ cd database
[oracle@wyzc ~]$ ./runIn...
[root@wyzc /]# /u01/oracle/11g/root.sh
[oracle@wyzc ~]$ cp .grid11g .db11g
[oracle@wyzc ~]$ vim .db11g
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=/u01/oracle/11g
export ORACLE_SID=wyzc11g
export PATH=$ORACLE_HOME/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:
/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
[oracle@wyzc ~]$ . .db11g
[oracle@wyzc ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Feb 8 22:26:07 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> select name from v$database;
NAME
---------
WYZC11G
SQL>
[oracle@wyzc ~]$ vim .bashrc
................................
alias 10g=". /home/oracle/.10g"
alias grid11g=". /home/oracle/.grid11g"
alias db11g=". /home/oracle/.db11g"
...............................
- em 启动
[root@wyzc ~]# su - oracle
[oracle@wyzc ~]$ 11g
[oracle@wyzc ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
Copyright (c) 1996, 2011 Oracle Corporation. All rights reserved.
https://wyzc.com:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ...... started.
------------------------------------------------------------------
Logs are generated in directory /u01/oracle/11g/wyzc.com_wyzc11g/sysman/lo
[root@wyzc Desktop]# firefox https://wyzc.com:5500/em/console/aboutApplication