CentOS 5.6 上安裝 Oracle 11g R2 單一實例資料庫詳解

來源:互聯網
上載者:User

一、硬體需求
1、檢查實體記憶體需求(>=256MB)
[root@centos ~]# grep MemTotal /proc/meminfo
MemTotal:      1554748 kB

2、檢查虛擬記憶體需求
RAM 1-2GB :swap 1.5*RAM
RAM 2-16GB : swap =RAM
RAM > 16GB : swap 16GB
[root@centos ~]# grep SwapTotal /proc/meminfo
SwapTotal:     2096472 kB

3、查看系統體系架構
[root@centos ~]# grep "model name" /proc/cpuinfo
model name      : Intel(R) Core(TM)2 Duo CPU     P7450  @ 2.13GHz

[root@centos ~]# uname -am
Linux centos 2.6.9-55.ELsmp #1 SMP Wed May 2 14:28:44 EDT 2007 i686 i686 i386 GNU/Linux

4、查看磁碟空間需求
/tmp 空間必須>=400MB
[root@centos ~]# df -m /tmp
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sda3                 1004        18       936   2% /tmp

如果不夠i全年共設定TMP和TMPDIR環境變數
必須至少存在 2.7GB 空閑空間用於安裝 Oracle 11g 軟體
[root@centos ~]# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sda1                 8069      2875      4785  38% /
none                       760         0       760   0% /dev/shm
/dev/sda3                 1004        18       936   2% /tmp
/dev/sda6                 5035        43      4737   1% /u01
/dev/sda5                 4031       723      3104  19% /u02
/dev/hdc                    57        57         0 100% /media/cdrecorder

二、軟體需求
2.1 作業系統版本需求
The following are the operating sytem requirements for Oracle Database 11g release 1:

Asianux 2 SP2

Asianux 3

Oracle Linux 4

Oracle Linux 5

Red Hat Enterprise Linux 4

Red Hat Enterprise Linux 5

SUSE Enterprise Linux 10

The following or later version of packages for Asianux 2, Oracle Linux 4, and Red Hat Enterprise Linux 4 should be installed:

binutils-2.15.92.0.2-18
compat-libstdc++-33.2.3-47.3
elfutils-libelf-0.97-5

elfutils-libelf-devel-0.97-5
glibc-2.3.4-2.19 
glibc-common-2.3.4-2.19
glibc-devel-2.3.4-2.19
glibc-headers-2.3.4-2.19
gcc-3.4.5-2
gcc-c++-3.4.5-2
libaio-devel-0.3.105-2
libaio-0.3.105-2
libgcc-3.4.5
libstdc++-3.4.5-2
libstdc++-devel-3.4.5-2
make-3.80-5
numactl-0.6.4.i386
sysstat-5.0.5

rpm -qa | grep binutils-2.17.50.0.6
rpm -qa | grep compat-libstdc++-33-3.2.3
rpm -qa | grep elfutils-libelf-0.125
rpm -qa | grep elfutils-libelf-devel-0.125
rpm -qa | grep elfutils-libelf-devel-static-0.125
rpm -qa | grep gcc-4.1.2
rpm -qa | grep gcc-c++-4.1.2
rpm -qa | grep glibc-2.5-24
rpm -qa | grep glibc-common-2.5
rpm -qa | grep glibc-devel-2.5
rpm -qa | grep ksh-20060214
rpm -qa | grep libaio-0.3.106

rpm -qa | grep libaio-devel-0.3.106 

rpm -qa | grep libgcc-4.1.2
rpm -qa | grep libgomp-4.1.2
rpm -qa | grep libstdc++-4.1.2 
rpm -qa | grep libstdc++-devel-4.1.2
rpm -qa | grep make-3.81

rpm -qa | grep sysstat-7.0.2

rpm -qa | grep elfutils-libelf-devel   1
rpm -qa | grep glibc 
rpm -qa | grep glibc-common
rpm -qa | grep glibc-devel 
rpm -qa | grep glibc-headers
rpm -qa | grep gcc
rpm -qa | grep gcc-c++
rpm -qa | grep libaio-devel  1
rpm -qa | grep libaio  1
rpm -qa | grep libgcc
rpm -qa | grep libstdc++
rpm -qa | grep libstdc++-devel
rpm -qa | grep make
rpm -qa | grep numactl
rpm -qa | grep sysstat 1

[root@centos ~]# rpm -qa | grep make
-----經檢查卻如下包-----
elfutils-libelf-devel-0.97-5
libaio-devel-0.3.105-2
libaio-0.3.105-2
sysstat

