Home Database Mysql Tutorial Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Jun 07, 2016 pm 03:38 PM
linux oracle rac

echo 3 /proc/sys/vm/drop_caches(可以释放内存) 0 Linux增加交换分区: 1)创建512M的空文件 dd if=/dev/zero of=/tmp/swap1 bs=1M count=512 2)式化为交换分区 mkswap /tmp/swap1 3)查看交换分区大小 free 4)挂载交换分区 swapon /tmp/swap1 如果想要在重启

echo 3 > /proc/sys/vm/drop_caches(可以释放内存)

0 Linux增加交换分区:
1)创建512M的空文件 dd if=/dev/zero of=/tmp/swap1 bs=1M count=512
2)格式化为交换分区 mkswap /tmp/swap1
3)查看交换分区大小 free
4)挂载交换分区 swapon /tmp/swap1
如果想要在重启后生效,则在/etc/fstab文件中加入:
/tmp/swap1              swap                    swap    defaults        0 0
如果要去掉新增加的swap文件,使用 swapoff /tmp/swap1即可。

1关闭selinux,修改/etc/selinux/config文件:

SELINUX=disabled

2关闭防火墙
chkconfig iptables off
service iptables stop

3,软件包检查:(如果是安装的Oracle Enterprise Linux 4.7,那么这些包应该是已经自带了的)
binutils-2.15.92.0.2-13.EL4
compat-db-4.1.25-9
compat-libstdc++-296-2.96-132.7.2
control-center-2.8.0-12
gcc-3.4.3-22.1.EL4
gcc-c++-3.4.3-22.1.EL44
glibc-2.3.4-2.9
glibc-common-2.3.4-2.9
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-22.1
libstdc++-devel-3.4.3-22.1
make-3.80-5
pdksh-5.2.14-30
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.2
setarch-1.6-1

4,修改内核参数(其实Oracle Enterprise Linux 4.7的默认内核参数已经优化过了,基本上不需要我们再修改了)
修改/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
vm.swappiness =40(swapiness缺省为60,减少swapiness会使系统尽快通过swapout不使用的进程资源来释放更多的物理内存。)
vm.vfs_cache_pressure=200(vfs_cache_pressure的缺省值是100,加大这个参数设置了虚拟内存回收directory和i-node缓冲的倾向,这个值越大,回收的倾向越严重。)
执行sysctl -p使内核参数修改生效

5,提升shell限制
在文件/etc/security/limits.conf中添加如下内容:
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536

6,修改文件/etc/pam.d/login
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so

7,在文件中/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

8,用root创建组,用户,目录。
groupadd oinstall
groupadd dba
useradd oracle -g oinstall -G dba
passwd oracle
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01
mkdir -p /ocfs
chown -R oracle:oinstall /ocfs
chmod -R 775 /ocfs

9,oracle用户在.bash_profile文件添加如下内容
export LANG=C
export PS1="`/bin/hostname -s`-> "
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac1
export ORACLE_SID=devdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
umask 022

10,在/etc/hosts下添加
127.0.0.1               localhost
200.168.2.131           rac1.mycorpdomain.com        rac1
200.168.2.31            rac1-vip.mycorpdomain.com    rac1-vip
192.168.56.31           rac1-priv.mycorpdomain.com   rac1-priv
200.168.2.132           rac2.mycorpdomain.com        rac2
200.168.2.32            rac2-vip.mycorpdomain.com    rac2-vip
192.168.56.32           rac2-priv.mycorpdomain.com   rac2-priv
(修改IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0
修改主机名
hostname rac1
如果要重启生效,就要vi /etc/sysconfig/network)

11,在 /etc/modprobe.conf 中添加以下行,以设置 hangcheck 内核模块参数。
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
要立即加载模块,执行modprobe -v hangcheck-timer


12,复制虚拟机,并添加共享磁盘,另一台机器RAC2也如法炮制
添加两块共享磁盘,用来做ASM磁盘。vbox创建共享磁盘可以参考http://blog.csdn.net/hrich/article/details/8425636
1)查看信息
/sbin/scsi_id -g -u -s /block/sdb
2)根据udev来配置裸磁盘
vi /etc/udev/rules.d/99-oracle-asmdisk.rules  (一条规则一行数据,这里有两条规则)
KERNEL="sd*", BUS="scsi", PROGRAM="/sbin/scsi_id -g -u -s /block/%k", 
RESULT="1ATA_____VBOX_HARDDISK___________________________VB80ff2c7a-1a06607c_", NAME="asm-diskb", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL="sd*", BUS="scsi", PROGRAM="/sbin/scsi_id -g -u -s /block/%k", 
RESULT="1ATA_____VBOX_HARDDISK___________________________VB8c21121e-21155239_", NAME="asm-diskc", OWNER="oracle", GROUP="dba", MODE="0660"
3)更新块设备
partprobe 
4)测试规则文件是否生效
udevtest /block/sdb
5)重启UDEV服务
/sbin/start_udev
6)查看磁盘
ls -al /dev/asm-disk*
返回:
brw-rw----  1 oracle dba 8, 16 Jul 19 17:04 /dev/asm-diskb

brw-rw----  1 oracle dba 8, 32 Jul 19 17:04 /dev/asm-diskc


13,同步rac1与rac2 的时间
1)rac1:
vi /etc/ntp.conf 
server 127.127.1.0 minpoll 4
fudge 127.127.1.0 stratum 1
restrict 127.0.0.1
restrict 200.168.2.0 mask 255.255.255.0 nomodify notrap
driftfile /var/lib/ntp/drift

