Oracle11g RAC construction in linux (III)
2. Configure the installation environment (node1 and node2) to create a group, user, directory, and modify permissions (node1 and node2) to create a group, user, and initial password on node1.
Create a group: # groupadd [-g] [gid] [group name]
Create a user: # useradd [-u] [uid] [-g] [user's primary group] [-G] [user's secondary group] [user name]
Run the Script: # sh mkuser. sh
Groupadd-g 200 oinstall
Groupadd-g DBA
Groupadd-g 202 running
Groupadd-g 203 asmadmin
Groupadd-g 204 asmoper
Groupadd-g 205 asmdba
Useradd-u 200-g oinstall-G dba, asmdba, external oracle
Useradd-u 201-g oinstall-G dba, asmadmin, asmdba, asmoper, opergrid
After creating a group user, View:
[Root @ node1 ~] # Id oracle
[Root @ node1 ~] # Id grid
Initial user password:
[Root @ node1 ~] # Passwd oracle
[Root @ node1 ~] # Passwd grid
Supplement:
Change grid group
[Root @ metro1 ~] # Usermod-g oinstall-G dba, role, asmadmin, asmoper, and asmdba grid
Create a group, user, and initial password (SCRIPT) on node2)
Create a group: # groupadd [-g] [gid] [group name]
Create a user: # useradd [-u] [uid] [-g] [user's primary group] [-G] [user's secondary group] [user name]
Run the Script: # sh mkuser. sh
Groupadd-g 200 oinstall
Groupadd-g DBA
Groupadd-g 202 running
Groupadd-g 203 asmadmin
Groupadd-g 204 asmoper
Groupadd-g 205 asmdba
Useradd-u 200-g oinstall-G dba, asmdba, external oracle
Useradd-u 201-g oinstall-G dba, asmadmin, asmdba, asmoper, opergrid
After creating a group user, View:
[Root @ node2 ~] # Id oracle
[Root @ node2 ~] # Id grid
Initial user password:
[Root @ node2 ~] # Passwd oracle
[Root @ node2 ~] # Passwd grid
Modify permissions on node1 and create a directory under/u01
1. Change owner:
Example: # chown-R grid: oinstall/u01/app/oraInventory/
Changes the recursive owner of the Owner: directory of the group.
2. Authorization:
Example: # chmod-R 775/u01/11.2.0/grid/
Changes the access permission to the xxx directory for all files in the recursive directory.
3. Execute the Script: # sh mkdir. sh
4. Directory description:
/U01/app/oraInventory/---- A directory to install the software
/U01/11.2.0/grid/---- main directory for installing grid
/U01/app/oracle/product/11.2.0/db_1 ---- install the main directory of oracle
/U01/app/oracle ---- BASE Directory of oracle
Mkdir-p/u01/app/oraInventory
Chown-R grid: oinstall/u01/app/oraInventory/
Chmod-R 775/u01/app/oraInventory/
Mkdir-p/u01/11.2.0/grid
Chown-R grid: oinstall/u01/11.2.0/grid/
Chmod-R 775/u01/11.2.0/grid/
Mkdir-p/u01/app/oraInventory/
Mkdir-p/u01/app/oracle
Mkdir-p/u01/app/oracle/export toollogs
Mkdir-p/u01/app/oracle/product/11.2.0/db_1
Chown-R oracle: oinstall/u01/app/oracle
Chmod-R 775/u01/app/oracle
# Ls-l/u01 ---- check after installation
Modify permissions on node2 and create a directory (SCRIPT) under/u01)
1. Change owner:
Example: # chown-R grid: oinstall/u01/app/oraInventory/
Changes the recursive owner of the Owner: directory of the group.
2. Authorization:
Example: # chmod-R 775/u01/11.2.0/grid/
Changes the access permission to the xxx directory for all files in the recursive directory.
3. Execute the Script: # sh mkdir. sh
4. Directory description:
/U01/app/oraInventory/---- A directory to install the software
/U01/11.2.0/grid/---- main directory for installing grid
/U01/app/oracle/product/11.2.0/db_1 ---- install the main directory of oracle
/U01/app/oracle ---- BASE Directory of oracle
Mkdir-p/u01/app/oraInventory
Chown-R grid: oinstall/u01/app/oraInventory/
Chmod-R 775/u01/app/oraInventory/
Mkdir-p/u01/11.2.0/grid
Chown-R grid: oinstall/u01/11.2.0/grid/
Chmod-R 775/u01/11.2.0/grid/
Mkdir-p/u01/app/oraInventory/
Mkdir-p/u01/app/oracle
Mkdir-p/u01/app/oracle/export toollogs
Mkdir-p/u01/app/oracle/product/11.2.0/db_1
Chown-R oracle: oinstall/u01/app/oracle
Chmod-R 775/u01/app/oracle
# Ls-l/u01 ---- check after installation
Edit/etc/hosts (node1, node2)
Hosts function:
If no DNS tool is available, use the local/etc/hosts to resolve the IP address and host name to resolve the host name to the IP address.
Note: Write the node name.
Edit hosts on node1
[Root @ node2 ~]# Vi/etc/hosts
# Do not remove the following line, or various programs
# That require network functionality will fail.
127.0.0.1 localhost
192.168.4.71 node1
192.168.4.73 node1-vip
10.10.10.71 node1-priv
192.168.4.72 node2
192.168.4.74 node2-vip
10.10.10.72 node2-priv
192.168.4.75 scan_ip
Explanation:
127.0.0.1 localhost // local loopback
192.168.4.71 node1 // implements public Nic resolution
192.168.4.73 node1-vip
// The vip address required by oracle when using rac, which must be in the same network segment as the public network card. The vip address is a feature of drifting from one node to another to quickly implement fault tolerance.
10.10.10.71 node1-priv // Private IP Address
192.168.4.72 node2
192.168.4.74 node2-vip
10.10.10.72 node2-priv
192.168.4.75 scan_ip
// The new address of the 11g network must be in the same network segment as the public network card. This simplifies the client connection configuration. The disadvantage is that Server Load balancer cannot be implemented.
Edit hosts on node2
Hosts copy from note1 to node2:
[Root @ node1 ~]# Scp/etc/hosts node2:/etc/
[Root @ node2 ~] # Cat/etc/hosts // check hosts settings
Modify Kernel Parameters on node1 of sysctl. conf (node1 and node2)
[Root @ node1] #Vi/etc/sysctl. conf
Add at the end:
Fs. aio-max-nr = 1048576
Fs. file-max = 6815744
Kernel. shmall = 2097152
Kernel. shmmax = 536870912
Kernel. shmmni = 4096
Kernel. sem = 250 32000 100 128
Net. ipv4.ip _ local_port_range = 9000 65500
Net. core. rmem_default = 262144
Net. core. rmem_max = 4194304
Net. core. wmem_default = 262144
Net. core. wmem_max = 1048586
Node1 Kernel Parameter Modification takes effect
[Root @ node1 ~] #Sysctl-p
Modify Kernel Parameters on node2
Method 1:
[Root @ node1] # scp/etc/sysctl. confnode2:/etc
Method 2:
[Root @ node2] # vi/etc/sysctl. conf
Add:
Fs. aio-max-nr = 1048576
Fs. file-max = 6815744
Kernel. shmall = 2097152
Kernel. shmmax = 536870912
Kernel. shmmni = 4096
Kernel. sem = 250 32000 100 128
Net. ipv4.ip _ local_port_range = 9000 65500
Net. core. rmem_default = 262144
Net. core. rmem_max = 4194304
Net. core. wmem_default = 262144
Net. core. wmem_max = 1048586
Node2 Kernel Parameter Modification takes effect
[Root @ node2 ~] #Sysctl-p
Node1 and node2 modify limits. conf
[Root @ node1 ~] # Vi/etc/security/limits. conf
Used to restrict user access to memory resources and cpu resources
Add:
Oracle soft nproc 2047
Hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
Oracle soft stack 10240
Grid soft nproc 2047
Grid hard nproc 16384
Grid soft nofile 1024
Grid hard nofile 65536
Grid soft stack 10240
[Root @ node1 ~] # Scp/etc/security/limits. conf node2:/etc/security/
Node1 and node2 modify login
Login file: automatically starts limits (Limit file) after login ).
[Root @ node1 ~] # Vi/etc/pam. d/login
Add: session required/lib/security/pam_limits.so
[Root @ node1 app] #Scp/etc/pam. d/login node2:/etc/pam. d
Node1 and node2 Modify profile
Profile: Some access restrictions for logging on to the application environment.
# Vi/etc/profile
Add:
If [$ USER = "oracle"] | [$ USER = "grid"]; then
If [$ SHELL = "/bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi
[Root @ node1 app] #Scp/etc/profile node2:/etc
Clock Synchronization Node 1 and node 2 disable the ntp service
Disable the system ntp (network time protocol) service and use the time synchronization service that comes with oracle (11G has been integrated into the grid, so you don't need this service anymore. Turn off the operating system synchronization ).
Rename the configuration file. Otherwise, an error is reported during grid installation.
[Root @ node1 ~] # Chkconfigntpd off
[Root @ node1 ~] # Mv/etc/ntp. conf/etc/ntp. conf. bak
Perform the same operation on node2.
Node1 and node2 disable the sendmail service
Email Service, which affects system startup and closes it.
[Root @ node2 ~] # Chkconfigsendmail off
Perform the same operation on node2.
Node1 and node2 modify oracle and grid user environment variables
----- Modify the oracle and grid user environment variables. bash_profile
Note:
Modify node1 and node2:
1. oracle user environment variables ORACLE_SID are different (prod1, prod2 );
2. the grid user environment variables ORACLE_SID are different (+ ASM1, + ASM2 ).
Oracle users:
# Su-oracle
[Oracle @ node1 ~] $Vi. bash_profile
// Delete unnecessary rows
#. Bash_profile
# Get the aliases and functions
If [-f ~ /. Bashrc]; then
.~ /. Bashrc
Fi
# User specific environment andstartup programs
Export EDITOR = vi
Export ORACLE_SID = prod1 (Note: Change node2 to prod2.)
Export ORACLE_BASE =/u01/app/oracle
ExportORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1
ExportLD_LIBRARY_PATH = $ ORACLE_HOME/lib
Export PATH = $ ORACLE_HOME/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
Umask 022
Copy node1 for pasting:
Export EDITOR = vi
Export ORACLE_SID = prod1
Export ORACLE_BASE =/u01/app/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1
ExportLD_LIBRARY_PATH = $ ORACLE_HOME/lib
Export PATH = $ ORACLE_HOME/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
Umask 022
Copy node2 for pasting:
Export EDITOR = vi
Export ORACLE_SID = prod2
Export ORACLE_BASE =/u01/app/oracle
ExportORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1
ExportLD_LIBRARY_PATH = $ ORACLE_HOME/lib
Export PATH = $ ORACLE_HOME/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
Umask 022
Do not forget to perform the same operation on node2.
Grid User:
[Oracle @ node1 ~] $Su-grid
Password:
[Grid @ node1 ~] $Vi. bash_profile
#. Bash_profile
# Get the aliases and functions
If [-f ~ /. Bashrc]; then
.~ /. Bashrc
Fi
# User specific environment andstartup programs
ExportEDITOR = vi
ExportORACLE_SID = + ASM1(Note: Change node2 to + ASM2)
ExportORACLE_BASE =/u01/app/oracle
ExportORACLE_HOME =/u01/11.2.0/grid
ExportGRID_HOME =/u01/11.2.0/grid
ExportLD_LIBRARY_PATH = $ ORACLE_HOME/lib
ExportTHREADS_FLAG = native
Export PATH = $ ORACLE_HOME/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
Umask 022
Copy node1 for pasting:
ExportEDITOR = vi
ExportORACLE_SID = + ASM1
ExportORACLE_BASE =/u01/app/oracle
ExportORACLE_HOME =/u01/11.2.0/grid
ExportGRID_HOME =/u01/11.2.0/grid
ExportLD_LIBRARY_PATH = $ ORACLE_HOME/lib
ExportTHREADS_FLAG = native
Export PATH = $ ORACLE_HOME/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
Umask 022
Copy node2 for pasting:
ExportEDITOR = vi
ExportORACLE_SID = + ASM2
ExportORACLE_BASE =/u01/app/oracle
ExportORACLE_HOME =/u01/11.2.0/grid
ExportGRID_HOME =/u01/11.2.0/grid
ExportLD_LIBRARY_PATH = $ ORACLE_HOME/lib
ExportTHREADS_FLAG = native
Export PATH = $ ORACLE_HOME/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
Umask 022
Do not forget to perform the same operation on node2.
Add swap partitions to node1 and node2
Set the swap partition size. Generally, it must be twice the memory size.
Under node1:
Root User operation:
[Root @ node1 ~] #Free-m
// View the space. The swap partition is smaller than 2 GB, which does not affect subsequent installation but may cause an error warning. To avoid errors, expand the swap partition.
[Root @ node1 ~] #Dd if =/dev/zero of =/u01/swpf1 bs = 1024 k count = 2048
// Use the dd command to generate an empty file and place it under u01. The unit is 1024 MB and the value is set to 2 GB. Note: Do not put it in the root directory will consume the root directory Space
[Root @ node1 ~] #Df-h// View disk space allocation again
[Root @ node1 ~] #Ls-lh/u01// View the file information under u01 and swpf1
[Root @ node1 ~] #Mkswap-c/u01/swpf1// Create a swap file
[Root @ node1 ~] #Swapon/u01/swpf1// Swap file generated by swpf1
[Root @ node1 ~] #Free-m// View the space again and switch the swap partition to 4 GB
[Root @ node1 ~] #Vi/etc/fstab// Automatically use the new swap partition after the instance is started.
Add/u01/swpf1 swap ults 0 0
Under node2:
[Root @ node2 ~] #
Free-m
[Root @ node2 ~] #Dd if =/dev/zero of =/u01/swpf1 bs = 1024 k count = 2048
[Root @ node2 ~] #Df-h// View disk space allocation again
[Root @ node2 ~] #Ls-lh/u01// View the file information under u01 and swpf1
[Root @ node2 ~] #Mkswap-c/u01/swpf1// Create a swap file
[Root @ node2 ~] #Swapon/u01/swpf1// Swap file generated by swpf1
[Root @ node2 ~] #Free-m// View the space again and switch the swap partition to 4 GB
[Root @ node2 ~] #Vi/etc/fstab// Automatically use the new swap partition after the instance is started.
Add/u01/swpf1 swap ults 0 0
******** ******************************
Statement:
Original works, from "Deep Blue blog" blog, allow reprint, reprint please be sure to indicate the source (http://blog.csdn.net/huangyanlong ). The author has the right to pursue legal liability for copyright issues.