1,系统依赖软件包安装
yum -y install bc gcc gcc-c++ binutils make gdb cmake glibc ksh elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc-devel libaio libaio-devel libXrender libXrender-devel libX11 libXau sysstat libXi libXtst libgcc librdmacm-devel libstdc++ libstdc++-devel libxcb net-tools nfs-utils compat-libcap1 compat-libstdc++ smartmontools targetcli python python-configshell python-rtslib python-six unixODBC unixODBC-devel
2,安装X11-Forwarding的支持
yum groupinstall "X Window System" -y
yum install xorg-x11-xauth xorg-x11-fonts-* xclock -y
3,用户建立
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmoper
groupadd -g 506 asmdba
useradd -g oinstall -G dba,asmdba,oper oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
mkdir /u01
chown grid:oinstall /u01/
4.rid安装选择软件:
[root@db01 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@db01 ~]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:
/u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
To configure Grid Infrastructure for a Cluster execute the following command:
/u01/app/11.2.0/grid/crs/config/config.sh
This command launches the Grid Infrastructure Configuration Wizard. The wizard also supports silent operation, and the parameters can be passed through the response file that is available in the installation media.
5,执行gi配置
[root@db01 ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node db01 successfully pinned.
Adding Clusterware entries to oracle-ohasd.service
db01 2021/11/15 20:55:59 /u01/app/11.2.0/grid/cdata/db01/backup_20211115_205559.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
6,集权状态检查
[grid@db01 ~]$ crsctl stat res -t
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
ora.ons
OFFLINE OFFLINE db01
Cluster Resources
ora.cssd
1 OFFLINE OFFLINE
ora.diskmon
1 OFFLINE OFFLINE
ora.evmd
1 ONLINE ONLINE db01
6,启动cssd
[grid@db01 ~]$ crsctl start resource ora.cssd
CRS-2672: Attempting to start 'ora.cssd' on 'db01'
CRS-2672: Attempting to start 'ora.diskmon' on 'db01'
CRS-2676: Start of 'ora.diskmon' on 'db01' succeeded
CRS-2676: Start of 'ora.cssd' on 'db01' succeeded
7.添加asm
[grid@db01 ~]$ export ORACLE_SID=+ASM
[grid@db01 ~]$ srvctl add asm
[grid@db01 grid]$ srvctl start asm
默认SID为+ASM
[grid@db01 ~]$ export ORACLE_SID=+ASM
状态检查
[grid@db01 grid]$ ps -ef|grep ASM
grid 6941 1 0 21:02 ? 00:00:00 asm_pmon_+ASM
grid 6943 1 0 21:02 ? 00:00:00 asm_psp0_+ASM
grid 6945 1 1 21:02 ? 00:00:01 asm_vktm_+ASM
grid 6949 1 0 21:02 ? 00:00:00 asm_gen0_+ASM
grid 6951 1 0 21:02 ? 00:00:00 asm_diag_+ASM
grid 6953 1 0 21:02 ? 00:00:00 asm_dia0_+ASM
grid 6955 1 0 21:02 ? 00:00:00 asm_mman_+ASM
grid 6957 1 0 21:02 ? 00:00:00 asm_dbw0_+ASM
grid 6959 1 0 21:02 ? 00:00:00 asm_lgwr_+ASM
grid 6961 1 0 21:02 ? 00:00:00 asm_ckpt_+ASM
grid 6963 1 0 21:02 ? 00:00:00 asm_smon_+ASM
grid 6965 1 0 21:02 ? 00:00:00 asm_rbal_+ASM
grid 6967 1 0 21:02 ? 00:00:00 asm_gmon_+ASM
grid 6969 1 0 21:02 ? 00:00:00 asm_mmon_+ASM
grid 6971 1 0 21:02 ? 00:00:00 asm_mmnl_+ASM
添
加
监听:
/u01/app/11.2.0/grid/bin/srvctl add LISTENER
必须添加LISTENER否则asm开启启动报错:
2021-11-15 23:30:12.969: USRTHRD{0:0:2} ASM Dedicated Thread {
2021-11-15 23:30:12.969: USRTHRD{0:0:2} CrsCmd::ClscrsCmdData::stat entity 1 statflag 32 useFilter 0
2021-11-15 23:30:12.985: USRTHRD{0:0:2} checkCrsStat 2 CLSCRS_STAT ret: 200
2021-11-15 23:30:12.985: USRTHRD{0:0:2} checkCrsStat 2 clscrs_res_get_op_status CLSCRS_STAT status 210 err_msg CRS-0210: Could not find resource 'ora.LISTENER.lsnr'.
2021-11-15 23:30:12.985: USRTHRD{0:0:2} CrsCmd::ClscrsCmdData::stat entity 1 statflag 33 useFilter 0
2021-11-15 23:30:13.005: USRTHRD{0:0:2} checkCrsStat 2 CLSCRS_STAT ret: 200
2021-11-15 23:30:13.005: USRTHRD{0:0:2} checkCrsStat 2 clscrs_res_get_op_status CLSCRS_STAT status 210 err_msg CRS-0210: Could not find resource 'ora.LISTENER.lsnr'.
2021-11-15 23:30:13.006: USRTHRD{0:0:2} AsmCommonAgent::setLocalListener cls::Exception CRS-0210: Could not find resource 'ora.LISTENER.lsnr'.
2021-11-15 23:30:13.006: USRTHRD{0:0:2} ASM Dedicated Thread }
2021-11-15 23:30:13.006: USRTHRD{0:0:2} Thread:ASM DedicatedThreadisRunning is reset to false here
数据库安装:选择single instanc
single instance database installation
[grid@db01 ~]$ asmcmd
ASMCMD> spget
?/dbs/spfile@.ora
ASMCMD> exit
[grid@db01 ~]$ srvctl add asm -h
Adds an ASM configuration to be managed by Oracle Restart.
Usage: srvctl add asm [-l <lsnr_name>] [-p ] [-d <asm_diskstring>]
-l <lsnr_name> Listener name
-p <spfile> Server parameter file path
-d <asm_diskstring> ASM diskgroup discovery string
-h Print usage
[grid@db01 ~]$ srvctl config asm
ASM home: /u01/app/11.2.0/grid
ASM listener: LISTENER
Spfile: ?/dbs/spfile@.ora
ASM diskgroup discovery string: ++no-value-at-resource-creation--never-updated-through-ASM++