ASM+LINUX+ORACLE_11G安装

本文详细记录了在Linux环境下安装和配置Oracle数据库的过程,包括系统用户和组的创建、目录权限设置、环境变量配置、依赖软件包安装、ASM磁盘创建、数据库实例安装及常见错误解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需求:
1.数据文件放ASM,归档放文件系统(LVM)
2.单实例安装

步骤: 
groupadd oinstall;
groupadd dba;
groupadd oper;
groupadd asmadmin;
groupadd asmoper;
groupadd asmdba;


useradd -g oinstall -G dba,asmdba,oper,asmadmin oracle;
useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid;


passwd oracle
passwd grid

mkdir -p /u01/app/oracle;
mkdir -p /u01/app/grid;
mkdir -p /u01/app/grid/11.2.0;
mkdir -p /u01/app/11.2.0;

chown -R grid:oinstall /u01/app/grid;
chown -R grid:oinstall /u01/app/11.2.0;
chown -R oracle:oinstall /u01/app/oracle;
chmod -R 775 /u01;

oracle:

export PATH
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

grid:

export PATH
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/11.2.0/grid
export ORACLE_HOME=/u01/app/grid/11.2.0
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
source /home/grid/.bash_profile
source /home/oracle/.bash_profile
--udev---
/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb1
/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb2
------
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
---
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c294227fe47b6f93980cc5d80c82", SYMLINK+="asm-diskb", OWNER="grid", GROUP="asmdba", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29f70e434e69cff046c2b81c521", SYMLINK+="asm-diskc", OWNER="grid", GROUP="asmdba", MODE="0660"

/sbin/udevadm trigger --type=devices --action=change
---(获取不到uuid按如下处理)---
udevadm info -a /sys/block/vdc
KERNEL=="vdc1"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{ro}=="0"
    ATTR{size}=="2147483648"
    ATTR{stat}=="      50        0     4160       48        0        0        0        0        0       39       45"
    ATTR{partition}=="1"
    ATTR{start}=="2048"
    ATTR{discard_alignment}=="0"
    ATTR{alignment_offset}=="0"
    ATTR{inflight}=="       0        0"

KERNEL=="vdc1", SUBSYSTEM=="block",ATTR{size}=="2147483648",ATTR{start}=="2048", SYMLINK+="asm-diskvdc1", OWNER="grid", GROUP="asmdba", MODE="0660"

KERNEL=="sde2", SUBSYSTEM=="block",ATTR{size}=="8388608",ATTR{start}=="10487808", SYMLINK+="asm-disksde2", OWNER="grid", GROUP="asmdba", MODE="0660"
---vi /etc/security/limits.conf---
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 1024
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 1024

---vi /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
---------------


---vi /etc/pam.d/login--
session required /lib64/security/pam_limits.so


---vi etc/sysctl.conf---
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 = 1048576

-----
sysctl -p
------
Red Hat Enterprise Linux 7

binutils-2.23.52.0.1-30.el7.s390x
compat-libcap1-1.10-7.el7.s390x
cpp-4.8.2-16.el7.s390x
gcc-4.8.3-9.el7.s390x
gcc-c++-4.8.3-9.el7.s390x
glibc-2.17-78.el7.s390
glibc-2.17-78.el7.s390x
glibc-devel-2.17-78.el7.s390
glibc-devel-2.17-78.el7.s390x
glibc-headers-2.17-55.el7.s390x
ksh-20120801-22.el7.s390x
libaio-0.3.109-12.el7.s390
libaio-0.3.109-12.el7.s390x
libaio-devel-0.3.109-12.el7.s390
libaio-devel-0.3.109-12.el7.s390x
libgcc-4.8.3-9.el7.s390
libgcc-4.8.3-9.el7.s390x
libstdc++-4.8.3-9.el7.s390
libstdc++-4.8.3-9.el7.s390x
libstdc++-devel-4.8.3-9.el7.s390
libstdc++-devel-4.8.3-9.el7.s390x
libXi-1.2.2-2.1.el7.s390
libXi-1.2.2-2.1.el7.s390x
libXtst-1.2.2-2.1.el7.s390
libXtst-1.2.2-2.1.el7.s390x
make-3.82-21.el7.s390x
mpfr-3.1.1-4.el7.s390x
sysstat-10.1.5-7.el7.s390x

