VMWare Server 2.0.2 实现 SUN Cluster 3.2.3 安装配置 篇五、Oracle数据库软件安装篇

现在安装 oracle for solaris x86 64bit。

要点,在两台机器上安装 oracle 软件,注意只安装软件,不创建数据库,其实也可以只在一台机器上安装oracle 软件,安装配置好后,复制到另外一台机器上,不过注意,要把 /var/opt/oracle/oratab 这个文件也拷贝过去。

root@guosol10a1#cat /var/opt/oracle/oratab
#



# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/10.2.0/db_1:N

因为 solaris 10 是选的完全安装,所以不用检查包依赖了,直接装就是。

在两台机器上创建oracle 用户和组

guosol10aX# groupadd oinstall
guosol10aX# groupadd dba

在两台机器上创建文件目录

guosol10aX# mkdir -p /u01/app/oracle/product/10.2.0
guosol10aX# mkdir -p /oradata/10gR2
guosol10aX# chmod -R 775 /u01
guosol10aX# chmod -R 775 /oradata

在两台机器上创建oracle用户

guosol10aX# useradd -g dba -G oinstall -d  /u01/app/oracle/product/10.2.0 oracle
guosol10aX# passwd -r files oracle
New Password:
Re-enter new Password:
passwd: password successfully changed for oracle

在两台机器上修改文件目录属性

guosol10aX# chown -R oracle:dba /u01
guosol10aX# chown -R oracle:dba /oradata


修改两台机器上的 /home/oracle/ 下的.profile 文件,我这里用的是bash是oracle的默认shell。

oracle@guosol10aX#cat .profile
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident "@(#)local.profile 1.10 01/06/23 SMI"
stty istrip
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_HOME
ORACLE_PATH=$ORACLE_BASE/dba_scripts/common/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_PATH
ORACLE_SID=orcl
export ORACLE_SID
NLS_DATE_FORMAT="YYYY-MON-DD HH24:MI:SS"
export NLS_DATE_FORMAT
PATH=/usr/bin:/usr/ucb:/etc:.:$ORACLE_HOME/bin
export PATH
DISPLAY=127.0.0.1:0.0
export DISPLAY

修改两台机器上的 /etc/system 文件和oracle安装相关的内核参数。

root@guosol10aX#cat /etc/system
*ident "@(#)system 1.18 97/06/27 SMI" /* SVR4 1.5 */
*
* SYSTEM SPECIFICATION FILE
*

* moddir:
*
* Set the search path for modules. This has a format similar to the
* csh path variable. If the module isn't found in the first directory
* it tries the second and so on. The default is /kernel /usr/kernel
*
* Example:
* moddir: /kernel /usr/kernel /other/modules
set noexec_user_stack=1
set semsys:seminfo_semmni=300
set semsys:seminfo_semmns=1050
set semsys:seminfo_semmsl=400
set semsys:seminfo_semvmx=32767
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=300
set shmsys:shminfo_shmseg=30


* root device and root filesystem configuration:
*
* The following may be used to override the defaults provided by
* the boot program:
*
* rootfs: Set the filesystem type of the root.
*
* rootdev: Set the root device. This should be a fully
* expanded physical pathname. The default is the
* physical pathname of the device where the boot
* program resides. The physical pathname is
* highly platform and configuration dependent.
*
* Example:
* rootfs:ufs
* rootdev:/sbus@1,f8000000/esp@0,800000/sd@3,0:a
*
* (Swap device configuration should be specified in /etc/vfstab.)



