swap必须等于物理内存.
/dev/shm 必须大于memory_target
1、关闭防火墙和selinux
service iptables stop
chkconfig iptables off
setenforce 0
getenforce
vi /etc/selinux/config
-- 改成SELINUX=disabled
SELINUX=disabled
2、配置/etc/hosts
3、系统配置
vi /etc/sysctl.conf
kernel.shmmax = 68719476736----orig munber
kernel.shmmax = 137438953470
kernel.shmmni = 4096
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
kernel.panic_on_oops = 1
vm.nr_hugepages = 365000
vm.nr_hugepages = 57500
生效:
sysctl -p
修改/etc/security/limits.conf,添加如下内容:
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft stack 10240
grid hard stack 32768
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
grid soft memlock 786432000
grid hard memlock 786432000
oracle soft memlock 786432000
oracle hard memlock 786432000
4、yum
cd /etc/yum.repos.d
mkdir bk
mv public-yum-ol6.repo bk/
vi yum.repo
-- 添加如下内容
[Oracle]
name=OEL-$releasever - Media
baseurl=file:///mnt/
gpgcheck=0
enabled=1
mount /dev/cdrom /mnt
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel pdksh compat-libcap1 rlwrap
---上面命令装完再执行一次,看看是否除了下面2项外,其它都已经安装好了
elfutils-libelf-devel-static
pdksh
安装多链路
yum -y install device-mapper-multipath
modprobe dm-multipath
modprobe dm-round-robin
service multipathd start
rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm
5、用户和组
创建组:
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
创建用户:
useradd -u 54321 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
useradd -u 54322 -g oinstall -G dba,backupdba,dgdba,asmadmin,asmdba,oper oracle
设置口令:
passwd grid
passwd oracle
6、安装目录
mkdir -p /u02/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/grid/12cr1
mkdir -p /u02/app/oracle/product/12cr1/db_1
chown -R oracle.oinstall /u02
chown -R grid.oinstall /u01
chmod -R 775 /u01
chmod -R 775 /u02
7、环境变量
# vi /home/grid/.bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=db-standby //hostname
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=$ORACLE_BASE/12cr1
export ORACLE_SID=+ASM
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
vi /home/oracle/.bash_profile
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=db-standby //hostname
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12cr1/db_1
export ORACLE_SID=ywzc
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
8、配置udev
parted
mklabel GPT
print
mkpart primary 2048s 100%
align-check optimal 1
fdisk -c -u /dev/nvme0n1
/sbin/scsi_id -g -u -d /dev/nvme1n1p1
/sbin/scsi_id -g -u -d /dev/nvme0n1p1
[root@yz-oracledb01 install]# /sbin/scsi_id -g -u -d /dev/nvme1n1p1
SNVMe_Dell_Express_Fl_S1W7NYAG300364
/sbin/scsi_id -g -u -d /dev/nvme0n1p1
[root@yz-oracledb01 install]# /sbin/scsi_id -g -u -d /dev/nvme0n1p1
SNVMe_Dell_Express_Fl_S1W7NYAG300367
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="361866da0549f13001ed205b50a247c14",NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="nvme?n1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SNVMe_Dell_Express_Fl_S1W7NYAG300367", NAME="asm-nvme1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="nvme?n1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SNVMe_Dell_Express_Fl_S1W7NYAG300364", NAME="asm-nvme2", OWNER="grid", GROUP="asmadmin", MODE="0660"
for i in b c d e f g h;do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29a1219dbd29a474253b7b972e1", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c2972a989a5366748c4b2196857c", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c295db9d082be0edad59485976f1", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29a2f3b0541631f481abb78d023", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c290acd1cd42cf248e57b30280a6", NAME="asm-diskg", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c2988f116861085e01b984b4aedd", NAME="asm-diskh", OWNER="grid", GROUP="asmadmin", MODE="0660"
输出到
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c2948700d922b8388f73b1fe7948", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29e675602481bfa1fcee0fab800", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
重启
/sbin/start_udev
Starting udev: [ OK ]
[root@12crac1 ~]# ls -l /dev/asm*
破坏asm文件
###dd if=/dev/zero of=/dev/asm* bs=4096 count=1
9、禁用ntp
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.bak
vi /etc/sysconfig/network
NOZEROCONF=yes
10、介质
mkdir /install
chown -R grid.oinstall /install
chown oracle.oinstall /install/*zip
chmod 775 /install
su - grid
cd /install/
unzip linuxamd64_12102_grid_1of2.zip
unzip linuxamd64_12102_grid_2of2.zip
su - oracle
cd /install/
unzip linuxamd64_12102_database_2of2.zip
unzip linuxamd64_12102_database_1of2.zip
解压之后大小为:
du -sh grid/
du -sh database/
[oracle@oratest2 install]$ du -sh *
2.8G database
2.5G grid
11、GI
su - grid
cd /install/grid/
我打开Xmanager - Passive,设置DISPLAY,调用runInstaller启动OUI
export DISPLAY=132.113.64.46:0.0
./runInstaller
script
/u01/app/oraInventory/orainstRoot.sh
/u01/app/grid/12cr1/root.sh
crsctl stat res -t
12、asm磁盘组
export DISPLAY=192.168.0.1:0.0
asmca
13、db
su - oracle
cd /install/database/
export DISPLAY=132.113.69.175:0.0
./runInstaller
调整shm
vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=120G 0 0
/u02/app/oracle/product/12cr1/db_1/root.sh
dbca
crsctl stat res -t
12c默认打开db级别审计,关闭
alter system set audit_trail = none scope=spfile;
alter system set audit_sys_operations=FALSE scope=spfile;
alter pluggable database all open;
0 0 * * * find /u02/app/oracle/admin/ywzc/adump -mtime +7 -name "*.aud" -exec rm -rf {} \;
0 0 * * * find /u02/app/oracle/admin/support/adump -mtime +7 -name "*.aud" -exec rm -rf {} \;
[oracle@test ~]$ env 查看数据库信息
SQL> shutdown immediate 关闭数据库
[grid@test ~]$ crsctl stat res -t 查看资源信息
查看ams里实例
[root@test ~]# su - grid
[grid@test ~]$ asmcmd
ASMCMD> ls
DATA/
GROUP2/
ASMCMD> cd data
ASMCMD> ls
ASM/
TEST2/
orapwasm
ASMCMD>
/dev/shm 必须大于memory_target
1、关闭防火墙和selinux
service iptables stop
chkconfig iptables off
setenforce 0
getenforce
vi /etc/selinux/config
-- 改成SELINUX=disabled
SELINUX=disabled
2、配置/etc/hosts
3、系统配置
vi /etc/sysctl.conf
kernel.shmmax = 68719476736----orig munber
kernel.shmmax = 137438953470
kernel.shmmni = 4096
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
kernel.panic_on_oops = 1
vm.nr_hugepages = 365000
vm.nr_hugepages = 57500
生效:
sysctl -p
修改/etc/security/limits.conf,添加如下内容:
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft stack 10240
grid hard stack 32768
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
grid soft memlock 786432000
grid hard memlock 786432000
oracle soft memlock 786432000
oracle hard memlock 786432000
4、yum
cd /etc/yum.repos.d
mkdir bk
mv public-yum-ol6.repo bk/
vi yum.repo
-- 添加如下内容
[Oracle]
name=OEL-$releasever - Media
baseurl=file:///mnt/
gpgcheck=0
enabled=1
mount /dev/cdrom /mnt
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel pdksh compat-libcap1 rlwrap
---上面命令装完再执行一次,看看是否除了下面2项外,其它都已经安装好了
elfutils-libelf-devel-static
pdksh
安装多链路
yum -y install device-mapper-multipath
modprobe dm-multipath
modprobe dm-round-robin
service multipathd start
rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm
5、用户和组
创建组:
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
创建用户:
useradd -u 54321 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
useradd -u 54322 -g oinstall -G dba,backupdba,dgdba,asmadmin,asmdba,oper oracle
设置口令:
passwd grid
passwd oracle
6、安装目录
mkdir -p /u02/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/grid/12cr1
mkdir -p /u02/app/oracle/product/12cr1/db_1
chown -R oracle.oinstall /u02
chown -R grid.oinstall /u01
chmod -R 775 /u01
chmod -R 775 /u02
7、环境变量
# vi /home/grid/.bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=db-standby //hostname
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=$ORACLE_BASE/12cr1
export ORACLE_SID=+ASM
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
vi /home/oracle/.bash_profile
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=db-standby //hostname
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12cr1/db_1
export ORACLE_SID=ywzc
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
8、配置udev
parted
mklabel GPT
mkpart primary 2048s 100%
align-check optimal 1
fdisk -c -u /dev/nvme0n1
/sbin/scsi_id -g -u -d /dev/nvme1n1p1
/sbin/scsi_id -g -u -d /dev/nvme0n1p1
[root@yz-oracledb01 install]# /sbin/scsi_id -g -u -d /dev/nvme1n1p1
SNVMe_Dell_Express_Fl_S1W7NYAG300364
/sbin/scsi_id -g -u -d /dev/nvme0n1p1
[root@yz-oracledb01 install]# /sbin/scsi_id -g -u -d /dev/nvme0n1p1
SNVMe_Dell_Express_Fl_S1W7NYAG300367
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="361866da0549f13001ed205b50a247c14",NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="nvme?n1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SNVMe_Dell_Express_Fl_S1W7NYAG300367", NAME="asm-nvme1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="nvme?n1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SNVMe_Dell_Express_Fl_S1W7NYAG300364", NAME="asm-nvme2", OWNER="grid", GROUP="asmadmin", MODE="0660"
for i in b c d e f g h;do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29a1219dbd29a474253b7b972e1", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c2972a989a5366748c4b2196857c", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c295db9d082be0edad59485976f1", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29a2f3b0541631f481abb78d023", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c290acd1cd42cf248e57b30280a6", NAME="asm-diskg", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c2988f116861085e01b984b4aedd", NAME="asm-diskh", OWNER="grid", GROUP="asmadmin", MODE="0660"
输出到
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c2948700d922b8388f73b1fe7948", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29e675602481bfa1fcee0fab800", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
重启
/sbin/start_udev
Starting udev: [ OK ]
[root@12crac1 ~]# ls -l /dev/asm*
破坏asm文件
###dd if=/dev/zero of=/dev/asm* bs=4096 count=1
9、禁用ntp
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.bak
vi /etc/sysconfig/network
NOZEROCONF=yes
10、介质
mkdir /install
chown -R grid.oinstall /install
chown oracle.oinstall /install/*zip
chmod 775 /install
su - grid
cd /install/
unzip linuxamd64_12102_grid_1of2.zip
unzip linuxamd64_12102_grid_2of2.zip
su - oracle
cd /install/
unzip linuxamd64_12102_database_2of2.zip
unzip linuxamd64_12102_database_1of2.zip
解压之后大小为:
du -sh grid/
du -sh database/
[oracle@oratest2 install]$ du -sh *
2.8G database
2.5G grid
11、GI
su - grid
cd /install/grid/
我打开Xmanager - Passive,设置DISPLAY,调用runInstaller启动OUI
export DISPLAY=132.113.64.46:0.0
./runInstaller
script
/u01/app/oraInventory/orainstRoot.sh
/u01/app/grid/12cr1/root.sh
crsctl stat res -t
12、asm磁盘组
export DISPLAY=192.168.0.1:0.0
asmca
13、db
su - oracle
cd /install/database/
export DISPLAY=132.113.69.175:0.0
./runInstaller
调整shm
vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=120G 0 0
/u02/app/oracle/product/12cr1/db_1/root.sh
dbca
crsctl stat res -t
12c默认打开db级别审计,关闭
alter system set audit_trail = none scope=spfile;
alter system set audit_sys_operations=FALSE scope=spfile;
alter pluggable database all open;
0 0 * * * find /u02/app/oracle/admin/ywzc/adump -mtime +7 -name "*.aud" -exec rm -rf {} \;
0 0 * * * find /u02/app/oracle/admin/support/adump -mtime +7 -name "*.aud" -exec rm -rf {} \;
[oracle@test ~]$ env 查看数据库信息
SQL> shutdown immediate 关闭数据库
[grid@test ~]$ crsctl stat res -t 查看资源信息
查看ams里实例
[root@test ~]# su - grid
[grid@test ~]$ asmcmd
ASMCMD> ls
DATA/
GROUP2/
ASMCMD> cd data
ASMCMD> ls
ASM/
TEST2/
orapwasm
ASMCMD>