数据库
首页 > 数据库> > centos7.3上安装oracle11.2.4RAC

centos7.3上安装oracle11.2.4RAC

作者:互联网

环境:centos7.3、oracle11.2.4、配置了yum仓库服务10.64.39.210、配置了ntp服务器10.64.39.138

直接获取脚本初始化系统配置oracle基础依赖

wget http://10.64.39.210/download/csh.sh
wget http://10.64.39.210/download/oracle-shel.sh
sh csh.sh
sh oracle-shel.sh

1、centos7.3基础环境初始化

cat csh.sh

#!/bin/bash

#关闭selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
rm -rf /etc/yum.repos.d/*
#配置yum
 

cat <<EOF >/etc/yum.repos.d/centos7.repo
[centos7]
name=centos7
baseurl=http://10.64.39.210/centos7
gpgcheck=0
enabled=1
EOF

yum clean all
yum makecache


#关闭防火墙
systemctl disable firewalld
systemctl stop firewalld

#安装快捷工具
yum -y install vim
yum -y install bash-completion
yum -y install lrzsz

#设置时区和ntp
timedatectl set-timezone Asia/Shanghai

cat <<EOF > /etc/chrony.conf

server 10.64.39.138
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
EOF

systemctl enable chronyd
systemctl restart chronyd

#安装java
yum -y install wget
mkdir /java
wget http://10.64.39.210/java/jdk.tar -P /java
tar -xvf /java/jdk.tar -C /java >/dev/null
rm -rf /java/jdk.tar

cat <<EOF >> /etc/profile

export JAVA_HOME=/java/jdk1.8.0_11
export JRE_HOME=/java/jdk1.8.0_11/jre
export CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib:\$CLASSPATH
export PATH=\$JAVA_HOME/bin:\$JRE_HOME/bin:\$PATH 
EOF

source /etc/profile

java -version

2、配置oracle的初始化环境

cat oracle-shel.sh

#!/bin/bash
#建用户和组
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmdba
groupadd -g 506 asmoper

#2.创建安装oracle的用户 
useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
useradd -u 502 -g oinstall -G dba,asmdba,oper oracle

#3.为 grid及 oracle用户设置密码
echo "grid" | passwd --stdin grid 
echo "oracle" | passwd --stdin oracle

#配置Linux内核参数

cat <<EOF >> /etc/sysctl.conf

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 90793041264 
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
EOF

#为 oracle 用户设置 shell limits. 

cat <<EOF >>/etc/security/limits.conf

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  2047
oracle              hard    nofile  65536
oracle              soft    stack   10240

grid              soft    nproc   2047
grid              hard    nproc   16384
grid              soft    nofile  2047
grid              hard    nofile  65536
grid              soft    stack   10240
EOF

#修改/etc/pam.d/login,如果不存在以下行,请加入

cat <<EOF >> /etc/pam.d/login

session    required     pam_limits.so
EOF
sysctl -p

#对默认 shell startup file 做变更,加入如下行到/etc/profie

cat <<EOF >> /etc/profile

if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then  
 if [ \$SHELL = "/bin/ksh" ]; then      
   ulimit -p 16384
   ulimit -n 65536
 else
   ulimit -u 16384 -n 65536
 fi
  umask 022
fi
EOF

source /etc/profile

#.创建 Oracle Inventory Directory  

mkdir -p /u01/oraInventory
chown -R grid:oinstall /u01/oraInventory
chmod -R 775 /u01/oraInventory

#创建 Oracle Grid Infrastructure home 目录

mkdir -p /u01/grid/11.2
chown -R grid:oinstall /u01/grid
chmod -R 775 /u01/grid

#创建 grid Base  目录
mkdir -p /u01/grid_base
chown -R grid:oinstall /u01/grid_base
chmod -R 775 /u01/grid_base

#创建 Oracle Base  目录

mkdir -p /u01/oracle
chown -R oracle:oinstall /u01/oracle
chmod -R 775 /u01/oracle/
mkdir -p /u01/oracle/cfgtoollogs
chown -R oracle:oinstall /u01/oracle/cfgtoollogs
chmod -R 775 /u01/oracle/cfgtoollogs
 

#创建 Oracle RDBMS home 目录 

mkdir -p  /u01/oracle/product/11.2.4/db_1
chown -R oracle:oinstall  /u01/oracle/product/11.2.4/db_1
chmod -R 775  /u01/oracle/product/11.2.4/db_1

3、asm、grid、oracle安装

1、执行oracle-csh.txt  
 上面执行了
2、安装依赖包
yum -y install binutils compat-libcap1 compat-libstdc* gcc gcc-c++* glibc glibc-devel ksh libgcc libstdc libaio libaio-devel make elfutils-libelf-devel sysstat

3、配置主机名称和hosts 配置ssh 互通
hostnamectl set-hostname lsrkzyk1
hostnamectl set-hostname lsrkzyk2

cat <<EOF >> /etc/hosts

#pub
80.128.0.202     lsrkzyk1  
80.128.0.203     lsrkzyk2  
#pri 
192.168.1.10        lsrkzyk1p
192.168.1.11        lsrkzyk2p
#vip
80.128.0.205     lsrkzyk1v 
80.128.0.206     lsrkzyk2v

#scan 
80.128.0.207      msrkscan

EOF

su - grid
ssh-keygen
ssh-copy-id grid@80.128.0.202
ssh-copy-id grid@80.128.0.203

ssh grid@80.128.0.202 date
ssh grid@80.128.0.203 date

ssh grid@lsrkzyk1 date
ssh grid@lsrkzyk2 date

ssh grid@lsrkzyk1p date
ssh grid@lsrkzyk2p date

su - oracle
ssh-keygen
ssh-copy-id oracle@80.128.0.202
ssh-copy-id oracle@80.128.0.203

ssh oracle@80.128.0.202 date
ssh oracle@80.128.0.203 date

ssh oracle@lsrkzyk1 date
ssh oracle@lsrkzyk2 date

ssh oracle@lsrkzyk1p date
ssh oracle@lsrkzyk2p date


5、配置grid 环境变量 和 oracle 环境变量
su - grid
vi .bash_profile

ORACLE_SID=+ASM1; export ORACLE_SID
ORACLE_BASE=/u01/grid_base; export ORACLE_BASE
ORACLE_HOME=/u01/grid/11.2; export ORACLE_HOME
GRID_HOME=/u01/grid/11.2; export GRID_HOME
THREADS_FLAG=native; export THREADS_FLAG
PATH=$ORACLE_HOME/bin:$PATH; export PATH
export LANG=en_us.UTF-8


su - oracle
vi .bash_profile

ORACLE_BASE=/u01/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.4/db_1; export ORACLE_HOME
ORACLE_SID=lsrkzyk1; export ORACLE_SID
export ORACLE_UNQNAME=msrkzyk
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
export LANG=en_us.UTF-8


当rac2节点配置完毕以后,修改oracle 、grid用户下的环境变量:

[root@node2 network-scripts]# vi /home/oracle/.bash_profile

将ORACLE_SID=snrk1 改为ORACLE_SID=snrk2

[root@node2 network-scripts]# vi /home/grid/.bash_profile

将ORACLE_SID=+ASM1 改为ORACLE_SID=+ASM2

统统设置完成后,建议重启一下第2 个节点。



---------asmlib方法一

6、安置oracle ASMlib  配置 ASM 磁盘

wget http://10.64.39.210/asmlib/asmlib.repo -P /etc/yum.repos.d/
yum clean all
yum install -y oracleasm-support oracleasmlib oracleasm


7、对共享磁盘进行分区
parted /dev/sdc
mklabel gpt
mkpart primary 20G  520G 
mkpart primary 520G  1020G 
mkpart primary 1020G  1520G 
mkpart primary 1520G  2020G 
mkpart primary 2020G  2520G 
mkpart primary 2520G  3020G 
mkpart primary 3020G  3520G 
mkpart primary 3520G  4020G 
mkpart primary 4020G  4520G 
mkpart primary 4520G  5020G 
mkpart primary 5020G  5520G 
mkpart primary 5520G  6020G 
mkpart primary 6020G  6520G 
mkpart primary 6520G  7020G 
mkpart primary 7020G  7520G 
mkpart primary 7520G  8020G 
mkpart primary 8020G  8520G 
mkpart primary 8520G  9020G 
mkpart primary 9020G  9520G 
mkpart primary 9520G  10020G 
mkpart primary 10020G  10520G 
mkpart primary 10520G  11020G 
mkpart primary 11020G  11950G 
p
quit

8、root 用户配置 ASMLib
先重启一下
/etc/init.d/oracleasm configure
grid
asmdba
y
y

9、设置共享磁盘
节点1

/usr/sbin/oracleasm createdisk OCR_VOTE /dev/sdb1
/usr/sbin/oracleasm createdisk ASMDATA /dev/sdb2
/usr/sbin/oracleasm createdisk BACKUP /dev/sdb3

节点2(rac2)上以root用户登录,使用scandisks命令扫描已经创建的ASM磁盘
也就是说,我们只需要在节点 1 上创建 ASM 磁盘,其他节点不需要。


/etc/init.d/oracleasm scandisks

Scanning the system for Oracle ASMLib disks:               [  OK  ]

/etc/init.d/oracleasm listdisks

ASMDATA
BACKUP
OCR_VOTE

ASM磁盘组配置完成。

systemctl status oracleasm
systemctl restart oracleasm
systemctl daemon-reload

--------------------------------------------
for i in {1..19}; do echo "ACTION==\"add\", KERNEL==\"sdc$i\", RUN+=\"/bin/raw /dev/raw/raw$i %N\"";done
vi /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="sdn1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdn2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdn3", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdn4", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdn5", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdn6", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sdn7", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", KERNEL=="sdn8", RUN+="/bin/raw /dev/raw/raw8 %N"
ACTION=="add", KERNEL=="sdn9", RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add", KERNEL=="sdn10", RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add", KERNEL=="sdn11", RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add", KERNEL=="sdn12", RUN+="/bin/raw /dev/raw/raw12 %N"
ACTION=="add", KERNEL=="sdn13", RUN+="/bin/raw /dev/raw/raw13 %N"
ACTION=="add", KERNEL=="sdn14", RUN+="/bin/raw /dev/raw/raw14 %N"
ACTION=="add", KERNEL=="sdn15", RUN+="/bin/raw /dev/raw/raw15 %N"
ACTION=="add", KERNEL=="sdn16", RUN+="/bin/raw /dev/raw/raw16 %N"
ACTION=="add", KERNEL=="sdn17", RUN+="/bin/raw /dev/raw/raw17 %N"
ACTION=="add", KERNEL=="sdn18", RUN+="/bin/raw /dev/raw/raw18 %N"
ACTION=="add", KERNEL=="sdn19", RUN+="/bin/raw /dev/raw/raw19 %N"
ACTION=="add", KERNEL=="sdn20", RUN+="/bin/raw /dev/raw/raw20 %N"
ACTION=="add", KERNEL=="sdn21", RUN+="/bin/raw /dev/raw/raw21 %N"
ACTION=="add", KERNEL=="sdn22", RUN+="/bin/raw /dev/raw/raw22 %N"
ACTION=="add", KERNEL=="sdn23", RUN+="/bin/raw /dev/raw/raw23 %N"
ACTION=="add", KERNEL=="sdn24", RUN+="/bin/raw /dev/raw/raw24 %N"
ACTION=="add", KERNEL=="sdn25", RUN+="/bin/raw /dev/raw/raw25 %N"
ACTION=="add", KERNEL=="raw[1-9]",OWNER="oracle",GROUP="oinstall",MODE="660"
ACTION=="add", KERNEL=="raw1[0-9]",OWNER="oracle",GROUP="oinstall",MODE="660"
ACTION=="add", KERNEL=="raw2[0-5]",OWNER="oracle",GROUP="oinstall",MODE="660"

60-raw.rules
udevadm trigger --action=add; ll /dev/raw
---------------udev方式2
--注意单个磁盘不能大于2T
--uedv
for i in {c1,c2,c3,c4,c5} 
   do echo "KERNEL==\"sd$i\", SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i\", RESULT==\"`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd${i:0:1}`\", SYMLINK+=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""      
   done;

vi /etc/udev/rules.d/60-raw.rules

KERNEL=="sdc1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc1", RESULT=="36000c2901e60ce42abd27813d3d273b1", SYMLINK+="asm-diskc1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc2", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc2", RESULT=="36000c2901e60ce42abd27813d3d273b1", SYMLINK+="asm-diskc2", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc3", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc3", RESULT=="36000c2901e60ce42abd27813d3d273b1", SYMLINK+="asm-diskc3", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc4", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc4", RESULT=="36000c2901e60ce42abd27813d3d273b1", SYMLINK+="asm-diskc4", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc5", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sdc5", RESULT=="36000c2901e60ce42abd27813d3d273b1", SYMLINK+="asm-diskc5", OWNER="grid", GROUP="asmadmin", MODE="0660"
systemctl restart systemd-udevd
--配置到/etc/rc.local中
chown -R grid:asmadmin /dev/asm-diskc1
chown -R grid:asmadmin /dev/asm-diskc2
chown -R grid:asmadmin /dev/asm-diskc3
chown -R grid:asmadmin /dev/asm-diskc4
chown -R grid:asmadmin /dev/asm-diskc5

ls /dev/asm*
-------------

rpm -qa|grep oracleasm
rpm -ivh kmod-oracleasm-2.0.8-22.el7.x86_64.rpm --nodeps --force
rpm -ivh kmod-oracleasm-2.0.8-16.1.el6_10.x86_64.rpm --nodeps --force
cd /usr/lib/modules


10、下载gird和oracle包
mkdir -p /home/grid/soft
mkdir -p /home/oracle/soft

wget -P /home/grid/soft http://10.64.39.210/download/p13390677_112040_Linux-x86-64_3of7.zip

wget -P /home/oracle/soft http://10.64.39.210/download/p13390677_112040_Linux-x86-64_1of7.zip

wget -P /home/oracle/soft http://10.64.39.210/download/p13390677_112040_Linux-x86-64_2of7.zip


chown -R grid:oinstall /home/grid/soft
chown -R oracle:oinstall /home/oracle/soft

11、安装cvu包

rac1和rac2节点上以 root 用户身份安装操作系统程序包cvuqdisk-1.0.9-1.rpm,此包位于grid安装包下rpm目录下。

rpm -ivh http://10.64.39.210/download/cvuqdisk-1.0.9-1.rpm
yum install -y http://10.64.39.210/download/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
rpm -ivh --force --nodeps http://10.64.39.210/download/pdksh-5.2.14-30.x86_64.rpm

12、rac1和rac2使用CUV验证硬件和操作系统配置

进入解压完毕的grid安装包目录下,执行

su - grid

cd grid

/home/grid/soft/grid/runcluvfy.sh stage -post hwos -n lsrkzyk1,lsrkzyk2 -verbose


lsrkzyk1和lsrkzyk2执行集群预检查


/home/grid/soft/grid/runcluvfy.sh stage -pre crsinst -n lsrkzyk1,lsrkzyk2 -verbose

全部为pass即通过,个别的如 dns  没通过(failed)可以忽略。






----------------------------
远程桌面
yum -y install tigervnc-server

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
---------------------------
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=root
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target
------------------------------
root用户vncpasswd
systemctl start vncserver@:1.service
----------------------------------------------
--安装界面不弹出界面
root下执行
echo $DISPLAY
xhost +
su - grid
export DISPLAY=(root的$DISPLAY)

-------------------------------------
--安装grid oracle(界面不规范)
1、./runInstaller -jreLoc /etc/alternatives/jre_1.8.0

2、设置电脑的分辨率和配置电源永不断开
mkdir -p /u01/oraInventory
chown grid:oinstall /u01/oraInventory/

3、执行root的时候ohas失败可以直接配置服务(开始是失败的,执行root后就启动成功了)
————————————————————————————————
cat <<EOF>/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

EOF

systemctl daemon-reload
systemctl start ohas.service
systemctl enable ohas.service
 
——————————————————————————————
grid 用户通过如下命令查看grid进程

crs_stat -v -t
crs_start –all 启动grid
crs_stop -all 停止grid

srvctl start
 

数据库 查看 数据库软件是否安置成功命令
/u01/oracle/product/11.2.4/db_1/OPatch/opatch lsinv
-----------------------------------------------------------------
查看ocr文件 数据文件 控制文件 redo文件


grid用户用asmcmd进入命令窗口

asmcmd
-------------
修改字符编码
数据库查看
 select userenv('language') from dual;
select userenv('language') from dual;
alter system set cluster_database=false scope=spfile;
shutdown immediate;
startup mount;

alter system enable restricted session;
alter system set job_queue_processes=0;
alter system set aq_tm_processes=0;
alter database open;
alter database CHARACTER set INTERNAL_USE AL32UTF8;
alter system set cluster_database=false scope=spfile;
shutdown immediate
startup
alter database CHARACTER set INTERNAL_USE ZHS16GBK;
----------------------------------------------------
--查看acfs文件系统信息
select name,path from v$asm_disk;
select name,total_mb from v$asm_diskgroup;
select * from v$asm_volume;
select * from v$asm_acfsvolumes;

---------------------------------
1、替换opatch 工具
wget http://10.64.39.210/download/p6880880_112000_Linux-x86-64.zip
unzip p6880880_112000_Linux-x86-64.zip

mv /u01/oracle/product/11.2.4/db_1/OPatch /u01/oracle/product/11.2.4/db_1/OPatchbak
mv /u01/grid/OPatch /u01/grid/OPatchbak
cp -r  OPatch /u01/oracle/product/11.2.4/db_1/OPatch
cp -r  OPatch /u01/grid/OPatch

chown -R oracle:oinstall /u01/oracle/product/11.2.4/db_1/OPatch
chown -R grid:oinstall /u01/grid/OPatch

 
2、打grid补丁
wget http://10.64.39.210/download/p25078431_11204160419forACFS_Linux-x86-64.zip
unzip p25078431_11204160419forACFS_Linux-x86-64.zip -d /tmp
chown grid: /u01/grid
su - grid

/u01/grid/OPatch/opatch apply  /tmp/25078431

----------------------------------------------------------------------------------
3、打oracle补丁
wget http://10.64.39.210/download/p27338049_112040_Linux-x86-64.zip
unzip p27338049_112040_Linux-x86-64.zip -d /tmp
su - oracle

/u01/oracle/product/11.2.4/db_1/OPatch/opatch apply /tmp/27338049

4、查看补丁
[grid@myrknew1:/oracle/grid/11g/OPatch]$ /u01/grid/OPatch/opatch lsinv

---------------------------------------------------------------------------------------

--安装acfs
---acfs安装 (asm clusert file system)
--查看是否支持该系统
都是root 用户执行

cd /u01/grid/install/usm
tree -L 3 Oracle Novell

/u01/grid/bin/acfsdriverstate supported

 find / -name osds_acfslib.pm
cp /u01/grid/lib/osds_acfslib.pm /u01/grid/lib/osds_acfslib.pm.bak
vi /u01/grid/lib/osds_acfslib.pm
vi /u01/oracle/product/11.2.4/db_1/lib/osds_acfslib.pm


 if ((defined($release)) &&                     # Redhat or OEL if defined
      (($release =~ /^redhat-release/) ||        # straight RH
       ($release =~ /^enterprise-release/) ||    # Oracle Enterprise Linux
        ($release =~ /^centos-release/) ||        # CentOS hack  --添加
       ($release =~ /^oraclelinux-release/)))    # Oracle Linux

1、安装acfs
find / -name acfsroot 
/u01/grid/bin/acfsroot install
2、启动acfs
find / -name acfsload
/u01/grid/bin/acfsload start -s

------------------------------------------------------------------------------
--换取内核
yum -y install http://10.64.39.210/centos7/Packages/kernel-3.10.0-514.el7.x86_64.rpm
rpm -qa|grep kernel

grub2-editenv list

cat /boot/grub2/grub.cfg |grep menuentry
grub2-set-default 

——————————————————————————
su - grid -c 'crs_stat -v -t'
grid 启动数据库
srvctl start database -d lsrkzyk  
srvctl stop database -d dzrkzyk  
srvctl start database -d dzrkzyk
crsctl status resource ora.lsrkzyk.db -f

srvctl start instance -d lsrkzyk -i lsrkzyk1

su - grid -c 'crs_stat -v -t'
su - grid -c 'srvctl start database -d lsrkzyk'

su - grid -c 'crsctl status res -t'

su - grid -c 'srvctl start instance -d msrkzyk -i lsrkzyk2'
 
crsctl stat res -t -init
crsctl check crs
root启动crs
su - root
cd $ORACLE_HOME/bin
./crsctl start crs

----------------
--实例启动提示
ora-01078:failure in processing system parameters
ora-01565:error in identifying file '\+DATA/RACDB/spfileDB.ora'
ora-17503:ksfdopn:2 failed to open file +DATA/RACDB/spfileDB.ora
ora-12547:TNS:lost contact

--或者client连接报ora-12537:TNS:connection closed

1、检查两节点oracle、grid用户组 是否有asmdba dba oinstall
2、赋予oracle.grid 权限 
chmod 6755  $ORACLE_HOME/bin/oracle
--chmod 6755 /u01/grid/bin/oracle
 
--------------------------------
--最后配置

cat <<EOF>> /etc/rc.local

/u01/grid/bin/acfsload start -s

chown -R grid:asmadmin /dev/asm-diskc1
chown -R grid:asmadmin /dev/asm-diskc2
chown -R grid:asmadmin /dev/asm-diskc3
chown -R grid:asmadmin /dev/asm-diskc4
chown -R grid:asmadmin /dev/asm-diskc5
sleep 20
mount.acfs -o all

EOF

chmod 755 /etc/rc.d/rc.local

srvctl status listener

-----------------------------

chown oracle:asmadmin /dev/asm/ogg-416
chown oracle:asmadmin /dev/asm/pic-416

ll /data_pic

_____________________________
--修改sga 
alter system set sga_target=20000M scope=spfile sid='*';
alter system set sga_max_size=20000M scope=spfile sid='*';

show parameter sga;

alter system set workarea_size_policy=auto scope=both sid='*';
alter system set pga_aggregate_target=10000M scope=both sid='*';
show parameter pga;

shutdown immediate;
startup

show parameter sort;

alter session set sort_area_size=104857600;

srvctl stop database -d msrkzyk  
srvctl start database -d msrkzyk

select count(*) from v$process;
select value from v$parameter where name ='processes';
--修改连接数
alter system set session_cached_cursors=1000 scope=spfile sid='*';
alter system set session_max_open_files=1000 scope=spfile sid='*';
alter system set sessions=1105 scope=spfile  sid='*';
alter system set license_max_sessions=1000 scope=spfile sid='*';
alter system set license_sessions_warning=1000 scope=spfile sid='*';
alter system set processes=1000 scope=spfile sid='*';


select value from v$parameter where name ='processes';

---------------------
--orqcle用户过期处理 (方法一)
--查看数据库密码过期时间

sqlplus / as sysdba

select * from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_LIFE_TIME';
alter profile default limit password_life_time unlimited;
修改前已经过期了的需要再次修改密码。
alter user  user_name identified by user_passwd;

__________________________________
--解决密码过期(sys用户) (方法二)
1、创建一个profile(相当于创建一个角色)
create profile  passwd_unlimit limit  PASSWORD_LIFE_TIME unlimited;
ALTER profile  passwd_unlimit limit COMPOSITE_LIMIT          UNLIMITED; 
ALTER profile  passwd_unlimit limit SESSIONS_PER_USER        UNLIMITED; 
ALTER profile  passwd_unlimit limit CPU_PER_SESSION          UNLIMITED; 
ALTER profile  passwd_unlimit  limit CPU_PER_CALL             UNLIMITED; 
ALTER profile  passwd_unlimit  limit LOGICAL_READS_PER_SESSION UNLIMITED; 
ALTER profile  passwd_unlimit  limit LOGICAL_READS_PER_CALL   UNLIMITED; 
ALTER profile  passwd_unlimit limit IDLE_TIME                UNLIMITED; 
ALTER profile  passwd_unlimit limit CONNECT_TIME             UNLIMITED; 
ALTER profile  passwd_unlimit  limit PRIVATE_SGA              UNLIMITED; 
ALTER profile  passwd_unlimit limit FAILED_LOGIN_ATTEMPTS    10      ; 
ALTER profile  passwd_unlimit limit PASSWORD_REUSE_TIME      UNLIMITED; 
ALTER profile  passwd_unlimit limit PASSWORD_REUSE_MAX       UNLIMITED; 
ALTER profile  passwd_unlimit  limit PASSWORD_VERIFY_FUNCTION NULL    ; 
ALTER profile  passwd_unlimit  limit PASSWORD_LOCK_TIME       1       ; 
ALTER profile  passwd_unlimit  limit PASSWORD_GRACE_TIME      7       ; 

2、用户改成这个角色
alter user  SCRK5109_QRY  profile   passwd_unlimit; 
3、查看用户角色
SELECT  *  FROM  dba_profiles;
select  *  from  dba_users;
select  username, user_id, account_status, expiry_date, profile  from  dba_users;

---后期修改数据库时区-(先改系统时区)
select dbtimezone,systimestamp from dual;
+08:00
29-JUL-19 09.40.03.769147 AM +08:00

select sysdate from dual;

alter database set time_zone='+8:00';
--grid 用户
srvctl stop database -d msrkzyk  
srvctl start database -d msrkzyk


--aix ntp
startsrc -s xntpd
stopsrc -s xntpd

lssrc -ls xntpd
xntpdc -c peers

---------------------------------------------------------------------
acfs 更换挂载点
root 下
1、取消两个节点的挂载
umount /挂载目录
2、取消acfs文件的注册
acfsutil registry -d /u01
3、删除acfs系统
acfsutil rmfs /dev/asm/asm_pic
4、查看asm volume 信息
su - grid
asmcmd
 volinfo -G ACF -a
5、禁用asm volume

voldisable -G ACFS ACFS  -- 前一个是disgroup name 后一个acfs是volume name
volinfo  -G ACFS -a
6、删除asm volume
voldelete -G ACFS ACFS
volinfo  -G ACFS -a


-------------------------------------------------------------
定时调动执行不起
SQL> alter system set job_queue_processes=1000;

System altered.

SQL> show parameter queue_processes

---------------------------------------------
rman 修改备份文件路径并备份
alter system set events '10298 trace name context forever,level 32';
configure channel 1 device type disk format '/data/%d_db_%u.dmp';
configure channel 2 device type disk format '/data/%d_db_%u.dmp';
backup database plus archivelog delete input;


create script full_backup {
allocate channel c1 device type disk format '/data/%d_db1_%u.dmp';
allocate channel c2 device type disk format '/data/%d_db2_%u.dmp';
backup database;
release channel c1;
release channel c1;
}

run {
allocate channel c1 device type disk format '/data/%d_db1_%u.dmp';
allocate channel c2 device type disk format '/data/%d_db2_%u.dmp';
backup database;
release channel c1;
release channel c1;
}

  

  

  

 

标签:oracle11.2,4RAC,--,dev,raw,grid,oracle,centos7.3,u01
来源: https://www.cnblogs.com/wukc/p/14176895.html