unixODBC-2.3.1-11 (32 bit) or later
unixODBC-2.3.1-11 (64 bit) or later
unixODBC-devel-2.3.1-11 (32 bit) or later
unixODBC-devel-2.3.1-11 (64 bit) or later

----jdbc/ocidrivers
JDK 6 SR16 FP1 or higher
JDK 5 SR16 FP3 or higher


rpm -qa |grep binutils && echo "binutils..is ok" || yum install binutils*;
rpm -qa|grep cpp && echo "cpp..is ok" || yum install cpp*;
rpm -qa|grep gcc-c++ && echo "gcc-c++..is ok" || yum install gcc-c++*;
rpm -qa|grep gcc-4 && echo "gcc..is ok" || yum install gcc-4*;
rpm -qa|grep glibc-2 && echo "glibc..is ok" || yum install glibc-2*;
rpm -qa|grep glibc-devel && echo "glibc-devel..is ok" || yum install glibc-devel*;
rpm -qa|grep glibc-headers && echo "glibc-headers..is ok" || yum install glibc-headers*;
rpm -qa|grep ksh && echo "ksh..is ok" || yum install ksh*;
rpm -qa|grep libaio && echo "libaio..is ok" || yum install libaio*;
rpm -qa|grep libaio && echo "libaio-dev..is ok" || yum install libaio-dev*;
rpm -qa|grep libgcc && echo "libgcc..is ok" || yum install libgcc*;
rpm -qa|grep libstdc++-devel && echo "libstdc++-devel..is ok" || yum install libstdc++-devel*;
rpm -qa|grep libstdc++-4 && echo "libstdc++..is ok" || yum install libstdc++-4*;
rpm -qa|grep libXi-1 && echo "libXi..is ok" || yum install libXi-1*;
rpm -qa|grep libXtst && echo "libXtst..is ok" || yum install libXtst*;
rpm -qa|grep make && echo "make..is ok" || yum install make*;
rpm -qa|grep mpfr && echo "mpfr..is ok" || yum install mpfr*;
rpm -qa|grep sysstat && echo "make..is ok" || yum install sysstat*;
rpm -qa|grep unixODBC-2 && echo "unixODBC..is ok" || yum install unixODBC-2*;
rpm -qa|grep unixODBC-devel && echo "unixODBC-devel..is ok" || yum install unixODBC-devel*;
yum install gcc gcc-c++ perl make kernel-headers kernel-devel
yum install perl-Env
yum install xorg-x11-apps*
yum install xorg-x11-xauth
yum install elfutils-libelf-devel
yum install compat-libcap1
-------
问题1:
[INS-32031] Invalid inventory location.
[INS-32033] Central Inventory location is not writable.
解决:chown -R grid:oinstall /u01/app/11.2.0/

问题2:
执行--->/u01/app/grid/11.2.0/perl/bin/perl -I/u01/app/grid/11.2.0/perl/lib -I/u01/app/grid/11.2.0/crs/install /u01/app/grid/11.2.0/crs/install/roothas.pl
报错:
Using configuration parameter file: /u01/app/grid/11.2.0/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
/u01/app/grid/11.2.0/bin/clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory
Failed to create keys in the OLR, rc = 127, Message:
   

Failed to create keys in the OLR at /u01/app/grid/11.2.0/crs/install/crsconfig_lib.pm line 7660.
解决1:yum install compat-libcap1
执行:/u01/app/grid/11.2.0/perl/bin/perl -I/u01/app/grid/11.2.0/perl/lib -I/u01/app/grid/11.2.0/crs/install /u01/app/grid/11.2.0/crs/install/roothas.pl -verbose -deconfig -force

执行:

---解决:Oracle Grid Infrastructure is not configured properly
/u01/app/grid/11.2.0/crs/install/roothas.pl
报错1:: /usr/bin/perl: bad interpreter: No such file or directory
 解决:yum install gcc gcc-c++ perl make kernel-headers kernel-devel 
报错2:Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /u01/app/grid/11.2.0/crs/install) at /u01/app/grid/11.2.0/crs/install/crsconfig_lib.pm line 703.
BEGIN failed--compilation aborted at /u01/app/grid/11.2.0/crs/install/crsconfig_lib.pm line 703.
Compilation failed in require at /u01/app/grid/11.2.0/crs/install/roothas.pl line 166.
BEGIN failed--compilation aborted at /u01/app/grid/11.2.0/crs/install/roothas.pl line 166.
解决:yum install perl-Env
报错3:Adding Clusterware entries to inittab
ohasd failed to start
Failed to start the Clusterware.
解决:(以下,root.sh时先步执行)
touch /usr/lib/systemd/system/ohas.service


