OCP 11G 實驗環境安裝文檔 ( RedHat5.5 + Oracle11g )
RedHat5.5 linux下Oracle11g軟件安裝
一、配置虛擬機
為了創建和配置虛擬機,你需要添加硬件設備如磁盤和cpu,在你開始安裝之前,創建一個windows目錄作為存放虛擬機的目錄
目錄不一定是E:\盤,找一個自己磁盤空間比較大的硬盤就可以。
E:\>mkdir stu1(創建目錄)
雙擊桌面上的虛擬機工作站圖標以打開虛擬機
1. Press CTRL-N to create a new virtual machine.
2. New Virtual Machine Wizard:
a. Virtual machine configuration: Select Custom(advanced)
b. click Next to continue
3. Virtual Machine Hardware compatibility: Click on Next.
4. Select I will install the operating system later , Click on Next.
5. Select a Guest Operating System:
a. Guest operating system: Select Linux.
b. Version: Select Red Hat Enterprise Linux 5 64-bit
6. Name the Virtual Machine:
a. Virtual machine name: Enter “stu1”
b. Location: Enter “E:\stu1”
7. Processor Configuration:
a. Number of Processors: Select "1".
b. Number of cores per processor: Select "1".
c. Click on Next.
8. Memory for the Virtual Machine:
a. Memory: Select "2048 MB"
b. Click on Next
9. Network Type:
a. Network connection: Select Use network address translation(NAT)
10. Select I/O Controller Types:
a. I/O Controller types: Select LSI Logic(Recommended).
11. Select a Disk:
a. Disk: Select Create a new virtual disk.
12. Select a Disk Type:
a. Virtual Disk Type: Select SCSI (Recommended).
13. Specify Disk Capacity:
a. Maximum disk size(GB): Enter “30”
b. Deselect Allocate all disk space now. To save space, you do not have to allocate all the disk space now.
c.Select split virtual disk into multiple files
d.click on Next
14. Specify Disk File:
a. Disk file: Enter “stu1.vmdk.”
b. Click on Next
15. Ready to create virtul machine
a. Click on Finish.
二、安裝和配置64位的Red Hat linux 5.5
雙擊剛剛安裝好的虛擬機的CD/DVD,選擇右側的使用ISO文件,選擇rhel-server-5.5-x86_64-dvd安裝介質
- VMware workstation:
- Click on Power on this virtual machine.
- Hit Enter to install in graphical mode.
- Skip the media test and start the installation.
- Red Hat Enterprise Linux 5: Click on Next.
- Language Selection: <select your language preference>.
- Keyboard Configuration: U.S.English.
- installation Number: select entering installation Number
a.click on“skip”
- would you like to initialize this drive,erasing ALL DATA?
Click on YES
- Disk Partitioning Setup:create custom layout
- Disk Setup: Allocate disk space on /dev/sda drive by double-clicking on /dev/sda free space for the mount points (/) and swap space.
- Add Partition:
_ Mount Point: /
_ File System Type: ext3
_ Start Cylinder: 1
_ End Cylinder: 3394
_ File System Type: Swap
_ Start Cylinder: 3395
_ End Cylinder: 3916
11. Boot Loader Configuration: Select only the default /dev/sda1 and leave the rest unchecked.
12. Network Configuration:
a. Network Devices
_ Select and edit eth0
1. SelectEnable IPv4 support
2. De-selectEnable IPv6 support
3. Select Manual configuration
4. IP Address: Enter “192.168.1.6”
5. Netmask: Enter “255.255.255.0.”
6. click on OK
b. Hostname
_ Select manually and enter “stu1”
c. Miscellaneous Settings
_ Gateway:<optional>
_ Primary DNS: <optional>
_ Secondary DNS: <optional>
d. Click on Next
13. Error with data ,select continue
14. Time Zone Selection:<select your time zone>
15. Set Root Password: <enter your root password>
16. Select Customize now
17. Package Group Selection:
a.Desktop Environments
GONME Desktop Environment
b.Applications
Graphical Internet
Text-based internet
c.Development
Development Libraries
Development Tools
l Gcc44-4.4.0-6.el5.x86_64
l Gcc44-c++-4.4.0-6.el5.x86_64
GNOME Software Development
KDE Software Development
Legacy Software Development
X Software Development
l Openmotif-devel-2.3.1-2.el5_4.1.i386
l Xorg-x11-server-sdk-1.1.1-48.76.el5.x86_64
d.Servers
Legacy Network Server
Server Configuration Tools
e.Base System
Administration Tools
Base
Java
Legacty Software Support
l Compat-db-4.2.52-5.1.i386
OpenFabrics Enterprise Distribution
System Tools
l Hwbrowser-0.30-3.el5.noarch
l Sysstat-7.0.2-3.el5.x86_64
X Window System
f.Languages.
Chinese Support
18. About to Install: Click on Next.
19. congratulations,the installation is complete: Click on Reboot.
20. Welcome: Click on Forward
21. License Agreement: Select Yes, I agree to the License Agreement.
22. Firewall:select Disabled,when see the warning click Yes
23. SELinux :SELinux Setting,select Disabled,when warning click Yes
24. Kdump: click on forward
25. Date and Time: Set the date and time.
26. Set Up Software Updates :No I prefer to register at a later time
27. when you see the warning :No Thanks,I’ll connect later
28. Finish Updates Setup:click on Forward
29. Create User:Leave the entries blank and click on Forward
30. When you see the warning , select continue
31. Sound Card:click on Forward
32. Additional CDs: Click on Finish
33. When you see the warning , select Ok
Congratulations, you have just installed Red Hat Enterprise Linux on VMware Server!
34.使用ssh上傳並安裝unixODBC、unixODBC-devel和libaio-devel軟件包
[[email protected] pkg]# pwd
/root/pkg
[[email protected] pkg]# ls
libaio-devel-0.3.106-5.x86_64.rpm
unixODBC-2.2.11-7.1.x86_64.rpm
unixODBC-devel-2.2.11-7.1.x86_64.rpm
35.根據需要配置vmware tools工具
三、配置Linux系統環境和oracle用戶環境變量
對於Oracle軟件在Linux 5系統下的安裝,需要用戶提前在Linux系統下做一些配置,從而滿足安裝Oracle軟件的基本需求。
以下0、1、2、3、4步使用root用戶,第5和6步使用分別使用grid用戶和oracle用戶
0.要配置/etc/hosts 添加ip地址、主機,否則grid的netca配置的時候會報錯。
[[email protected] ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.6study
1.創建oracle用戶和組
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
passwd grid
passwd oracle
2.創建安裝grid軟件和oracle軟件的目錄,並授予相應的權限
mkdir -p /u01/app/oracle/product/11.2.0/db
mkdir -p /u01/app/grid/product/11.2.0/grid
chown -R oracle:oinstall /u01/app/
chown -R grid:oinstall /u01/app/grid
chmod -R 775 /u01/
3.配置系統文件和進程限制,配置內核參數
cat >> /etc/security/limits.conf <<EOF
#ORACLE SETTING
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
cat >>/etc/pam.d/login<<EOF
#ORACLE SETTING
session required pam_limits.so
EOF
cat >>/etc/sysctl.conf<<EOF
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
EOF
使配置的內核參數生效,使用sysctl -p命令
sysctl -p
4.關閉NTP服務和刪除NTP配置文件
grid時間同步所需要的設置
Network Time Protocol Setting
/sbin/service ntpd stop
chkconfig ntpd off
rm /etc/ntp.conf
or, mv /etc/ntp.conf to /etc/ntp.conf.org.
5.設置/etc/profile
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
6.用戶grid的環境變量的設置
grid 用戶配置文件 ORACLE_HOSTNAME請自行設置,這個配置使用grid用戶
#su - grid
$vi .bash_profile
export LD_ASSUME_KERNEL=2.6.18
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=study
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid
export ORACLE_SID=+ASM
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
umask 022
使用source命令是環境變量生效
source .bash_profile
7.用戶oracle的環境變量的設置
oracle用戶配置文件 ORACLE_HOSTNAME請自行設置,這個配置使用oacle用戶
#su - oracle
$vi .bash_profile
# Oracle Settings oracle
export LD_ASSUME_KERNEL=2.6.18
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=study
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db
export ORACLE_SID=db01
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
使用source使環境變量立即生效
source .bash_profile
第四步、安裝和配置ASM
關閉虛擬機,添加硬盤sdb、sdc和sdd,大小都是3G,啟動虛擬機,使用fdisk對添加的硬盤分區,使用wincp上傳相應內核的asmlib軟件到服務器,並安裝
[[email protected] asm]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, d efault 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391):
Using default value 391
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] asm]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391):
Using default value 391
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] asm]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391):
Using default value 391
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] asm]# ll
oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm
oracleasm-support-2.1.7-1.el5.x86_64.rpm
[[email protected] asm]# rpm -Uvh *.rpm
warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ################################## [100%]
1:oracleasm-support ################################## [ 33%]
2:oracleasm-2.6.18-194.el################################## [ 67%]
3:oracleasmlib ################################## [100%]
[[email protected] asm]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets (‘[]‘). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
[[email protected] asm]#
[[email protected] asm]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk: [ OK ]
[[email protected] asm]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "VOL2" as an AcSM disk: [ OK ]
[[email protected] asm]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "VOL3" as an ASM disk: [ OK ]
[[email protected] asm]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[[email protected] asm]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
第五步、安裝grid軟件
用ssh上傳grid軟件(p10404530_112030_Linux-x86-64_3of7)到grid用戶的主目錄/home/grid,並使用unzip命令解壓
$unzip p10404530_112030_Linux-x86-64_3of7
[[email protected] ~]$ ls
grid
選擇skip software updates,選next繼續
選擇configure oracle grid infrastructure for a standalone server,選擇next繼續
選擇next,繼續
選擇紅圈部分內容,選next繼續
選擇use same password for these accounts,口令長度要求8位以上,有大寫和小寫字符,包含數字
選擇next,繼續
確認紅圈部分目錄正確,點擊next繼續
選擇next繼續
選擇install開始安裝
等待安裝...........,當看到下面的界面時,不要著急點OK,單獨打開一個終端,使用root用戶執行窗口中提示的兩個腳本,執行之後點擊OK
[[email protected] ~]# cd /u01/app/oraInventory/
[[email protected] oraInventory]# ./orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[[email protected] oraInventory]# cd /u01/app/grid/product/11.2.0/grid
[[email protected] grid]# ./root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/grid/product/11.2.0/grid
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 script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user ‘grid‘, privgrp ‘oinstall‘..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user ‘root‘, privgrp ‘root‘..
Operation successful.
CRS-4664: Node easthome successfully pinned.
Adding Clusterware entries to inittab
easthome 2013/04/06 15:56:22 /u01/app/grid/product/11.2.0/grid/cdata/easthome/backup_20130406_155622.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
但看到這個界面的時候,表示安裝結束,點擊close退出安裝。
第六步、添加磁盤組fradata
使用ASMCA工具添加新的磁盤組fradata,用於將來數據庫歸檔目錄
選擇create,創建磁盤組
按照紅圈中的選擇,然後點OK
看到這個界面,表示磁盤組創建成功!
選擇exit退出
第七部、安裝oracle軟件
用ssh上傳oracle安裝軟件(p10404530_112030_Linux-x86-64_1of7、p10404530_112030_Linux-x86-64_2of7)到oracle用戶的主目錄/home/oracle,並使用unzip命令解壓
$unzip p10404530_112030_Linux-x86-64_1of7
$unzip p10404530_112030_Linux-x86-64_2of7
[[email protected] ~]$ ls
database
勾掉紅圈部分,當彈出小窗口時,選擇yes,點擊next繼續
選擇skip software updates,點擊next繼續
選擇紅圈選項,點擊next繼續
選擇紅圈部分選項,點擊next繼續
選擇next繼續
選擇紅圈部分,點擊next繼續
確認紅圈中顯示的目錄正確,點擊next繼續
選擇next繼續
確認沒有檢查失敗選項,選擇install開始安裝
當看到下面的界面時,不要著急點OK,單獨打開一個終端,使用root用戶執行窗口中提示的腳本,執行之後點擊OK
軟件安裝完成,點擊close退出。
第八步、使用dbca創建數據庫
點擊next繼續
選擇紅圈部分,點擊next繼續
選擇紅圈選項,點擊next繼續
填入數據庫名稱,要求小於8個字節,點擊next繼續
選擇next繼續
輸入用戶口令,點擊next繼續
選擇紅圈部分中選項,點擊next繼續
選擇紅圈選項,點擊next繼續
選中紅圈中選線,點擊next繼續
設置合適的內存大小和字符集,選擇next繼續
選擇next繼續
點擊finish開始安裝
選擇exit退出安裝!數據庫安裝完成。
OCP 11G 實驗環境安裝文檔 ( RedHat5.5 + Oracle11g )