记录一下oracle 19c standalone(单机asm)静默安装的流程,方便遇到这个场景的时候可以快速部署上。以下配置经过测试环境多次试错得出,如果有相同环境,改改ip主机名磁盘组应该就能直接用。
一、环境
centos 7.7 内存8g
磁盘组:dg_redo 1gx3 \ dg_data 10gx2
二、配置
1.hosts文件
--替换ip 主机名
echo "192.168.10.8 xkdg" >> /etc/hosts
cat /etc/hosts
2.语言环境
--root
echo "export lang=en_us.utf8" >> ~/.bash_profile
cat ~/.bash_profile
source .bash_profile
3.创建用户、组和目录
--组
/usr/sbin/groupadd -g 60001 oinstall
/usr/sbin/groupadd -g 60002 dba
/usr/sbin/groupadd -g 60003 oper
/usr/sbin/groupadd -g 60004 backupdba
/usr/sbin/groupadd -g 60005 dgdba
/usr/sbin/groupadd -g 60006 kmdba
/usr/sbin/groupadd -g 60007 asmdba
/usr/sbin/groupadd -g 60008 asmoper
/usr/sbin/groupadd -g 60009 asmadmin
--用户
useradd -u 61001 -g oinstall -g dba,asmdba,backupdba,dgdba,kmdba,oper oracle
useradd -u 61002 -g oinstall -g asmadmin,asmdba,asmoper,dba grid
--设密码
passwd grid
passwd oracle
--建目录
mkdir -p /u01/app/19.0.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
mkdir -p /u01/app/orainventory
chown -r grid:oinstall /u01
chmod -r 775 /u01
chown -r oracle:oinstall /u01/app/oracle
chown -r grid:oinstall /u01/app/orainventory
4.yum源
--虚拟机环境记得先把盘挂上,再mount
mount /dev/sr0 /mnt
cd /etc/yum.repos.d
rm -rf *
cat <> mnt.repo
[mnt]
name=mnt
baseurl=file:///mnt
gpgcheck=0
enabled=1
eof
yum clean all
yum makecache
5.rpm包
下面应该是全了,如果在precheck环节检查出还有缺的,再单个装吧
yum -y install bc gcc gcc-c binutils compat-libcap1 compat-libstdc dtrace-modules dtrace-modules-headers
dtrace-modules-provider-headers dtrace-utils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel
ksh libaio libaio-devel libdtrace-ctf-devel libx11 libxau libxi libxtst libxrender libxrender-devel libgcc librdmacm-devel
libstdc libstdc -devel libxcb make smartmontools sysstat
yum -y install kmod*
yum -y install ksh*
yum -y install libaio*
yum -y install compat*
注意:compat-libstdc -33-3.2.3-69.el6.x86_64.rpm得单独找来装上
6.修改资源参数
--加到最后,单位kb
vi /etc/security/limits.conf
#setting for oracle
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 65536
grid hard nofile 65536
grid soft stack 32768
grid hard stack 32768
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft stack 32768
oracle hard stack 32768
oracle hard memlock unlimited
oracle soft memlock unlimited
--控制给用户分配的资源
echo "session required pam_limits.so" >> /etc/pam.d/login
cat /etc/pam.d/login
7.修改内核参数
vi /etc/sysctl.conf
# oracle install config
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
kernel.panic_on_oops = 1
kernel.shmmax = 5033164800
kernel.shmall = 1228800
kernel.shmmni = 4096
##huge page
vm.nr_hugepages = 2500
--生效
sysctl -p
8.关闭透明大页
cat /sys/kernel/mm/transparent_hugepage/defrag [always] madvise never cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never vi /etc/rc.d/rc.local if test -f /sys/kernel/mm/transparent_hugepage/enabled;then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag;then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi chmod x /etc/rc.d/rc.local
9.关闭numa
vi /etc/default/grub
在grub_cmdline_linux="crashkernel=auto rhgb quiet numa=off" 这一行加上numa=off
--重新编译
grub2-mkconfig -o /etc/grub2.cfg
10.共享内存段
vi /etc/fstab
none /dev/shm tmpfs defaults,size=6g 0 0
--生效
mount -o remount /dev/shm
注意:这里记录一下,配置完df -h能看到确实生效了,但是安装前检查还是有这个提示,得空再瞅瞅
11.禁用selinux,关闭防火墙
--禁用selinux
setenforce 0
vi /etc/selinux/config
--更改以下内容为disabled,重启操作系统才生效
selinux=disabled
--关闭防火墙:
systemctl stop firewalld
--禁止开机启动:
systemctl disable firewalld.service
12.配置环境变量
--grid
su - grid
vi ~/.bash_profile
export oracle_base=/u01/app/grid
export oracle_home=/u01/app/19.0.0/grid
export oracle_sid= asm
export lang=en_us.utf8
export nls_date_format="yyyy-mm-dd hh24:mi:ss"
export path=.:${path}:$home/bin:$oracle_home/bin:$oracle_home/opatch
export path=${path}:/usr/bin:/bin:/usr/bin/x11:/usr/local/bin
export path=${path}:$oracle_base/common/oracle/bin
export oracle_term=xterm
export ld_library_path=$oracle_home/lib
export ld_library_path=${ld_library_path}:$oracle_home/oracm/lib
export ld_library_path=${ld_library_path}:/lib:/usr/lib:/usr/local/lib
export classpath=$oracle_home/jre
export classpath=${classpath}:$oracle_home/jlib
export classpath=${classpath}:$oracle_home/rdbms/jlib
export classpath=${classpath}:$oracle_home/network/jlib
export threads_flag=native
export temp=/tmp
export tmpdir=/tmp
alias s='sqlplus / as sysdba'
umask 022
export tmout=0
--oracle 改sid、uniquename
su - oracle
vi ~/.bash_profile
export oracle_base=/u01/app/oracle
export oracle_home=$oracle_base/product/19.0.0/dbhome_1
export oracle_sid=xkdg
export oracle_unqname=xkdg
export lang=en_us.utf-8
export nls_lang=american_america.utf8
export nls_date_format="yyyy-mm-dd hh24:mi:ss"
export path=.:${path}:$home/bin:$oracle_home/bin:$oracle_home/opatch
export path=${path}:/usr/bin:/bin:/usr/bin/x11:/usr/local/bin
export path=${path}:$oracle_base/common/oracle/bin:/home/oracle/run
export oracle_term=xterm
export ld_library_path=$oracle_home/lib
export ld_library_path=${ld_library_path}:$oracle_home/oracm/lib
export ld_library_path=${ld_library_path}:/lib:/usr/lib:/usr/local/lib
export classpath=$oracle_home/jre
export classpath=${classpath}:$oracle_home/jlib
export classpath=${classpath}:$oracle_home/rdbms/jlib
export classpath=${classpath}:$oracle_home/network/jlib
export threads_flag=native
export temp=/tmp
export tmpdir=/tmp
export gi_home=/u01/app/19.0.0/grid
export path=${path}:$gi_home/bin
export ora_nls10=$gi_home/nls/data
umask 022
export tmout=0
13.虚拟机添加磁盘
vmware关虚拟机添加磁盘
dg_redo 1gx3
dg_data 10gx2
加完记得修改虚拟机存放文件夹下的.vmx文件,添加
disk.enableuuid = “true”
14.udev配置
好用来源:https://www.modb.pro/issue/2279
1. 生成规则文件
touch /etc/udev/rules.d/99-oracle-asmdevices.rules
或者
touch /usr/lib/udev/rules.d/99-oracle-asmdevices.rules
2. 生成规则
没有对sdb进行分区,执行如下shell脚本,
for i in b c d e f;
do
echo "kernel==\"sd*\", subsystem==\"block\", program==\"/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", result==\"`/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", symlink =\"asm-disk$i\", owner=\"grid\", group=\"asmadmin\", mode=\"0660\""
done
3. 将结果复制到 99-oracle-asmdevices.rules
将第二步的输出粘贴入 99-oracle-asmdevices.rules 这个文件
kernel=="sd*", subsystem=="block", program=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", result=="36000c2948ef9d9e4a7937bfc65888bc8", name="asm-diskb", owner="grid", group="asmadmin", mode="0660"
执行
/sbin/partprobe /dev/sdb
/sbin/partprobe /dev/sdc
/sbin/partprobe /dev/sdd
/sbin/partprobe /dev/sde
/sbin/partprobe /dev/sdf
4. 用udevadm进行测试,注意udevadm命令不接受/dev/sdc这样的挂载设备名,必须是使用/sys/block/sdb这样的原始设备名。
udevadm test /sys/block/sdb
udevadm test /sys/block/sdc
udevadm test /sys/block/sdd
udevadm test /sys/block/sde
udevadm test /sys/block/sdf
udevadm info --query=all --path=/sys/block/sdb
udevadm info --query=all --path=/sys/block/sdc
udevadm info --query=all --path=/sys/block/sdd
udevadm info --query=all --path=/sys/block/sde
udevadm info --query=all --path=/sys/block/sdf
udevadm info --query=all --name=asm-diskb
udevadm info --query=all --name=asm-diskc
udevadm info --query=all --name=asm-diskd
udevadm info --query=all --name=asm-diske
udevadm info --query=all --name=asm-diskf
5. 启动udev
/usr/sbin/udevadm control --reload-rules
systemctl status systemd-udevd.service
systemctl enable systemd-udevd.service
6. 检查设备是否正确绑定
# ls -l /dev/asm* /dev/sdb
lrwxrwxrwx 1 root root 3 nov 29 18:17 /dev/asm-diskb -> sdb
brw-rw---- 1 grid asmadmin 8, 16 nov 29 18:17 /dev/sdb
三、grid安装
安装包:linux.x64_193000_grid_home.zip
上传路径: /u01/app/19.0.0/grid
--直接切到grid解压缩
su - grid
cd /u01/app/19.0.0/grid
unzip linux.x64_193000_grid_home.zip
--解压完装个包
cd /u01/app/19.0.0/grid/cv/rpm
rpm -ivh cvuqdisk-1.0.10-1.rpm
1. 编辑响应文件
模板在 /u01/app/19.0.0/grid/inventory/response/grid_install.rsp
想了解参数具体用途的可以看模板里的说明
--touch gi.rsp
oracle.install.responsefileversion=/oracle/install/rspfmt_crsinstall_response_schema_v19.0.0
inventory_location=/u01/app/orainventory
oracle.install.option=ha_config
oracle_base=/u01/app/grid
oracle.install.asm.osdba=asmdba
oracle.install.asm.osoper=asmoper
oracle.install.asm.osasm=asmadmin
oracle.install.crs.config.scantype=local_scan
oracle.install.crs.config.clusterconfiguration=standalone
oracle.install.crs.config.configureasextendedcluster=false
oracle.install.crs.config.gpnp.configuregns=false
oracle.install.crs.config.autoconfigureclusternodevip=false
oracle.install.crs.config.gpnp.gnsoption=create_new_gns
oracle.install.crs.configuregimr=false
oracle.install.asm.configuregimrdatadg=false
oracle.install.crs.config.useipmi=false
oracle.install.asm.sysasmpassword=password123!
oracle.install.asm.diskgroup.name=dg_redo
oracle.install.asm.diskgroup.redundancy=external
oracle.install.asm.diskgroup.ausize=4
oracle.install.asm.diskgroup.disks=/dev/asm-diskb,/dev/asm-diskc,/dev/asm-diskd
oracle.install.asm.diskgroup.diskdiscoverystring=/dev/asm*
oracle.install.asm.monitorpassword=password123!
oracle.install.asm.configureafd=false
oracle.install.crs.configurerhps=false
oracle.install.crs.config.ignoredownnodes=false
oracle.install.config.managementoption=none
oracle.install.config.omsport=0
oracle.install.crs.rootconfig.executerootscript=false
注意:oracle.install.asm.configureafd=false 因为我的环境是centos所以设置的false,生产一般是rhel得设为true
2. 安装前precheck
--有问题按提示调整
/u01/app/19.0.0/grid/runcluvfy.sh stage -pre crsinst -n xkdg -fixup -verbose
3. 安装过程
--安装脚本
$oracle_home/gridsetup.sh -silent -responsefile /u01/app/19.0.0/grid/inventory/response/gi.rsp
--执行结果,作为参考,记得手工执行俩脚本
[grid@xkdg response]$ $oracle_home/gridsetup.sh -silent -responsefile /u01/app/19.0.0/grid/inventory/response/gi.rsp
launching oracle grid infrastructure setup wizard...
[warning] [ins-32047] the location (/u01/app/orainventory) specified for the central inventory is not empty.
action: it is recommended to provide an empty location for the inventory.
the response file for this session can be found at:
/u01/app/19.0.0/grid/install/response/grid_2022-03-09_10-31-11am.rsp
you can find the log of this install session at:
/tmp/gridsetupactions2022-03-09_10-31-11am/gridsetupactions2022-03-09_10-31-11am.log
as a root user, execute the following script(s):
1. /u01/app/orainventory/orainstroot.sh
2. /u01/app/19.0.0/grid/root.sh
execute /u01/app/19.0.0/grid/root.sh on the following nodes:
[xkdg]
successfully setup software.
as install user, execute the following command to complete the configuration.
/u01/app/19.0.0/grid/gridsetup.sh -executeconfigtools -responsefile /u01/app/19.0.0/grid/inventory/response/gi.rsp [-silent]
moved the install session logs to:
/u01/app/orainventory/logs/gridsetupactions2022-03-09_10-31-11am
[grid@xkdg response]$ exit
logout
[root@xkdg cdrom]# /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@xkdg cdrom]# /u01/app/19.0.0/grid/root.sh
check /u01/app/19.0.0/grid/install/root_xkdg_2022-03-09_10-33-58-938892079.log for the output of root script
[root@xkdg cdrom]#
4. 配置
--命令
/u01/app/19.0.0/grid/gridsetup.sh -executeconfigtools -responsefile /u01/app/19.0.0/grid/inventory/response/gi.rsp -silent
--执行结果
[grid@xkdg ~]$ /u01/app/19.0.0/grid/gridsetup.sh -executeconfigtools -responsefile /u01/app/19.0.0/grid/inventory/response/gi.rsp -silent
launching oracle grid infrastructure setup wizard...
you can find the logs of this session at:
/u01/app/orainventory/logs/gridsetupactions2022-03-09_10-30-05pm
you can find the log of this install session at:
/u01/app/orainventory/logs/updatenodelist2022-03-09_10-30-05pm.log
successfully configured software.
进行到这里可以 crsctl stat res -t 看看状态了
四、创建dg_data磁盘组
su - grid
sqlplus / as sysasm
create diskgroup dg_data external redundancy disk '/dev/asm-diske','/dev/asm-diskf' attribute 'compatible.rdbms'='19.0','compatible.asm'='19.0','au_size'='4m';
五、安装oracle软件
安装包:linux.x64_193000_db_home.zip
上传路径:/u01/app/oracle/product/19.0.0/dbhome_1
模板路径:/u01/app/oracle/product/19.0.0/dbhome_1/install/response/db_install.rsp
su - oracle cd $oracle_home unzip linux.x64_193000_db_home.zip
1. 编辑响应文件
--cd /u01/app/oracle/product/19.0.0/dbhome_1/install/response/
--touch db.rsp
oracle.install.responsefileversion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=install_db_swonly
unix_group_name=oinstall
inventory_location=/u01/app/orainventory
oracle_home=/u01/app/oracle/product/19.0.0/dbhome_1
oracle_base=/u01/app/oracle
oracle.install.db.installedition=ee
oracle.install.db.osdba_group=dba
oracle.install.db.osoper_group=dba
oracle.install.db.osbackupdba_group=dba
oracle.install.db.osdgdba_group=dba
oracle.install.db.oskmdba_group=dba
oracle.install.db.osracdba_group=dba
oracle.install.db.rootconfig.executerootscript=false
oracle.install.db.config.starterdb.type=general_purpose
oracle.install.db.config.starterdb.memoryoption=false
oracle.install.db.config.starterdb.installexampleschemas=false
oracle.install.db.config.starterdb.managementoption=default
oracle.install.db.config.starterdb.enablerecovery=false
2. 安装
--命令
cd $oracle_home
./runinstaller -silent -responsefile /u01/app/oracle/product/19.0.0/dbhome_1/install/response/db.rsp -skipprereqs
--执行结果,作为参考,记得执行root.sh
[oracle@xkdg dbhome_1]$ ./runinstaller -silent -responsefile /u01/app/oracle/product/19.0.0/dbhome_1/install/response/db.rsp -skipprereqs
launching oracle database setup wizard...
the response file for this session can be found at:
/u01/app/oracle/product/19.0.0/dbhome_1/install/response/db_2022-03-09_11-46-03pm.rsp
you can find the log of this install session at:
/u01/app/orainventory/logs/installactions2022-03-09_11-46-03pm/installactions2022-03-09_11-46-03pm.log
as a root user, execute the following script(s):
1. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
execute /u01/app/oracle/product/19.0.0/dbhome_1/root.sh on the following nodes:
[xkdg]
successfully setup software.
[oracle@xkdg dbhome_1]$ exit
logout
[root@xkdg tmp]# /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
check /u01/app/oracle/product/19.0.0/dbhome_1/install/root_xkdg_2022-03-09_23-47-30-636609348.log for the output of root script
六、dbca建库
模板 /u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/dbca.rsp
1. 响应文件
cdb模式记得 createascontainerdatabase=true
responsefileversion=/oracle/assistants/rspfmt_dbca_response_schema_v19.0.0 gdbname=xkdg sid=xkdg databaseconfigtype=si policymanaged=false createserverpool=false serverpoolname= createascontainerdatabase=true numberofpdbs=1 pdbname=test01 uselocalundoforpdbs=true pdbadminpassword=password123! templatename=/u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/templates/general_purpose.dbc syspassword=password123! systempassword= password123! runcvuchecks=true dbsnmppassword=password123! dvconfiguration=false olsconfiguration=false datafilejarlocation=/u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/templates/ datafiledestination=dg_data storagetype=asm diskgroupname=dg_data asmsnmppassword=password123! recoverygroupname=dg_data characterset=utf8 nationalcharacterset=al16utf16 registerwithdirservice=false listeners=listener sampleschema=false memorypercentage=50 databasetype=multipurpose automaticmemorymanagement=false dbsnmppassword=password123!
2.执行
--命令
dbca -silent -createdatabase -responsefile /u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/dbca1.rsp
--执行结果
[oracle@xkdg dbca]$ dbca -silent -createdatabase -responsefile /u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/dbca1.rsp
prepare for db operation
7% complete
registering database with oracle restart
11% complete
copying database files
33% complete
creating and starting oracle instance
35% complete
38% complete
42% complete
45% complete
48% complete
completing database creation
53% complete
55% complete
56% complete
creating pluggable databases
60% complete
78% complete
executing post configuration actions
100% complete
database creation complete. for details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/xkdg.
database information:
global database name:xkdg
system identifier(sid):xkdg
look at the log file "/u01/app/oracle/cfgtoollogs/dbca/xkdg/xkdg.log" for further details.
[oracle@xkdg dbca]$
安装完成
七、小结
后续打补丁、刷参数、改redo等等等。