2)rac2:
vi /etc/ntp.conf 
server 200.168.2.131
fudge 127.127.1.0 stratum 2
restrict 127.0.0.1
driftfile /var/lib/ntp/drift
restrict 200.168.2.131 mask 255.255.255.255

3)分别在rac1,rac2上修改NTPD参数文件
vi /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"

4)rac1,rac2启动服务:
chkconfig ntpd on  
service ntpd restart 

5)用oracle用户分别在rac1,rac2上执行
date;ssh rac2 date
date;ssh rac1 date

14,将/ocfs绑到NFS上:(rac1充当NFS服务器,/ocfs目录存放ocr和voting disk)
mkdir /ora10g
修改 /etc/exports
/ora10g          *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
启动NFS服务
chkconfig nfs on
service nfs restart
客户端linux挂载:(rac1和rac2都要挂载)
在/etc/fstab添加
rac1:/ora10g  /ocfs nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
然后执行挂载mount /ocfs
在 /etc/rc.local添加
mount /ocfs
如果重启操作系统,记得要查看/ocfs目录的owner是否是oracle,如果不是则执行:
chown -R oracle:oinstall /ocfs
chmod -R 775 /ocfs


15,用户等效性验证
1).在主节点rac1上以oracle用户身份生成用户的公匙和私匙
# ping rac1
# ping rac2
# su - oracle
mkdir ~/.ssh
 ssh-keygen -t rsa
 ssh-keygen -t dsa
2).在副节点rac2上执行相同的操作,确保通信无阻
# ping rac1
# ping rac1
# su - oracle
mkdir ~/.ssh
 ssh-keygen -t rsa
 ssh-keygen -t dsa
3).在主节点rac1上oracle用户执行以下操作
 cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
 cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
 ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
 ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
 scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
4)在rac1,和rac2上执行检验操作
 ssh rac1 date
 ssh rac2 date
 ssh rac1-priv date
 ssh rac2-priv date


16,打开Xmanager的Xshell,用rac1上的oracle用户安装cluster软件:

/mnt/b/clusterware/runInstaller

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

按提示执行配置脚本:以 root 用户身份按顺序执行以下脚本(一次执行一个)。在当前脚本完成后,再继续执行下一个脚本。
在 rac1 上执行 /u01/app/oracle/oraInventory/orainstRoot.sh。
在 rac2 上执行 /u01/app/oracle/oraInventory/orainstRoot.sh。
在 rac1 上执行 /u01/app/oracle/product/10.2.0/crs_1/root.sh。

在 rac2 上执行 /u01/app/oracle/product/10.2.0/crs_1/root.sh。

rac2上执行root.sh会有一点小错误,不过不用担心

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

接着:

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

我们可以查看状态:

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

截图中貌似有错,但是不用担心,因为后面打上补丁后就没这个错了,而且我这里有意设置eth0的ip为公网ip,这样rac2就不用再手动执行vipca了


17,停止CRS服务,然后打补丁
以root用户在两个节点上执行:
cd /u01/app/oracle/product/10.2.0/crs_1/bin
./crsctl stop crs
在rac1用oracle用户安装补丁

/media/cdrom/Disk1/runInstaller

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

依次执行:
rac1:
/u01/app/oracle/product/10.2.0/crs_1/bin/crsctl stop crs
/u01/app/oracle/product/10.2.0/crs_1/install/root102.sh
rac2:
/u01/app/oracle/product/10.2.0/crs_1/bin/crsctl stop crs

/u01/app/oracle/product/10.2.0/crs_1/install/root102.sh

此时再看状态,如图:

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

这次截图中的信息就对了

提示:要查看状态,可以分别在两个节点执行
rac1-> crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2        

rac2-> crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2    
    

18,rac1上的oracle用户安装数据库软件:

/mnt/b/database/runInstaller

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

根据提示,在rac1,rac2执行:
/u01/app/oracle/product/10.2.0/db_1/root.sh
然后打补丁
在rac1用oracle安装补丁
/media/cdrom/Disk1/runInstaller
根据提示,在rac1,rac2执行:
/u01/app/oracle/product/10.2.0/db_1/root.sh


19,创建监听程序
netca

20,用dbca创建ASM实例,并配置ASM磁盘组

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM


这里的磁盘就是我之前用udev配置的磁盘

查看状态,rac1-> crs_stat -t

Name           Type           Target    State     Host        
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2        

21,rac1上的oracle用户用dbca创建数据库

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

配置Services Management:

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

Oracle Linux 4.7+Oracle10g RAC+Oracle 10g ASM

到此,oracle rac安装完毕



注意:遵循以下步骤启动和停止单独的应用程序资源。

srvctl start nodeapps -n  
srvctl start nodeapps -n  
srvctl start asm -n  
srvctl start asm -n  
srvctl start database -d  
srvctl start service -d -s  
crs_stat -t

srvctl stop service -d -s  
srvctl stop database -d  
srvctl stop asm -n  
srvctl stop asm -n  
srvctl stop nodeapps -n  
srvctl stop nodeapps -n  
crs_stat -t 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

vscode terminal command cannot be used vscode terminal command cannot be used Apr 15, 2025 pm 10:03 PM

Causes and solutions for the VS Code terminal commands not available: The necessary tools are not installed (Windows: WSL; macOS: Xcode command line tools) Path configuration is wrong (add executable files to PATH environment variables) Permission issues (run VS Code as administrator) Firewall or proxy restrictions (check settings, unrestrictions) Terminal settings are incorrect (enable use of external terminals) VS Code installation is corrupt (reinstall or update) Terminal configuration is incompatible (try different terminal types or commands) Specific environment variables are missing (set necessary environment variables)

How to use VSCode How to use VSCode Apr 15, 2025 pm 11:21 PM

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages ​​and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

See all articles