chmod 777 /usr/lib/systemd/system/ohas.service




往ohas.service服务文件添加启动ohasd的相关信息

vi /usr/lib/systemd/system/ohas.service
内容:
[Unit]
Description=Oracle High Availability Services
After=syslog.target

[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Restart=always

[Install]
WantedBy=multi-user.target




重新加载守护进程:
systemctl daemon-reload

设置守护进程自动启动:
systemctl enable ohas.service

手工启动ohas服务:
systemctl start ohas.service

回滚:/u01/app/grid/11.2.0/crs/install/roothas.pl
执行:/u01/app/grid/11.2.0/crs/install/roothas.pl -verbose -deconfig -force
重新执行:/u01/app/grid/11.2.0/crs/install/roothas.pl

问题3.卸载了,gi,重新安装报如下错误
[root@bdcdatabase ~]# /u01/app/grid/11.2.0/crs/install/roothas.pl
Using configuration parameter file: /u01/app/grid/11.2.0/crs/install/crsconfig_params
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 bdcdatabase successfully pinned.
Adding Clusterware entries to inittab
ohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow: 
2019-11-22 16:39:57.835: 
[client(30156)]CRS-1001:The OCR was formatted using version 3.
2019-11-22 03:50:04.690: 
[ohasd(30259)]CRS-0715:Oracle High Availability Service has timed out waiting for init.ohasd to be started.
[client(31507)]CRS-10001:22-Nov-19 16:52 ACFS-9459: ADVM/ACFS is not supported on this OS version: 'centos-release-7-6.1810.2.el7.centos.x86_64
'
[client(31509)]CRS-10001:22-Nov-19 16:52 ACFS-9201: Not Supported
2019-11-22 16:55:11.945: 
[client(31834)]CRS-2101:The OLR was formatted using version 3.
2019-11-22 16:55:12.725: 
[client(31880)]CRS-1001:The OCR was formatted using version 3.
2019-11-22 04:05:19.577: 
[ohasd(32002)]CRS-0715:Oracle High Availability Service has timed out waiting for init.ohasd to be started.
[client(699)]CRS-10001:22-Nov-19 17:06 ACFS-9459: ADVM/ACFS is not supported on this OS version: 'centos-release-7-6.1810.2.el7.centos.x86_64
'
[client(701)]CRS-10001:22-Nov-19 17:06 ACFS-9201: Not Supported
2019-11-22 17:08:15.455: 
[client(869)]CRS-2101:The OLR was formatted using version 3.
2019-11-22 17:08:16.190: 
[client(915)]CRS-1001:The OCR was formatted using version 3.

ohasd failed to start at /u01/app/grid/11.2.0/crs/install/roothas.pl line 377, <ALERTLOG> line 33.
[root@bdcdatabase ~]# systemctl status ohas.service
● ohas.service - Oracle High Availability Services
   Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Fri 2019-11-22 16:54:55 CST; 16min ago
 Main PID: 31808 (code=exited, status=203/EXEC)

Nov 22 16:54:55 bdcdatabase systemd[1]: Unit ohas.service entered failed state.
Nov 22 16:54:55 bdcdatabase systemd[1]: ohas.service failed.
Nov 22 16:54:55 bdcdatabase systemd[1]: ohas.service holdoff time over, scheduling restart.
Nov 22 16:54:55 bdcdatabase systemd[1]: Stopped Oracle High Availability Services.
Nov 22 16:54:55 bdcdatabase systemd[1]: start request repeated too quickly for ohas.service
Nov 22 16:54:55 bdcdatabase systemd[1]: Failed to start Oracle High Availability Services.
Nov 22 16:54:55 bdcdatabase systemd[1]: Unit ohas.service entered failed state.
Nov 22 16:54:55 bdcdatabase systemd[1]: ohas.service failed.
[root@bdcdatabase ~]# systemctl start ohas.service
[root@bdcdatabase ~]# systemctl status ohas.service
● ohas.service - Oracle High Availability Services
   Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-11-22 17:11:14 CST; 2s ago
 Main PID: 1337 (init.ohasd)
   CGroup: /system.slice/ohas.service
           └─1337 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple

Nov 22 17:11:14 bdcdatabase systemd[1]: Started Oracle High Availability Services.
Nov 22 17:11:14 bdcdatabase su[1357]: (to grid) root on none
说明:ohas。service已经起来,回滚操作,重新执行。如下
[root@bdcdatabase ~]# /u01/app/grid/11.2.0/crs/install/roothas.pl -verbose -deconfig -force
Using configuration parameter file: /u01/app/grid/11.2.0/crs/install/crsconfig_params
CRS-2613: Could not find resource 'ora.cssd'.
CRS-4000: Command Stop failed, or completed with errors.
CRS-2613: Could not find resource 'ora.cssd'.
CRS-4000: Command Delete failed, or completed with errors.
CRS-4133: Oracle High Availability Services has been stopped.
Successfully deconfigured Oracle Restart stack
[root@bdcdatabase ~]# systemctl status ohas.service
● ohas.service - Oracle High Availability Services
   Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-11-22 17:11:14 CST; 51s ago
 Main PID: 1337 (init.ohasd)
   CGroup: /system.slice/ohas.service
           ├─1337 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
           └─1679 /bin/sleep 10

Nov 22 17:11:14 bdcdatabase systemd[1]: Started Oracle High Availability Services.
Nov 22 17:11:14 bdcdatabase su[1357]: (to grid) root on none
[root@bdcdatabase ~]# /u01/app/grid/11.2.0/crs/install/roothas.pl
Using configuration parameter file: /u01/app/grid/11.2.0/crs/install/crsconfig_params
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 bdcdatabase successfully pinned.
Adding Clusterware entries to inittab

bdcdatabase     2019/11/22 04:12:41     /u01/app/grid/11.2.0/cdata/bdcdatabase/backup_20191122_041241.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
[root@bdcdatabase ~]# 


---创建ASM磁盘---




---oracle安装----
86%时,报错:
Error in invoking target 'agent nmhs' of makefile
解决:
cp /u01/app/oracle/product/11.2.0/db_1/sysman/lib/{ins_emagent.mk,ins_emagent.mk_bk}
vi ins_emagent.mk
1./NMECTL
2.追加 -lnnz11  ($(MK_EMAGENT_NMECTL) -lnnz11)

--完成安装

---DBCA---
PRCR-1079 CRS-2800
 Failed to start resource: Name: ora.orcl.db, node: null, filter: null, msg CRS-2800: Cannot start resource 'ora.DATA.dg' as it is already in the INTERMEDIATE state on server 'localhost'
[Thread-249] [ 2019-11-08 03:27:21.760 CST ] [PostDBCreationStep.executeImpl:893]  Exception while Starting with HA Database Resource PRCR-1079 : Failed to start resource ora.orcl.db

解决:
[oracle@rtest bin]$ ls -ltr $ORACLE_HOME/bin/oracle

-r-xrws--x?1 oracle?asmadmin?232399473 Jun 20 08:38 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle




[grid@rtest bin]$ ls -ltr $ORACLE_HOME/bin/oracle

-rwsr-s--x?1 grid?oinstall?203972955 Oct 23 11:25 /u01/app/grid/product/11.2.0/grid/bin/oracle


[oracle@rtest bin]$?chown oracle:oinstall $ORACLE_HOME/bin/oracle?


[oracle@rtest bin]$ ls -ltr $ORACLE_HOME/bin/oracle

-rwxr-x--x?1 oracle oinstall 232399473 Jun 20 08:38 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle


[oracle@rtest bin]$ ?chmod 6751 $ORACLE_HOME/bin/oracle??
[oracle@rtest bin]$ ls -ltr $ORACLE_HOME/bin/oracle

-rwsr-s--x?1 oracle oinstall 232399473 Jun 20 08:38 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle

(oracle,grid)bash_profile:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

命令:
crs_stat -t
select name,total_mb from v$asm_diskgroup;
select name,group_number,file_number,alias_index,alias_directory,system_created from v$asm_alias;



CRS-4638: Oracle High Availability Services is online
CRS-212: Resource 'ora.crsd' is not registered.
PRCI-1123 : CRS home does not exist on the local node


lvm配置:
pvcreate /dev/sdd /dev/sde
vgcreate /dev/sdd /dev/sde
lvcreate -n orcl -L 19G oracle
mkfs.ext4 /dev/oracle/orcl
mount /dev/oracle/orcl /orcl

vi /etc/fstab
/dev/oracle/orcl /orcl ext4 default 0 0

完成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值