* exclude:
*
* Modules appearing in the moddir path which are NOT to be loaded,
* even if referenced. Note that `exclude' accepts either a module name,
* or a filename which includes the directory.
*
* Examples:
* exclude: win
* exclude: sys/shmsys



* forceload:
*
* Cause these modules to be loaded at boot time, (just before mounting
* the root filesystem) rather than at first reference. Note that
* forceload expects a filename which includes the directory. Also
* note that loading a module does not necessarily imply that it will
* be installed.
*
* Example:
* forceload: drv/foo



* set:
*
* Set an integer variable in the kernel or a module to a new value.
* This facility should be used with caution. See system(4).
*
* Examples:
*
* To set variables in 'unix':
*
* set nautopush=32
* set maxusers=40
*
* To set a variable named 'debug' in the module named 'test_module'
*
* set test_module:debug = 0x13

* Start of lines added by SUNWscr
set rpcmod:svc_default_stksize=0x6000
set ge:ge_intr_mode=0x833
* Disable task queues and send all packets up to Layer 3
* in interrupt context.
* Uncomment the appropriate line below to use the corresponding
* network interface as a Sun Cluster private interconnect. This
* change will affect all corresponding network-interface instances.
* For more information about performance tuning, see
* http://www.sun.com/blueprints/0404/817-6925.pdf
* set ipge:ipge_taskq_disable=1
* set ixge:ixge_taskq_disable=1
* set ce:ce_taskq_disable=1

* End of lines added by SUNWscr
* Begin MDD root info (do not edit)
rootdev:/pseudo/md@0:0,0,blk
* End MDD root info (do not edit)
root@guosol10aX#

重启两台solaris10的系统,如果是已经启动到cluster模式下,就用 scshutdown -g 0 -y 来停机启动。


现在来安装 oracle 软件,只在一台机器上做 guosol10a1.

 

 

注意,这里选 advanced installation. 不要系统自动创建数据库。

 

 


先在 gusol10a1 上安装好数据库软件。 下面是在共享文件系统上创建数据库。

先把 oraset 的主导权切换到 gusol10a1 上来。

root@guosol10a2#cldevicegroup switch -n guosol10a1 oraset

在 guosol10a1 上挂载文件系统

root@guosol10a1#mount /dev/md/oraset/dsk/d0 /oradata/10gR2

我们将在  guosol10a1  上创建数据库,把数据文件,日志文件,控制文件等都放到共享文件目录 /oradata/10gR2 上面。

在 guosol10a1 上oracle 用户使用 dbca 来创建数据库。

 

 

 

 

 

 

把所有数据库使用的日志,控制,归档,闪回文件目录都放到 /oradata/10gR2 下面

 

检查文件目录参数把 oracle_base 的目录都改到  /oradata/10gR2 下面

 

 

配置过程我就不展示了,直接看配置文件

guosol10a1 主机上

oracle@guosol10a1#cat /etc/hosts
#
# Internet host table
#
127.0.0.1 localhost
192.168.1.31 guosol10a1 loghost
192.168.1.32 guosol10a2
192.168.1.30 guooraserver

这个 guooraserver 的 30 IP 是对外的集群服务IP。

oracle@guosol10a1#cat listener.ora 
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = ORCL)
)
)

LOG_DIRECTORY_LISTENER = /oradata/10gR2/network/log

LOG_FILE_LISTENER = LISTENER.log

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = guosol10a1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = guooraserver)(PORT = 1521))
)

oracle@guosol10a1#cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

TNSNAMES.ORA =
(DESCRIPTION =
(ADDRESS_LIST =
# (ADDRESS = (PROTOCOL = TCP)(HOST = guosol10a1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = guooraserver)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)

TNSNAMES.ORA1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = guosol10a1)(PORT = 1521))
        )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL)
    )
  )
oracle@guosol10a1#cat /var/opt/oracle/oratab
#

orcl:/u01/app/oracle/product/10.2.0/db_1:N

 

 

(ADDRESS = (PROTOCOL = TCP)(HOST = guooraserver)(PORT = 1521)) 注意监听 要监听这个公共服务IP 的  1521 端口。

自己用sqlplus 连接 TNSNAMES.ORA1 测试一下是否能连通。

现在 给 guosol10a2 安装数据软件。

其实不用安装,把 guosol10a1 下的 /u01 目录 tar 了。然后压缩一把, ftp 到 guosol10a2 的 / 目录下,解开 tar,文件,然后把 那两个脚本 运行一下。orainstRoot.sh,root.sh 运行一下,然后把 guosol10a1 的 /var/opt/oracle/oratab 文件也放到 guosol10a2 对应的位置上。 guosol10a2 的数据库文件就安装好了。

guosol10a2 的对应配置文件也要做更改

oracle@guosol10a2#cat /etc/hosts
#
# Internet host table
#
127.0.0.1 localhost
192.168.1.32 guosol10a2 loghost
192.168.1.31 guosol10a1
192.168.1.30 guooraserver
oracle@guosol10a2#
oracle@guosol10a2#cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = ORCL)
)
)

LOG_DIRECTORY_LISTENER = /oradata/10gR2/network/log

LOG_FILE_LISTENER = LISTENER.log

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = guosol10a2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = guooraserver)(PORT = 1521))
)
oracle@guosol10a2#vi tnsnames.ora
"tnsnames.ora" 15 lines, 426 characters
(ADDRESS = (PROTOCOL = TCP)(HOST = guooraserver)(PORT = 1521))
# (ADDRESS = (PROTOCOL = TCP)(HOST = guosol10a2)(PORT = 1521))
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

TNSNAMES.ORA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = guooraserver)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
TNSNAMES.ORA2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = guosol10a2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
oracle@guosol10a2#cat /var/opt/oracle/oratab


orcl:/u01/app/oracle/product/10.2.0/db_1:N


手工测试数据库切换的方法。

1、guosol10a1 停oracle 数据库。

2、guosol10a1 上卸载 /oradata/10gR2 文件目录。

3、切换 oraset 的主导权给 guosol10a2.

4、在 guosol10a2 上挂载 /oradata/10gR2 文件目录。

5、在 guosol10a2 上启动oracle数据库。

oracle 数据库软件的安装和数据库的建立完毕。



 

posted @ 2012-03-11 16:55  疯狂的毛豆  阅读(32)  评论(0编辑  收藏  举报