`

【脚本】使用VBOX在Oracle Enterprise Linux 5上安装 Oracle Database 12c RAC 12.1.0.1

阅读更多

使用VBOX在Oracle Enterprise Linux 5上安装 Oracle Database 12c RAC 12.1.0.1  

 

       Oracle数据库十分的复杂,尤其是在不同的平台或存储安装一套完善的Oracle DB考验的不仅是一个人的技术水平,更是考验技术人员的耐心以及细心程度。其中,需要掌握太多的IT技术领域的知识,包括但不限于硬件,网络,存储和软件,乃至包括业务规模和应用架构。技术始终是一场没有尽头的旅行,但是只要掌握最为通用的原理,多加磨练,一定能熟能生巧,事半功倍。

       随着Oracle 12C的推出,出现了类似plugin Database的云数据库,这对多组织和多业务部门来说是一场福音,因为可拔插的云数据库能够显著的减少IT部门或者DBA团队的管理负载,从庞大规模的系统运维业务中抽出身来,集中精力解决好指定系统的业务问题,尤其是性能问题。本人通过Oracle VirtualBox虚拟机模拟安装了两个节点的Oracle 12C RAC Cluster,具体的脚本如下所示。具体的视频也可在土豆网搜索“Askerain”播客来观看,视频共有四讲。


1.Configure network.
=>vi /etc/hosts
192.168.1.101   prohost   prohost.oracle.com
192.168.1.102   prohost-vip 
192.168.1.103   promast   promast.oracle.com
192.168.1.104   promast-vip
192.168.1.105   pro-cluster pro-cluster-scan
172.168.1.101   prohost-priv
172.168.1.102   promast-priv
=================================================
192.168.56.101   prod1   prod1.oracle.com
192.168.56.102   prod1-vip 
192.168.56.103   prod2   prod2.oracle.com
192.168.56.104   prod2-vip
192.168.56.105   pro-cluster pro-cluster-scan
172.168.1.101   prod1-priv
172.168.1.102   prod2-priv

2.Disabled firewall and selinux.
=>vi /etc/selinux/config [disabled]

3.Create user and group.
groupadd -g 5000 asmadmin
groupadd -g 5001 asmdba
groupadd -g 5002 asmoper
groupadd -g 6000 oinstall
groupadd -g 6001 dba
groupadd -g 6002 oper

useradd -g oinstall -G asmadmin,asmdba,asmoper grid 
useradd -g oinstall -G dba,asmdba              oracle

=>passwd oracle
=>passwd grid

4.Create directory for oracle.
=>mkdir /odb
=>mkdir /ogi

=>chown oracle:oinstall /odb
=>chown grid:;oinstall /ogi

5.Mount disk and yum install configuretion.
=>mkdir /media/mnt
=>mount /dev/cdrom /media/mnt

=>cd /etc/yum.repos.d
=>touch public-yum-ol5.repo
[oel5]
name=Enterprise Linux 5.7 DVD
baseurl=file:///media/mnt/Server
gpgcheck=0
enabled=1

=>yum install oracle-validated*
=>yum install oracle-rdbms-server-11gR2-preinstall-1.0-6.el6

6.Set ulimit parameters for user grid.
=>su grid
=>ulimit -a
=>su
=>vi /etc/security/limits.conf

# grid-rdbms-server-11gR2-preinstall setting for nofile soft limit is 1024
grid   soft   nofile    1024

# grid-rdbms-server-11gR2-preinstall setting for nofile hard limit is 65536
grid   hard   nofile    65536

# grid-rdbms-server-11gR2-preinstall setting for nproc soft limit is 2047
grid   soft   nproc    2047

# grid-rdbms-server-11gR2-preinstall setting for nproc hard limit is 16384
grid   hard   nproc    16384

# grid-rdbms-server-11gR2-preinstall setting for stack soft limit is 10240KB
grid   soft   stack    10240

# grid-rdbms-server-11gR2-preinstall setting for stack hard limit is 32768KB
grid   hard   stack    32768

7.Clone virtual machine and modify hostname and ip.
=>vi /etc/sysconfig/network [modify host name]
=>modify IP.(Important!)
=>cd /etc/udev/rules.d/
=>vi 70-persistent-net.rule
[delete oldest configure items,pay attention to mac address.]
=>ping test.
=>cd /etc/sysconfig/network-scripts [pay more attention to it.]
=>service network restart

8.Configure raw disk.
=>cd /dev
=>ls -l sd*
=>cd /etc/udev/rules.d
=>touch 99-oracle-asmdevices.rules
=>add raw disk by virtualbox.
=>run following scripts:
for i in b c d e f g h i ;
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=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done

for i in b c d e f g h i ;
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=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done

cd /etc/udev/rules.d
touch 99-oracle-asmdevices.rules


=>/sbin/start_udev
=>cd /dev
=>ls -l asm*

9.Configure env for user grid.
Node 1=>
=>mkdir /ogi/orabase
=>su grid
=>cd
=>vi .bash_profile

export GRID_HOME=/ogi/12cgrid/app/12.2.0.1/grid
export ORACLE_HOME=/ogi/12cgrid/app/12.2.0.1/grid
export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

export ORACLE_SID=+ASM1
export LD_LIBRARY_PATH=$GRID_HOME/lib:$GRID_HOME/lib32

export ORACLE_BASE=/g01/orabase
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG="Simplified Chinese"_China.AL32UTF8

Node 2=>
=>mkdir /ogi/orabase
=>su grid
=>cd
=>vi .bash_profile

export GRID_HOME=/ogi/12cgrid/app/12.2.0.1/grid
export ORACLE_HOME=/ogi/12cgrid/app/12.2.0.1/grid
export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

export ORACLE_SID=+ASM2
export LD_LIBRARY_PATH=$GRID_HOME/lib:$GRID_HOME/lib32

export ORACLE_BASE=/g01/orabase
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG="Simplified Chinese"_China.AL32UTF8

10.Configure env for user root.

export GRID_HOME=/ogi/12cgrid/app/12.2.0.1/grid
export ORACLE_HOME=/ogi/12cgrid/app/12.2.0.1/grid
export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

11.Configure env for user oracle.
Node 1=>
=>su oracle
=>mkdir /odb/orabase
=>cd
=>vi .bash_profile

export ORACLE_HOME=/odb/oracle/app/oracle/product/12.2.0.1/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

export ORACLE_SID=PROD1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32

export ORACLE_BASE=/odb/oracle/
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG="Simplified Chinese"_China.AL32UTF8

Node 2=>
=>su oracle
=>mkdir /odb/orabase
=>cd
=>vi .bash_profile

export ORACLE_HOME=/odb/oracle/app/oracle/product/12.2.0.1/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

export ORACLE_SID=PROD2
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32

export ORACLE_BASE=/odb/oracle/
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG="Simplified Chinese"_China.AL32UTF8


12.Switch instance and machine,use this command modify it.
=>su
=>srvctl modify instance -d orcl -instance prod1 -node machine1
=>srvctl modify instance -d orcl -instance prod2 -node machine2

[root@maclean1 ~]# srvctl stop database -d orcl
[root@maclean1 ~]# srvctl start database -d orcl

 

具体下载脚本请查看附件!

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics