Dataguard实战(2):RHEL4.5 安装 Oracle10G Dataguard 多个备库 - 虚拟机和oracle软件安装

二、虚拟机和oracle软件安装

2.1 VMWare下安装RHEL4.5

安装方法很简单,按照提示来做即可。为每个虚拟机分配 512MB 内存,10GB磁盘空间。虚拟机的网络链接方式为NAT。

安装完一台虚拟机后配置静态IP,然后拷贝两份用来做备机,在拷贝的虚拟机中重新配置静态IP和MAC地址:
Xwindow下:Applications - System Settings - Network - Devices - Edit - General里配置静态IP,
Xwindow下:Applications - System Settings - Network - Devices - Edit - Hadrware Device里手工按Probe一下获取新MAC地址
然后重启网络服务或主机即可。

VMWare-Tools的安装,安装的好处:可以调整linux的分辨率、鼠标可以在虚拟机和宿主机间自由移动、可以从宿主机直接拖动文件拷贝到虚拟机里。
启动虚拟机后:
VMWare菜单 - VM - Install Vmware Tools,如果出不来安装提示那么使用以下方法:
VMWare菜单 - VM - Settings - 选择CD-ROM - Use ISO image - 选上C:/Program Files/VMware/VMware Workstation/linux.iso文件;然后启动虚拟机,从桌面上打开光盘,双击VMwareTools-6.0.5-109488.i386.rpm文件开始安装,安装后配置:
# cd /usr/bin
# vmware-config-tools.pl
然后,按提示配置就可以了,配置过程中会闪几下,这是正常的。最后,按Ctrl+Alt,在左下角你会看到没有出现“没有安装VMware-tools”的提示。

同步虚拟机OS与宿主机OS的时间:
* 执行“vmware-toolbox”以显示 VMware Tools Properties 窗口。在 Options 选项卡下,选择 Time synchronization between the virtual machine and the host operating system。您应该发现 tools.syncTime = "TRUE" 参数已经追加到虚拟机配置文件 X:/Virtual Machines/Red Hat Enterprise Linux 4/rhel4.vmx 中。
* 编辑 /boot/grub/grub.conf,并将选项“clock=pit nosmp noapic nolapic”添加到读取内核 /boot/ 的那一行。您已经将选项添加到两个内核,现在只需对特定内核进行更改。
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Enterprise (2.6.9-42.0.0.0.1.ELsmp)
root (hd0,0)
kernel /boot/vmlinuz-2.6.9-42.0.0.0.1.ELsmp ro
root=LABEL=/ rhgb quiet clock=pit nosmp noapic nolapic
initrd /boot/initrd-2.6.9-42.0.0.0.1.ELsmp.img
title Enterprise-up (2.6.9-42.0.0.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.6.9-42.0.0.0.1.EL ro root=LABEL=/
rhgb quiet clock=pit nosmp noapic nolapic
initrd /boot/initrd-2.6.9-42.0.0.0.1.EL.img

2.2 每个主机安装Oracle软件

# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba oracle
# passwd oracle
# vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
# /sbin/sysctl -p (修改以后让参数生效)

为了提升性能增加oracle用户的shell限制:
# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
# vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
# vi /etc/selinux/config (使安全linux标志失效)
SELINUX=disabled

建立基本目录:
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/app/oracle

.bash_profile需增加或修改如下参数:
# su - oracle
$ vi ~/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=WENDING #物理备库此处为PHYSTDBY、逻辑备库此处为LOGSTDBY
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export LC_ALL="zh_CN.GBK"
export LANG="zh_CN.GBK"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD.HH24:MI:SS"
$ . ~/.bash_profile

开始安装oracle软件:
$ gunzip 10201_database_linux32.zip
$ cd database
$ ./runInstaller (安装时按照提示来做即可,只安装oracle软件)

2.3 如果有旧库,需要先删除

$ sqlplus '/as sysdba'
SQL> startup mount exclusive restrict force;
SQL> drop database;

2.4 每个主机建立需要的目录

--存放trace文件
$ rm -rf $ORACLE_BASE/admin/$ORACLE_SID
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/dpdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump
--存放数据库文件
$ rm -rf /orahome/oradata/$ORACLE_SID
mkdir -p /orahome/oradata/$ORACLE_SID
--存放归档文件
$ rm -rf /orahome/arch/$ORACLE_SID
mkdir -p /orahome/arch/$ORACLE_SID
--闪存区
$ rm -rf /orahome/flash_recovery_area
mkdir -p /orahome/flash_recovery_area
--存放备份文件
$ rm -rf /orahome/backup
mkdir -p /orahome/backup

2.5 每个主机的hosts文件

# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost vmthree #最后一个参数分别是每个主机的hostname
192.168.137.128 vmone
192.168.137.129 vmtwo
192.168.137.130 vmthree

2.6 每个主机的listener.ora

$ vi $ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmone)(PORT = 1521)) #host参数,各主机配置成vmone,vmtwo,vmthree
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)

2.7 每个主机的tnsnames.ora

注意初始参数设置了db_domain=LK,但这不是必需的,tnsnames里SERVICE_NAME要加上这个域。
$ vi $ORACLE_HOME/network/admin/tnsnames.ora
db_wending =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmone)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = WENDING.LK)
)
)

db_phystdby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmtwo)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = PHYSTDBY.LK)
)
)

db_logstdby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmthree)(PORT = 1523))
)
(CONNECT_DATA =
(SERVICE_NAME = LOGSTDBY.LK)
)
)

--End--

from:http://hi.baidu.com/edeed/blog/item/82839f3d01f2cb07baa1671e.html

你可能感兴趣的:(oracle10g)