三、建立所需的作業系統組和使用者
The Oracle Inventory group (oinstall)
The Oracle database administrator group (dba)
The Oracle software owner (oracle)

1.To determine whether the oinstall group exists, enter the following command:
  # more /etc/oraInst.loc
  If the output of this command shows the oinstall group name, then the group already exists.

  If the oraInst.loc file exists, then the output from this command is similar to the following:

  inventory_loc=/u01/app/oraInventory
  inst_group=oinstall
  The inst_group parameter shows the name of the Oracle Inventory group, oinstall.

2.If necessary, enter the following commands to create the oinstall group:
  [root@centos u02]# groupadd oinstall
  [root@centos u02]# groupadd dba
  [root@centos u01]# groupadd oper

  [root@rac1 ~]# groupadd -g 500 oinstall
  [root@rac1 ~]# groupadd -g 501 dba
  [root@rac1 ~]# groupadd -g 502 oper

3.To determine whether the oracle user exists and belongs to the correct groups, enter the following command:
  [root@centos u02]# id oracle
  uid=500(oracle) gid=500(oracle) groups=500(oracle)
  [root@centos ~]# 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.
  
4.If necessary, complete one of the following actions:
  If the oracle user exists, but its primary group is not oinstall or it is not a member of the dba group, then enter the following command:

  # /usr/sbin/usermod -g oinstall -G dba oracle
  If the oracle user does not exist, enter the following command to create it:

  # /usr/sbin/useradd -g oinstall -G dba,oper oracle
  This command creates the oracle user and specifies oinstall as the primary group and dba as the secondary group.
  
  [root@centos u02]# usermod -g oinstall -G dba,oper oracle
  [root@ora11g ~]# useradd -g oinstall -G dba,oper -d /home/oracle -p oracle -u 500 oracle
  [root@centos u02]# id oracle
  uid=500(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)

四、建立安裝Oracle所需的目錄
4.1 查看當前系統上掛載的檔案系統資訊:
[root@centos u02]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             7.9G  2.9G  4.7G  38% /
none                  760M     0  760M   0% /dev/shm
/dev/sda3            1004M   18M  936M   2% /tmp
/dev/sda6             5.0G   43M  4.7G   1% /u01
/dev/sda5             4.0G  1.6G  2.2G  42% /u02
/dev/hdc               57M   57M     0 100% /media/cdrecorder

4.2 確定滿足安裝所需空間需求的檔案系統,然後在該檔案系統上建立如下目錄:
[root@centos u01]# mkdir -p /u01/app/oracle
[root@centos u01]# chmod -R 775 /u01
[root@centos u01]# chown -R oracle:oinstall /u01

五、配置Oracle 安裝使用者 shell 限制;
Add the following lines to the /etc/security/limits.conf file:

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536

六、配置系統核心參數
Using any text editor, create or edit the /etc/sysctl.conf file, and add or edit lines similar to the following:
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

[root@centos u01]# vi /etc/pam.d/login 
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so

配置系統網路設定 /etc/hosts
127.0.0.1       localhost.localdomain   localhost       ora11g
192.168.8.246   ora11g.oracle.com   ora11g

設定 Oracle 環境變數
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export LD_LIBARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_SID=prod
export PATH=$PATH:$ORACLE_HOME/bin
export DISPLAY=192.168.8.245:0.0 
或改為本地IP 位址

配置用於存放資料庫的 raw 裝置
1、添加 4 GB硬碟,查看添加的磁碟
[root@ora11g ~]# fdisk -l

Disk /dev/hda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1300    10442218+  83  Linux
/dev/hda2            1301        1580     2249100   82  Linux swap
/dev/hda3            1581        2610     8273475   83  Linux

Disk /dev/sda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sda doesn't contain a valid partition table

------------注意:這裡的新盤為 /dev/sda 是因為添加磁碟時使用的事 SCSI 控制器

2、建立物理卷
[root@ora11g ~]# pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created

3、建立卷組
[root@ora11g ~]# vgdisplay -v
    Finding all volume groups
[root@ora11g ~]# vgcreate -s 8m oradatavg /dev/sda
  Volume group "oradatavg" successfully created
[root@ora11g ~]# vgdisplay -v
    Finding all volume groups
    Finding volume group "oradatavg"
  --- Volume group ---
  VG Name               oradatavg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               3.99 GB
  PE Size               8.00 MB
  Total PE              511
  Alloc PE / Size       0 / 0   
  Free  PE / Size       511 / 3.99 GB
  VG UUID               JvP8bk-3OXP-cgIf-8IIZ-aqa4-Bols-yYDTeD
   
  --- Physical volumes ---
  PV Name               /dev/sda     
  PV UUID               WsxYUK-9VXo-4YLX-rAqT-lKuV-8iL3-RhqhSF
  PV Status             allocatable
  Total PE / Free PE    511 / 511

4、建立邏輯卷 oradata、fra、backup
[root@ora11g ~]# lvcreate -L 2000 -n oradata oradatavg
  Logical volume "oradata" created
[root@ora11g ~]# lvcreate -L 2000 -n orafra oradatavg
  Logical volume "orafra" created
[root@ora11g ~]# lvcreate -L 4000 -n backup oradatavg
  Logical volume "backup" created

[root@ora11g ~]# ls -l /dev/oradatavg|grep -v total
lrwxrwxrwx  1 root root 28 Aug 15 16:29 backup -> /dev/mapper/oradatavg-backup
lrwxrwxrwx  1 root root 29 Aug 15 16:28 oradata -> /dev/mapper/oradatavg-oradata
lrwxrwxrwx  1 root root 28 Aug 15 16:29 orafra -> /dev/mapper/oradatavg-orafra

[root@ora11g ~]# ls -l /dev/mapper |grep -v total
crw-------  1 root root  10, 63 Aug 15 16:17 control
brw-rw----  1 root disk 253,  2 Aug 15 16:29 oradatavg-backup
brw-rw----  1 root disk 253,  0 Aug 15 16:28 oradatavg-oradata
brw-rw----  1 root disk 253,  1 Aug 15 16:29 oradatavg-orafra

啟用卷組
[root@ora11g ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "oradatavg" using metadata type lvm2
[root@ora11g ~]# vgchange -a y oradatavg
  3 logical volume(s) in volume group "oradatavg" now active

將 raw 裝置映射到 lv
[root@ora11g ~]# ls -l /dev/mapper |grep -v total
crw-------  1 root root  10, 63 Aug 15 16:17 control
brw-rw----  1 root disk 253,  2 Aug 15 16:29 oradatavg-backup
brw-rw----  1 root disk 253,  0 Aug 15 16:28 oradatavg-oradata
brw-rw----  1 root disk 253,  1 Aug 15 16:29 oradatavg-orafra
[root@ora11g ~]# raw /dev/raw/raw1 253 0
/dev/raw/raw1:  bound to major 253, minor 0
[root@ora11g ~]# raw /dev/raw/raw2 253 1
/dev/raw/raw2:  bound to major 253, minor 1
[root@ora11g ~]# raw /dev/raw/raw3 253 2
/dev/raw/raw3:  bound to major 253, minor 2
[root@ora11g ~]# raw -qa | awk '{print $1,$5,$7}' | tr ':' ' ' | tr ',' ' ' >> /etc/sysconfig/rawdevices
[root@ora11g ~]# more /etc/sysconfig/rawdevices 
/dev/raw/raw1  253  0
/dev/raw/raw2  253  1
/dev/raw/raw3  253  2

------------將 oracle 使用者添加到disk組
[root@ora11g ~]# ll /dev/raw/
total 0
crw-rw----  1 root disk 162, 1 Aug 15 16:37 raw1
crw-rw----  1 root disk 162, 2 Aug 15 16:37 raw2
crw-rw----  1 root disk 162, 3 Aug 15 16:37 raw3

[root@ora11g ~]# usermod -g oinstall -G dba,oper,disk oracle
[root@ora11g ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),6(disk),501(dba),502(oper)
或修改 vi /etc/group 將oracle 使用者
disk:x:6:root,oracle

配置 ASM  步驟:
1、啟動 dbca ,選擇“配置 ASM 管理”
2、以 root 執行如下命令:
[root@ora11g ora11g]# /u01/app/oracle/product/11.1.0/db_1/bin/localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Cleaning up Network socket directories
Setting up Network socket directories
Adding to inittab 
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
Cluster Synchronization Services is active on these nodes. 
        ora11g
Cluster Synchronization Services is active on all the nodes. 
Oracle CSS service is installed and running under init(1M)

3、建立磁碟組
ORADATA /dev/raw/raw1
ORAFRA  /dev/raw/raw2
BACKUP  /dev/raw/raw3

4、ASM 配置完畢

建立資料庫
如果配置 OEM 的話,需要先配置listener,視窗會有提示

修改使用者密碼:
SYS
SYSTEM
DBSNMP
SYSMAN

選擇 common-managed files

轉載請註明出處及原文連結:

http://blog.csdn.net/xiangsir/article/details/8570422

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.