分类: Oracle
2013-07-03 09:40:05
1,安装oracle vbox
下载vbox后,安装vbox
2.下载oracle linux x86_64 5.7
在ORACLE官方网站可以下载
3,安装oracle linux 5.7
4.vim /etc/hosts
192.168.1.171 rac1
192.168.1.191 rac1-vip
192.168.1.181 rac-priv
192.168.1.172 rac2
192.168.1.192 rac2-vip
192.168.1.182 rac2-priv
---为解决内核参数,oracle用户,软件包的依赖关系,安装oracle-validated全部搞定,下面为步骤和过程。
内存使用4GB
vim /home/oracle/.bash_profile
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$CRS_HOME/bin
export ORACLE_HOME=/u01/app/oracle/10g
export CRS_HOME=/u01/app/oracle/crs
export ORACLE_SID=tiger1
-- Linux版本
Oracle Linux Release 5.7 for x86_64
[root@rac1 media]# mount /dev/cdrom
cdrom cdrom-sr0
[root@rac1 media]# mount /dev/cdrom /media/disk/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@rac1 yum.repos.d]#touch public-yum-el5.repo
[root@rac1 yum.repos.d]# cat public-yum-el5.repo
[oel5]
name = Enterprise Linux 5.5 DVD
baseurl=file:///media/disk/Server/
gpgcheck=0
enabled=1
[root@rac1 yum.repos.d]# yum install oracle-validated
给oracle用户创建密码
[root@rac1 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@rac1 ~]# ls -lh /dev/sd*
brw-r----- 1 root disk 8, 0 Jun 29 21:26 /dev/sda
brw-r----- 1 root disk 8, 1 Jun 29 21:27 /dev/sda1
brw-r----- 1 root disk 8, 2 Jun 29 21:26 /dev/sda2
brw-r----- 1 root disk 8, 3 Jun 29 21:27 /dev/sda3
brw-r----- 1 root disk 8, 16 Jun 29 21:26 /dev/sdb
brw-r----- 1 root disk 8, 32 Jun 29 21:26 /dev/sdc
brw-r----- 1 root disk 8, 48 Jun 29 21:26 /dev/sdd
brw-r----- 1 root disk 8, 64 Jun 29 21:26 /dev/sde
[root@rac1 ~]# 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): p
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
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-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): +1500M
Command (m for help): p
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 183 1469916 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (184-391, default 184):
Using default value 184
Last cylinder or +size or +sizeM or +sizeK (184-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.
[root@rac1 ~]# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
Error: Error opening /dev/md0: No such file or directory
[root@rac1 ~]# ls -l /dev/sdb*
brw-r----- 1 root disk 8, 16 Jun 29 21:29 /dev/sdb
brw-r----- 1 root disk 8, 17 Jun 29 21:29 /dev/sdb1
brw-r----- 1 root disk 8, 18 Jun 29 21:29 /dev/sdb2
[root@rac1 ~]# cd /etc/udev/rules.d/
[root@rac1 rules.d]# ls
05-udev-early.rules 60-net.rules 61-uinput-stddev.rules 90-alsa.rules 98-kexec.rules
40-multipath.rules 60-pcmcia.rules 61-uinput-wacom.rules 90-dm.rules bluetooth.rules
50-udev.rules 60-raw.rules 85-pcscd_ccid.rules 90-hal.rules
51-hotplug.rules 60-wacom.rules 88-clock.rules 95-pam-console.rules
[root@rac1 rules.d]# vim 60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="raw*", OWNER=="oracle",GROUP=="oinstall",MODE=="0660"
------
[root@rac1 rules.d]# start_udev
Starting udev: [ OK ]
[root@rac1 rules.d]# ls -lh /dev/raw
raw/ rawctl
[root@rac1 rules.d]# ls -lh /dev/raw
raw/ rawctl
[root@rac1 rules.d]# ls -lh /dev/raw/*
crw-rw---- 1 oracle oinstall 162, 1 Jun 29 21:36 /dev/raw/raw1
crw-rw---- 1 oracle oinstall 162, 2 Jun 29 21:36 /dev/raw/raw2
-------------------------------------------------------
[root@rac1 rules.d]#
for i in c d e;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"oracle\", GROUP=\"oinstall\", MODE=\"0660\""
done
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB4d4db101-d9369d49_", NAME="asm-diskc", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB5cc05137-351d86fd_", NAME="asm-diskd", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB48a08aca-9c49a55e_", NAME="asm-diske", OWNER="oracle", GROUP="oinstall", MODE="0660"
AME="asm-diske", OWNER="oracle", GROUP="oinstall", MODE="0660"
[root@rac1 rules.d]# cd /etc/udev/
[root@rac1 udev]# ls
makedev.d rules.d scripts udev.conf
[root@rac1 udev]# cd rules.d/
[root@rac1 rules.d]# ls
05-udev-early.rules 60-net.rules 61-uinput-stddev.rules 90-alsa.rules 98-kexec.rules
40-multipath.rules 60-pcmcia.rules 61-uinput-wacom.rules 90-dm.rules bluetooth.rules
50-udev.rules 60-raw.rules 85-pcscd_ccid.rules 90-hal.rules
51-hotplug.rules 60-wacom.rules 88-clock.rules 95-pam-console.rules
[root@rac1 rules.d]# touch 99-oracle-asmdevices.rules
[root@rac1 rules.d]# ls
05-udev-early.rules 60-net.rules 61-uinput-stddev.rules 90-alsa.rules 98-kexec.rules
40-multipath.rules 60-pcmcia.rules 61-uinput-wacom.rules 90-dm.rules 99-oracle-asmdevices.rules
50-udev.rules 60-raw.rules 85-pcscd_ccid.rules 90-hal.rules bluetooth.rules
51-hotplug.rules 60-wacom.rules 88-clock.rules 95-pam-console.rules
[root@rac1 rules.d]# vim 99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB4d4db101-d9369d49_", NAME="asm-diskc", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB5cc05137-351d86fd_", NAME="asm-diskd", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB48a08aca-9c49a55e_", NAME="asm-diske", OWNER="oracle", GROUP="oinstall", MODE="0660"
~
"99-oracle-asmdevices.rules" 3L, 543C written
[root@rac1 rules.d]# start
start_udev startx
[root@rac1 rules.d]# start
start_udev startx
[root@rac1 rules.d]# start_udev
Starting udev: [ OK ]
[root@rac1 rules.d]# ls -lh /dev/asm*
brw-rw---- 1 oracle oinstall 8, 32 Jun 29 21:43 /dev/asm-diskc
brw-rw---- 1 oracle oinstall 8, 48 Jun 29 21:43 /dev/asm-diskd
brw-rw---- 1 oracle oinstall 8, 64 Jun 29 21:43 /dev/asm-diske
--把文件拷贝到rac2
[root@rac1 rules.d]# scp 60-raw.rules 192.168.1.172:/etc/udev/rules.d/
[root@rac1 rules.d]# scp 99-oracle-asmdevices.rules 192.168.1.172:/etc/udev/rules.d/
做等效SSH
--rac2
[oracle@rac2 ~]$ su - oracle
[oracle@rac2 ~]$ cd /home/oracle/.ssh/
[oracle@rac2 ~]$ ssh-keygen -t rsa
[oracle@rac2 ~]$ ssh-keygen -t dsa
[oracle@rac2 .ssh]$ touch authorized_keys
[oracle@rac2 .ssh]$ ls
id_dsa id_dsa.pub id_rsa id_rsa.pub
[oracle@rac2 .ssh]$ cat id_dsa.pub >> authorized_keys
[oracle@rac2 .ssh]$ cat id_rsa.pub >> authorized_keys
[oracle@rac2 .ssh]$ scp authorized_keys 192.168.1.171:/home/oracle/.ssh/
--rac1
[oracle@rac1 ~]$ su - oracle
[oracle@rac1 ~]$ cd /home/oracle/.ssh/
[oracle@rac1 ~]$ ssh-keygen -t rsa
[oracle@rac1 ~]$ ssh-keygen -t dsa
[oracle@rac1 .ssh]$ touch authorized_keys
--rac1
[oracle@rac1 .ssh]$ ls
authorized_keys id_dsa id_dsa.pub id_rsa id_rsa.pub known_hosts
[oracle@rac1 .ssh]$ cat id_dsa.pub >> authorized_keys
[oracle@rac1 .ssh]$ cat id_rsa.pub >> authorized_keys
[oracle@rac1 .ssh]$ scp authorized_keys 192.168.1.172:/home/oracle/.ssh/
--分别在rac1,rac2执行
ssh rac1
ssh rac-priv
ssh rac2
ssh rac2-priv
p8202632_10205_Linux-x86-64.zip
解压文件
第一种方法:
zcat lnx_920_disk1.cpio.gz | cpio -idmv
[root@rac1 ~]# /u01/oraInventory/orainstRoot.sh
Changing permissions of /u01/oraInventory to 770.
Changing groupname of /u01/oraInventory to oinstall.
The execution of the script is complete
[root@rac1 ~]# /u01/app/oracle/10g/crs/root.sh
WARNING: directory '/u01/app/oracle/10g' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Checking to see if Oracle CRS stack is already configured
/etc/oracle does not exist. Creating it now.
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle/10g' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node
node 1: rac1 rac1-priv rac1
node 2: rac2 rac2-priv rac2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /dev/raw/raw2
Format of 1 voting devices complete.
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
rac1
CSS is inactive on these nodes.
rac2
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.
-- 升级10.2.0.5
The installer has detected that your Cluster Ready Services (CRS) installation is distributed across the following nodes:
rac1
rac2
Because the software consists of local identical copies distributed across each of the nodes in the cluster, it is possible to patch
your CRS installation in a rolling manner, one node at a time.
To complete the installation of this patchset, you must perform the following tasks on each node:
1. Log in as the root user.
2. As the root user, perform the following tasks:
a. Shutdown the CRS daemons by issuing the following command:
/u01/app/oracle/10g/crs/bin/crsctl stop crs
b. Run the shell script located at:
/u01/app/oracle/10g/crs/install/root102.sh
This script will automatically start the CRS daemons on the
patched node upon completion.
3. After completing this procedure, proceed to the next node and repeat.
--------------
[root@rac1 u01]# /u01/app/oracle/crs/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
-----------------
[root@rac1 u01]# /u01/app/oracle/crs/install/root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /u01/app/oracle/crs
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
This may take a while on some systems.
.
10205 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully deleted 1 values from OCR.
Successfully deleted 1 keys from OCR.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node
node 1: rac1 rac1-priv rac1
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
Creating '/u01/app/oracle/crs/install/paramfile.crs' with data used for CRS configuration
Setting CRS configuration values in /u01/app/oracle/crs/install/paramfile.crs
-----------------
[root@rac1 bin]# /u01/app/oracle/crs/bin/crsctl query crs activeversion
CRS active version on the cluster is [10.2.0.5.0]
[root@rac1 bin]# ./crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[root@rac1 bin]# ./crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora.rac1.gsd application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
ora.rac1.vip application 0/0 0/0 ONLINE ONLINE rac1
ora.rac2.gsd application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
ora.rac2.vip application 0/0 0/0 ONLINE ONLINE rac2
[root@rac1 bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:40:B9:5E
inet addr:192.168.100.71 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2637653 errors:0 dropped:0 overruns:0 frame:0
TX packets:1565487 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2677391051 (2.4 GiB) TX bytes:1816650082 (1.6 GiB)
eth0:1 Link encap:Ethernet HWaddr 08:00:27:40:B9:5E
inet addr:192.168.100.91 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 08:00:27:00:A8:C9
inet addr:172.16.1.1 Bcast:172.16.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10447 errors:0 dropped:0 overruns:0 frame:0
TX packets:14215 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6220608 (5.9 MiB) TX bytes:11747505 (11.2 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:34507 errors:0 dropped:0 overruns:0 frame:0
TX packets:34507 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:36308334 (34.6 MiB) TX bytes:36308334 (34.6 MiB)
执行vipca命令,设置rac1-vip/rac2-vip
---安装database
先安装10.2.0.1,再升级10.2.0.5版本。
追踪创建的过程
/u01/app/oracle/10g/cfgtoollogs/dbca/tiger
[root@rac1 ~]# ps -ef|grep ora_
oracle 9021 1 0 Jul02 ? 00:00:08 ora_pmon_tiger1
oracle 9023 1 0 Jul02 ? 00:00:31 ora_diag_tiger1
oracle 9025 1 0 Jul02 ? 00:00:01 ora_psp0_tiger1
oracle 9027 1 0 Jul02 ? 00:01:34 ora_lmon_tiger1
oracle 9029 1 0 Jul02 ? 00:01:32 ora_lmd0_tiger1
oracle 9031 1 0 Jul02 ? 00:03:53 ora_lms0_tiger1
oracle 9036 1 0 Jul02 ? 00:00:02 ora_mman_tiger1
oracle 9042 1 0 Jul02 ? 00:00:03 ora_dbw0_tiger1
oracle 9044 1 0 Jul02 ? 00:00:03 ora_lgwr_tiger1
oracle 9046 1 0 Jul02 ? 00:00:12 ora_ckpt_tiger1
oracle 9048 1 0 Jul02 ? 00:00:04 ora_smon_tiger1
oracle 9050 1 0 Jul02 ? 00:00:00 ora_reco_tiger1
oracle 9052 1 0 Jul02 ? 00:00:23 ora_cjq0_tiger1
oracle 9054 1 0 Jul02 ? 00:00:06 ora_mmon_tiger1
oracle 9056 1 0 Jul02 ? 00:00:11 ora_mmnl_tiger1
oracle 9058 1 0 Jul02 ? 00:00:00 ora_d000_tiger1
oracle 9060 1 0 Jul02 ? 00:00:00 ora_s000_tiger1
oracle 9062 1 0 Jul02 ? 00:00:11 ora_lck0_tiger1
oracle 9073 1 0 Jul02 ? 00:00:01 ora_asmb_tiger1
oracle 9077 1 0 Jul02 ? 00:00:01 ora_rbal_tiger1
oracle 9094 1 0 Jul02 ? 00:00:00 ora_o000_tiger1
oracle 9141 1 0 Jul02 ? 00:00:00 ora_arc0_tiger1
oracle 9143 1 0 Jul02 ? 00:00:02 ora_arc1_tiger1
oracle 9236 1 0 Jul02 ? 00:00:01 ora_qmnc_tiger1
oracle 9255 1 0 Jul02 ? 00:00:11 ora_pz99_tiger1
oracle 9330 1 0 Jul02 ? 00:00:00 ora_q000_tiger1
oracle 9332 1 0 Jul02 ? 00:00:00 ora_q001_tiger1
-------
[root@rac1 ~]# ps -ef|grep asm
oracle 7892 1 0 Jul02 ? 00:00:00 asm_o000_+ASM1
oracle 9073 1 0 Jul02 ? 00:00:01 ora_asmb_tiger1
root 13081 12456 0 09:07 pts/2 00:00:00 grep asm
oracle 32067 1 0 Jul02 ? 00:00:07 asm_pmon_+ASM1
oracle 32069 1 0 Jul02 ? 00:00:32 asm_diag_+ASM1
oracle 32071 1 0 Jul02 ? 00:00:01 asm_psp0_+ASM1
oracle 32081 1 0 Jul02 ? 00:01:05 asm_lmon_+ASM1
oracle 32084 1 0 Jul02 ? 00:01:12 asm_lmd0_+ASM1
oracle 32088 1 0 Jul02 ? 00:01:18 asm_lms0_+ASM1
oracle 32092 1 0 Jul02 ? 00:00:01 asm_mman_+ASM1
oracle 32094 1 0 Jul02 ? 00:00:02 asm_dbw0_+ASM1
oracle 32096 1 0 Jul02 ? 00:00:02 asm_lgwr_+ASM1
oracle 32098 1 0 Jul02 ? 00:00:02 asm_ckpt_+ASM1
oracle 32100 1 0 Jul02 ? 00:00:01 asm_smon_+ASM1
oracle 32103 1 0 Jul02 ? 00:00:02 asm_rbal_+ASM1
oracle 32105 1 0 Jul02 ? 00:00:07 asm_gmon_+ASM1
oracle 32107 1 0 Jul02 ? 00:00:05 asm_lck0_+ASM1
oracle 32291 1 0 Jul02 ? 00:00:05 /u01/app/oracle/10g/bin/racgimon daemon ora.rac1.ASM1.asm
-------
[oracle@rac1 ~]$ echo $ORACLE_SID
tiger1
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Wed Jul 3 09:28:19 2013
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, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
SQL> select count(*) from gv$instance;
COUNT(*)
----------
2