美文网首页
Oracle 11g安装文档

Oracle 11g安装文档

作者: 苏水的北 | 来源:发表于2021-08-08 21:41 被阅读0次
image.png
image.png
image.png

Oracle 11g 采用asm方式安装数据库:

一、database软件安装:

1、环境准备:关闭selinux iptables ip6tables NetworkManager yum源配置

1.1、关闭防火墙并不开机自启

[root@oracle ~]# service iptables stop
[root@oracle ~]# chkconfig  iptables off
[root@oracle ~]# service ip6tables stop
[root@oracle ~]# chkconfig  ip6tables off

1.2、永久关闭selinux

[root@oracle ~]#  cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

1.3、永久关闭NetworkManager

service NetworkManager stop

1.4、配置yum源:

[root@oracle ~]# vim /etc/yum.repos.d/rhel-source.repo
[aaa]
name=123123
enabled=1
gpgcheck=0
baseurl=file:///mnt
[root@oracle ~]# mount /dev/sr0 /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@oracle ~]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id                                    repo name                                  status
aaa                                        123123                                     3,690
repolist: 3,690

2、设置主机名、修改/etc/hosts,设置主机名和Ip的对应关系:

[root@oracle ~]# hostname oracle
[root@oracle ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.5   oracle
[root@oracle ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=oracle

3、安装oracle依赖的软件包:

yum -y install binutils-* compat-libstdc++-* compat-libstdc++-*.i686 elfutils-libelf* elfutils-libelf-devel* gcc-* gcc-c++-* glibc-* glibc-*.i686 glibc-common* glibc-devel* glibc-devel*.i686 glibc-headers* ksh* libaio* libaio*.i686 libaio* libaio*.i686 libgcc* libgcc*.i686 libstdc++* libstdc++*.i686 libstdc++-devel* make* sysstat* unixODBC* unixODBC*.i686 unixODBC-devel* unixODBC-devel*

4、建立用户和组:

groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 504 asmadmin
groupadd -g 506 asmdba
groupadd -g 507 asmoper
useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
useradd -u 502 -g oinstall -G dba,asmdba,asmadmin oracle

passwd grid
passwd oracle

5、创建基本目录:

image.png
5.1、创建grid目录结构 grid 软件相关路径 grid用户:
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory

mkdir -p /u01/app/grid      
chmod -R 775 /u01/app/grid
chown -R grid:oinstall /u01/app/grid

mkdir -p /u01/app/11.2.0/grid       
chown -R grid:oinstall /u01/app/11.2.0/grid
chmod -R 775 /u01/app/11.2.0/grid
5.2、创建oracle目录结构(创建的是database软件相关的路径):
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/cfgtoollogs
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
5.3、编写oracle用户的.bash_profile

oracle用户操作:

vim ~/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@oracle ~]$ source .bash_profile
5.4、grid用户操作:
vim ~/.bash_profile
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export PATH=$PATH:$ORACLE_HOME/bin
[grid@oracle ~]$ source .bash_profile

6、修改内核参数和limit:(但是在11g中数据库安装时可以自动修改,在这里我们先不手动修改)

7、上传软件并解压database软件包:

[oracle@oracle tmp]$ ll
-rw-r--r--. 1 oracle oinstall 1358454646 Apr  7 08:41 p10404530_112030_Linux-x86-64_1of7.zip
-rw-r--r--. 1 oracle oinstall 1142195302 Apr  7 08:42 p10404530_112030_Linux-x86-64_2of7.zip
-rw-r--r--. 1 oracle oinstall  979195792 Apr  7 08:43 p10404530_112030_Linux-x86-64_3of7.zip
[oracle@oracle tmp]$ unzip p10404530_112030_Linux-x86-64_1of7.zip
[oracle@oracle tmp]$ unzip p10404530_112030_Linux-x86-64_2of7.zip

8、用oracle用户安装database软件:

[oracle@oracle tmp]$ cd database/
[oracle@oracle database]$
[oracle@oracle database]$ ls
doc      readme.html  rpm           sshsetup  welcome.html
install  response     runInstaller  stage
[oracle@oracle database]$ ./runInstaller
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
[root@oracle ~]# /tmp/CVU_11.2.0.3.0_oracle/runfixup.sh
Response file being used is :/tmp/CVU_11.2.0.3.0_oracle/fixup.response
Enable file being used is :/tmp/CVU_11.2.0.3.0_oracle/fixup.enable
Log file location: /tmp/CVU_11.2.0.3.0_oracle/orarun.log
Setting Kernel Parameters...
The value for shmmni in response file is not greater than value of shmmni for current session. Hence not changing it.
The value for semmsl in response file is not greater than value of semmsl for current session. Hence not changing it.
The value for semmns in response file is not greater than value of semmns for current session. Hence not changing it.
The value for semmni in response file is not greater than value of semmni for current session. Hence not changing it.
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.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
uid=502(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),506(asmdba)
image.png
image.png
image.png
image.png

二、grid软件安装:

image.png

备注:软件安装过程中就涉及到asmdb配置--->+ASM实例

1、环境准备:

1.1、停机给这个虚拟机添加3块盘(只用2块):


image.png

1.2、fdisk查看一下:

[root@oracle ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b1a5d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        5222    41430016   8e  Linux LVM

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdd: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2、grid软件安装:

2.1、补一个包:
yum install -y compat* 
2.2、修改grid环境变量:
[grid@oracle ~]$ vim .bash_profile
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=+ASM
[grid@oracle ~]$ source  .bash_profile
2.3、准备两个字符设备,创建两个dg:

备注:需要两个dg:
griddg:存放asm信息
datadg:存放asmdb数据库文件

2.3.1、分区:

/dev/sdc 分两个分区
/dev/sdc1 --> raw1 --> griddg --> 存放asm管理信息
/dev/sdc2 --> raw2 --> datadg --> 具体数据库(asmdb)的数据库文件

[root@oracle ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa79114f8.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa79114f8

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): +1G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (133-652, default 133):
Using default value 133
Last cylinder, +cylinders or +size{K,M,G} (133-652, default 652):
Using default value 652

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

查看sdc分区情况:

[root@oracle ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b1a5d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        5222    41430016   8e  Linux LVM

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa79114f8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         132     1060258+  83  Linux
/dev/sdc2             133         652     4176900   83  Linux
2.3.2、root 用户映射设备:
[root@oracle ~]# vim /etc/udev/rules.d/60-raw.ru
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc2", RUN+="/bin/raw /dev/raw/raw2 %N"
KERNEL=="raw*",OWNER="grid",GROUP="asmadmin",MODE="0660"
[root@oracle ~]# start_udev
Starting udev:                                             [  OK  ]

查看是否映射成功:

[root@oracle ~]# cd /dev/raw
[root@oracle raw]# ll
total 0
crw-rw---- 1 grid asmadmin 162, 1 Apr  7 11:18 raw1
crw-rw---- 1 grid asmadmin 162, 2 Apr  7 11:18 raw2
crw-rw---- 1 grid asmadmin 162, 0 Apr  7 11:18 rawctl
2.4、使用grid用户安装grid 软件(安装完成grid后就有了griddg)
2.4.1、上传软件并解压缩:
[grid@oracle tmp]$ unzip p10404530_112030_Linux-x86-64_3of7.zip
[grid@oracle tmp]$ ll
drwxr-xr-x. 8 oracle oinstall      4096 Sep 22  2011 database
drwxr-xr-x  8 grid   oinstall      4096 Sep 22  2011 grid
-rw-r--r--. 1 oracle oinstall 979195792 Apr  7 08:43 p10404530_112030_Linux-x86-64_3of7.zip
2.4.2、安装grid软件:
[grid@oracle tmp]$ cd grid
[grid@oracle grid]$ ll
total 72
drwxr-xr-x  9 grid oinstall  4096 Sep 22  2011 doc
drwxr-xr-x  4 grid oinstall  4096 Sep 22  2011 install
-rwxr-xr-x  1 grid oinstall 28122 Sep 22  2011 readme.html
drwxr-xr-x  2 grid oinstall  4096 Sep 22  2011 response
drwxr-xr-x  2 grid oinstall  4096 Sep 22  2011 rpm
-rwxr-xr-x  1 grid oinstall  4878 Sep 22  2011 runcluvfy.sh
-rwxr-xr-x  1 grid oinstall  3227 Sep 22  2011 runInstaller
drwxr-xr-x  2 grid oinstall  4096 Sep 22  2011 sshsetup
drwxr-xr-x 14 grid oinstall  4096 Sep 22  2011 stage
-rwxr-xr-x  1 grid oinstall  4326 Sep  2  2011 welcome.html
[grid@oracle grid]$ ./runInstaller
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
[root@oracle ~]# /tmp/CVU_11.2.0.3.0_grid/runfixup.sh
Response file being used is :/tmp/CVU_11.2.0.3.0_grid/fixup.response
Enable file being used is :/tmp/CVU_11.2.0.3.0_grid/fixup.enable
Log file location: /tmp/CVU_11.2.0.3.0_grid/orarun.log
uid=501(grid) gid=501(oinstall) groups=501(oinstall),502(dba),504(asmadmin),506(asmdba),507(asmoper)
image.png
image.png
image.png
image.png
image.png

查看asm实例进程(证明asm实例安装完成):

[grid@oracle grid]$ ps -ef |grep asm
grid       8944      1  0 11:47 ?        00:00:00 asm_pmon_+ASM
grid       8946      1  0 11:47 ?        00:00:00 asm_psp0_+ASM
grid       8948      1  0 11:47 ?        00:00:00 asm_vktm_+ASM
grid       8952      1  0 11:47 ?        00:00:00 asm_gen0_+ASM
grid       8954      1  0 11:47 ?        00:00:00 asm_diag_+ASM
grid       8956      1  0 11:47 ?        00:00:00 asm_dia0_+ASM
grid       8958      1  0 11:47 ?        00:00:00 asm_mman_+ASM
grid       8960      1  0 11:47 ?        00:00:00 asm_dbw0_+ASM
grid       8962      1  0 11:47 ?        00:00:00 asm_lgwr_+ASM
grid       8964      1  0 11:47 ?        00:00:00 asm_ckpt_+ASM
grid       8966      1  0 11:47 ?        00:00:00 asm_smon_+ASM
grid       8968      1  0 11:47 ?        00:00:00 asm_rbal_+ASM
grid       8970      1  0 11:47 ?        00:00:00 asm_gmon_+ASM
grid       8972      1  0 11:47 ?        00:00:00 asm_mmon_+ASM
grid       8974      1  0 11:47 ?        00:00:00 asm_mmnl_+ASM
grid       9007   2756  0 11:48 pts/4    00:00:00 grep asm
2.5、dbca建库(需要使用dg存放数据库文件--->datadg)
2.5.1、准备datadg:
[grid@oracle ~]$ asmca
image.png
image.png
image.png
2.5.2、oracle用户dbca建库:
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png

一、文件系统建库:

1、创建数据目录以及格式化磁盘、挂载磁盘、给目录授权:
[root@oracle ~]# mkdir /oradata
[root@oracle ~]# mkfs.ext4 /dev/sdb
mke2fs 1.41.12 (17-May-2010)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@oracle ~]# mount /dev/sdb /oradata/
[root@oracle ~]# chown -R oracle: /oradata
[root@oracle ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   36G   11G   23G  32% /
tmpfs                         996M   72K  996M   1% /dev/shm
/dev/sda1                     485M   39M  421M   9% /boot
/dev/sdb                      5.0G  138M  4.6G   3% /oradata
2、dbca建库:
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
![image.png](https://img.haomeiwen.com/i17007217/
d1f44ec4d737ef82.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

相关文章

网友评论

      本文标题:Oracle 11g安装文档

      本文链接:https://www.haomeiwen.com/subject/spmgvltx.html