9I RAC 安装与管理

一、rcp 的配置(所有节点)(两台机器都做)

1.1、启用/etc/xinetd.d/krb5-telnet  (vi krb5-telnet时要让disable=no)  (可以省略)
在oracle的宿主目录编辑.k5login文件:
oracle@redflag02 (前面是用户名,后面是主机名,练习时是rac01,rac02)

1.2、启用rsh服务(远程shell服务)(如果没有RSH 得安装)
编辑 /etc/xinetd.d/rsh文件,把DISALBLE的值改成NO,重新启动xinetd进程:
/etc/init.d/xinetd restart


1.3、改变使用rcp(可选)
mv /usr/kerberos/bin/rcp /usr/kerberos/bin/rcp.ker
ln -s /usr/bin/rcp /usr/kerberos/bin/rcp

1.4、在ORACLE用户的宿主目录下,编辑.rhosts(新建)文件:(118换成151)(

192.168.8.118 oracle
10.10.10.1 oracle
192.168.8.119 oracle
10.10.10.2 oracle

1.5、编辑/etc/hosts.equiv(新建)(root身份 允许远程服务)(要配信任关系必须配这个)

rac01
rac02
heart01
heart02

1.6、编辑/etc/hosts(解析)
127.0.0.1              localhost.localdomain localhost    (把127.0.0.1后的主机名去掉)
192.168.8.152          rac02
192.168.8.151           rac01
10.10.10.1              heart01
10.10.10.2              heart02

ping raco1
ping heart01
ping raco2
ping heart02
1.7、检查是否可以使用rcp    (任何验证步骤都认真完成)
 
        AS01:

        $ touch /oracle/test(创建一个文件)
        $ rcp /oracle/test as02:/oracle/test1(看看能否copy到那台机器上)
        $ rcp /oracle/test heart02:/oracle/test2

        as02:

        $ touch /oracle/test
        $ rcp /oracle/test as01:/oracle/test1
        $ rcp /oracle/test heart02:/oracle/test2
        $ ls /oracle/test*
        /oracle/test /oracle/test1 /oracle/test2

        as01:

        $ ls /oracle/test*
        /oracle/test /oracle/test1 /oracle/test2

注意:如果复制过程中需要密码,则配置不成功。


二、检查编译器,在安装LINUX时,需要安装老的编译器,否则安装过程中会提醒找不到某些库文件。(因为ORACLE 9204是在GCC-2.9.6时产生的)

2.1 检查是否安装   (gcc -v查看当前使用的版本)
[root@linux240 root]# rpm -qa|grep gcc
gcc-2.9.6
gcc-3.2.3

2.2 替换为老的版本

cd /usr/bin
mv gcc gcc3.2.3
mv g++ g++3.2.3
ln -s /usr/bin/gcc296 /usr/bin/gcc
ln -s /usr/bin/g++296 /usr/bin/g++

如果没有安装gcc296的话,要打Legacy Software Development 这个补丁,安装后可以打这个命令来查看:
[root@rac03 bin]# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux7/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-128)

三、安装补丁包,否则启动不了安装的图形界面,做这一步之前,请确认上一步已经完成,否则没有效果。(俩台机器都要做  ROOT  )

cd 3006854/
sh rhel3_pre_install.sh


四、安装hangcheck-timer定时器(老版本叫WATCH LOG),一般都已经安装了此模块,如果
没有,请先安装该模块,然后编辑/etc/rc.local(协调个个接点时间) (root)
    
4.1、如果有,屏蔽此行/sbin/insmod softdog nowayout=0 soft_noboot=1 soft_margin=60

4.2、插入以下一行,以后系统启动会自动加载:
/sbin/insmod hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

4.3、手动启动该模块:
/sbin/insmod hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

4.4、检查是否已经加载:
lsmod

Module                  Size  Used by    Not tainted
hangcheck-timer         2584   0  (unused)


五、配置内核参数

5.1、以 root 用户身份登录并在每个主机上配置 Linux 内核参数。
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=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144


5.2、让内核参数生效:

/sbin/sysctl -p

六、创建共享磁盘、以及数据库数据文件,(操作步骤查看raw_info.txt文档)

七、安装、配置、启动OCM(Oracle Cluster Manager)

7.1、安装OCM(主节点)
 先配置oracle用户的环境变量.bash_profile
rcp .bash_profile rac02:/oracle   (复制到rac02这个机器上,就不用再去配了)

/cdrom/Disk1/runInstaller

Respond to the installer prompts as shown below:
At the "Welcome Screen", click Next.
If this is your first install on this machine:

If the "Inventory Location" screen appears, enter the inventory location then click OK.
If the "Unix Group Name" screen appears, enter the unix group name created in step 2.1 then click Next.
At this point you may be prompted to run /tmp/orainstRoot.sh.  Run this and click Continue.
 

At the "File Locations Screen", verify the destination listed is your ORACLE_HOME directory.  Also enter a NAME to identify this ORACLE_HOME.  The NAME can be anything.
At the "Available Products Screen", Check "Oracle Cluster Manager". Click Next.
At the public node information screen, enter the public node names and click Next.
At the private node information screen, enter the interconnect node names. Click Next.
Enter the full name of the file or raw device you have created for the ORACM Quorum disk information. Click Next.
Press Install at the summary screen.
You will now briefly get a progress window followed by the end of installation screen. Click Exit and confirm by clicking Yes. 
Note: Create the directory $ORACLE_HOME/oracm/log (as oracle) on the other nodes if it doesn't exist.
 
7.2、配置OCM(所有节点)
编辑$ORACLE_HOME/oracm/admin/cmcfg.ora文件,结果如下:

    as01:

        ClusterName=Oracle Cluster Manager, version 9i
        MissCount=210
        PrivateNodeNames=heart01 heart02
        PublicNodeNames=as01 as02
        ServicePort=9998
        CmDiskFile=/dev/raw/raw1
        KernelModuleName=hangcheck-timer
        HostName=heart01


    as02:

        ClusterName=Oracle Cluster Manager, version 9i
        MissCount=210
        PrivateNodeNames=heart01 heart02
        PublicNodeNames=as01 as02
        ServicePort=9998
        CmDiskFile=/dev/raw/raw1
        KernelModuleName=hangcheck-timer
        HostName=heart02

7.3、启动OCM(所有节点)

7.3.1、(要手动建个log目录)进入到 $ORACLE_HOME/oracm/bin 目录下, 切换到root用户,启动ORACM.

        $ cd $ORACLE_HOME/oracm/bin
        $ su root    (注意:这里不要所用:su - root)
        # ./ocmstart.sh
        oracm </dev/null 2>&1 >/oracle/app/oracle/product/9.2.0/oracm/log/cm.out &

7.3.2、查看进程是否启动:

        #  ps -efm | grep oracm

        应该有多个(如果只有一个则quorum添 的有问题)
7.3.3、查看进程日志:

        # cd $ORACLE_HOME/oracm/log
        # head -1 cm.log
        oracm, version[ 9.2.0.2.0.49 ] started {Fri May 14 09:22:28 2004 }

八、安装Oracle 9.2.0.4 RAC

注意:Due to bug 3547724, temporarily create a symbolic link /oradata directory pointing to an oradata directory with space available as root prior to running the RAC install:

8.1、创建临时/oracle目录:(在主接点上就可以了)

# mkdir /oracle/oradata
# chmod 777 /oracle/oradata
# ln -s /oracle/oradata /oradata  (必须要)
 
8.2、安装Oracle 9.2.0.4 RAC
     
/cdrom/Disk1/runInstaller     
Respond to the installer prompts as shown below:

At the "Welcome Screen", click Next.
At the "Cluster Node Selection Screen", make sure that all RAC nodes are selected.
At the "File Locations Screen", verify the destination listed is your ORACLE_HOME directory and that the source directory is pointing to the products.jar from the 9.2.0.4 cd or staging location.
At the "Available Products Screen", check "Oracle 9i Database 9.2.0.4". Click Next.
At the "Installation Types Screen", check "Enterprise Edition" (or whichever option your prefer), click Next.
At the "Database Configuration Screen", check "Software Only".  Click Next.
At the "Shared Configuration File Name Screen", enter the path of the CFS or NFS srvm file created at the beginning of step 2.3 or the raw device created for the shared configuration file. (输入:/dev/raw/raw2) Click Next. (注意:/var/opt/oracle/srvConfig.loc如果存在,则不会有上面选项,需要该名,这一步很重要,如果安装过程中没有没有出现此界面,那么以后的安装结束后不会有gsdctl命令,则意味着安装失败)
Click Install at the summary screen.  Note that some of the items installed will say "9.2.0.1" for the version, this is normal because only some items needed to be patched up to 9.2.0.4.
You will now get a progress window, run root.sh when prompted. (系统检查/oradata的空间,要2555MB空间,只要有个链接就行)
You will then see the end of installation screen. Click Exit and confirm by
clicking Yes.
 
两台机器需要运行/oracle/product/9204/root.sh这个脚本,运行后会提示:
/oracle/product/9204/root.sh: line 250: /var/opt/oracle/srvConfig.loc: No such file or directory
/bin/chown: failed to get attributes of `/var/opt/oracle/srvConfig.loc': No such file or directory
/bin/chmod: failed to get attributes of `/var/opt/oracle/srvConfig.loc': No such file or directory

这时需要手动来创建:
[root@rac01 root]# mkdir -p /var/opt/oracle
[root@rac01 root]# vi /var/opt/oracle/srvConfig.loc (新的)
把这行srvconfig_loc=/dev/raw/raw2添加进去
[root@rac01 root]# chown -R oracle:dba /var/opt/oracle
[root@rac01 root]# ls -l /var/opt/oracle
total 4
-rw-r--r--    1 oracle   dba            29 Apr 29 11:24 srvConfig.loc
[root@rac01 root]# /oracle/product/9204/root.sh  (再运行这个脚本)

8.3、安装结束后,删除链接:

Note: You can now remove the /oradata symbolic link:
 # rm /oradata  (检查)
 

九、创建数据库

9.1、启动gsdctl(所有节点)(必须是ORALCE身份)

编辑/var/opt/oracle/srvConfig.loc文件,内容如下:
 
srvconfig_loc=/dev/raw/raw2


9.2、启动gsdctl进程:(全局服务进程)

      $gsdctl start     (ORACLE 用户)
        Successfully started GSD on local node

        ps -ef|grep gsd

检查进程状态:

        $ gsdctl stat
        GSD is running on the local node

9.3、使用netca配置所有节点的监听(主节点)

    % netca
lsnrctl start (看看起来没有)
    
9.4、使用dbca创建数据库:


要把/oracle/*这个目录下的文件和目录的权限都改成755
$: chmod 755 /oracle/*     (两个主机都要执行)

$: dbca
   
   
要手动创建一下spfile文件: (两台主机都要执行)
ls -l /dev/vg00   (查看一下spfile所对应的主号和次号(58   18))
raw -qa     (  查看(58   18 )所对应的字符设备(/dev/raw/raw30))
[oracle@rac01 dbs]$ cd $ORACLE_HOME/dbs   (一定要在dbs目录下软连接spfile)
[oracle@rac01 dbs]$ ln -s /dev/raw/raw30 spfilecuug.ora  
[oracle@rac01 dbs]$ ls     (这时会产生一个spfile文件)
 initdw.ora  init.ora  spfilecuug.ora


Respond to the DBCA prompts as shown below:

Choose Oracle Cluster Database option and select Next.
The Operations page is displayed. Choose the option Create a Database and click Next.
The Node Selection page appears. Select the nodes that you want to configure as part of the RAC database and click Next. 
The Database Templates page is displayed. The templates other than New Database include datafiles. Choose New Database and then click Next.  Note: The Show Details button provides information on the database template selected.
DBCA now displays the Database Identification page. Enter the Global Database Name and Oracle System Identifier (SID). The Global Database Name is typically of the form name.domain, for example mydb.us.oracle.com while the SID is used to uniquely identify an instance (DBCA should insert a suggested SID, equivalent to name1 where name was entered in the Database Name field). In the RAC case the SID specified will be used as a prefix for the instance number. For example, MYDB, would become MYDB1, MYDB2 for instance 1 and 2 respectively.
The Database Options page is displayed. Select the options you wish to configure and then choose Next. Note: If you did not choose New Database from the Database Template page, you will not see this screen. 
Select the connection options desired from the Database Connection Options page. Click Next.
DBCA now displays the Initialization Parameters page. This page comprises a number of Tab fields. Modify the Memory settings if desired and then select the File Locations tab to update information on the Initialization Parameters filename and location. The option Create persistent initialization parameter file is selected by default. If you have a cluster file system, then enter a file system name, otherwise a raw device name for the location of the server parameter file (spfile) must be entered.  The button File Location Variables… displays variable information. The button All Initialization Parameters… displays the Initialization Parameters dialog box. This box presents values for all initialization parameters and indicates whether they are to be included in the spfile to be created through the check box, included (Y/N). Instance specific parameters have an instance value in the instance column. Complete entries in the All Initialization Parameters page and select Close. Note: There are a few exceptions to what can be altered via this screen. Ensure all entries in the Initialization Parameters page are complete and select Next.
DBCA now displays the Database Storage Window. This page allows you to enter file names for each tablespace in your database.
The Database Creation Options page is displayed. Ensure that the option Create Database is checked and click Finish.
The DBCA Summary window is displayed. Review this information and then click OK.  Once you click the OK button and the summary screen is closed, it may take a few moments for the DBCA progress bar to start.  DBCA then begins to create the database according to the values specified.
During the database creation process, you may see the following error:

ORA-29807: specified operator does not exist

This is a known issue (bug 2925665).  You can click on the "Ignore" button to continue.   Once DBCA has completed database creation, remember to run the 'prvtxml.plb' script from $ORACLE_HOME/rdbms/admin independently, as the user SYS. It is also advised to run the 'utlrp.sql' script to ensure that there are no invalid objects in the database at this time.


9.5、管理RAC数据库:

9.5.1、显示各个节点的状态:

$ srvctl config
cuug

$ srvctl status database -d cuug
Instance racinst1 is running on node racnode1
Instance racinst2 is running on node racnode2

9.5.2、启动和关闭RAC数据库

$ srvctl start database -d cuug   (同时打开各个节点)

$ srvctl stop database -d cuug    (同时关闭各个节点)

$ srvctl stop instance -d cuug -i cuug1

$ srvctl start instance -d cuug -i cuug1

9.5.3、RAC数据库的启动顺序,注意执行的用户权限

[oracle@AS02 bin]$ $ORACLE_HOME/oracm/bin/ocmstart.sh (root)

[oracle@AS02 bin]$  gsdctl start

[oracle@AS02 bin]$ srvctl start database -d cuug

9.5.4、查询集群上的所有节点
SQL>
SELECT
    inst_id
  , instance_number inst_no
  , instance_name inst_name
  , parallel
  , status
  , database_status db_status
  , active_state state
  , host_name host
FROM gv$instance
ORDER BY inst_id;


远程数据库要配TNS来登陆这个RAC,添加:
cuug_rac =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.241)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.242)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = cuug)
    )
  )
   


  $: sqlplus scott/tiger@cuug_rac


在RAC主机上:SQL> select username,inst_id from gv$session;
            
USERNAME                          INST_ID
------------------------------ ----------
                                        1
                                        1
                                        1
                                        1
                                        1
                                        1
                                        1
SYS                                     1
SCOTT                                   1
                                        1
SYS                                     1

当关闭一个RAC主机时,另一个RAC主机还可以提供服务:(rac01)

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

$: sqlplus scott/tiger@cuug_rac

SQL> select username,inst_id from gv$session;   (rac02)

USERNAME                          INST_ID
------------------------------ ----------
                                        2
                                        2
SYS                                     2
SCOTT                                   2
                                        2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值