Oracle 12C学习笔记(一)Oracle12cR2+Centos7.5+ASM

目录

一、系统准备

二、系统设置

三、安装软件包

四、创建目录、组、用户

五、配置内核参数

六、配置ASM属性

七、创建分区

八、安装

九、启动关闭


一、系统准备

VMware Workstation12

Centos 7.5

Oracle 12.2.0.1

Grid 12.2.0.1(可选)也可将数据放置在普通磁盘上

 

二、系统设置

1、防火墙

firewall-cmd --zone=public --add-port=1521/tcp --permanent
firewall-cmd --zone=public --add-port=5500/tcp --permanent
firewall-cmd --zone=public --add-port=5502/tcp --permanent
firewall-cmd --reload

注:1521为oracle实例默认端口,5500是EM https默认端口,5502为EM的http端口,都可以自定义

 

2、SELINUX设置

vim /etc/selinux/config
修改内容:
SELINUX=disabled

3、主机名

hostnamectl set-hostname oratest
vim /etc/hosts
添加内容:
192.168.10.176 oratest

4、logind设置

vim /etc/systemd/logind.conf
修改内容:
RemoveIPC=no

systemctl daemon-reload
systemctl restart systemd-logind

三、安装软件包

1、oracleasm

用来配置asm的磁盘,如果将oracle数据文件放置在普通磁盘上,则略过。

wget http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracleasm-support-2.1.11-2.el7.x86_64.rpm
wget http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el7.x86_64.rpm
yum install -y kmod-oracleasm
rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm oracleasm-support-2.1.11-2.el7.x86_64.rpm

2、oracle依赖包

yum install -y binutils compat-libcap1 compat-libstdc++-33.i686 compat-libstdc++-33.x86_64 gcc gcc-c++ glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 make sysstat elfutils-libelf-devel

四、创建目录、组、用户

1、创建目录

mkdir -p /u01/12.2.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle 
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

2、创建用户

groupadd oinstall
groupadd dba
groupadd asmdba
groupadd asmadmin
groupadd asmoper
groupadd oper
groupadd backupdba
groupadd dgdba
groupadd kmdba
useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
useradd -g oinstall -G dba,asmdba,oper,backupdba,dgdba,kmdba oracle
#设置用户密码
passwd grid
passwd oracle

3、设置环境变量

vim /home/grid/.bash_profile
export NLS_LANG=AMERICAN_AMERICA.UTF8
export LANG=en_US.UTF-8
export ORACLE_HOME=/u01/12.2.0/grid
export ORACLE_SID=+ASM
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

vim /home/oracle/.bash_profile
export NLS_LANG=AMERICAN_AMERICA.UTF8
export LANG=en_US.UTF-8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

五、配置内核参数

vim /etc/pam.d/login
session required pam_limits.so

vim /etc/security/limits.conf
oracle soft nproc 16384
oracle hard nproc 16384 
oracle soft nofile 1024 
oracle hard nofile 65536
oracle  soft  stack  10240
oracle  hard stack  32768
grid   soft   nofile    1024
grid   hard   nofile    65536
grid   soft   nproc    16384
grid   hard   nproc    16384
grid   soft   stack    10240
grid   hard   stack    32768

vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
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 = 1048586

vim /etc/fstab 
tmpfs                   /dev/shm                tmpfs   defaults,size=12G        0 0
tmpfs                   /run                    tmpfs   defaults,size=12G        0 0
tmpfs                  /sys/fs/cgroup           tmpfs   defaults,size=12G        0 0

六、配置ASM属性

oracleasm configure -i
Default user to own the driver interface []: grid
Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

七、创建分区

注:在做以下步骤前可先重启服务器,使前面的设置生效

#重启
reboot
#查看磁盘
fdisk -l
#分区/dev/sdb1,/dev/sdc1, /dev/sdd1
fdisk /dev/sdb
oracleasm createdisk myasm01 /dev/sdb1
oracleasm createdisk myasm02 /dev/sdc1
oracleasm createdisk myasm03 /dev/sdd1
oracleasm scandisks
oracleasm listdisks

八、安装

1、安装grid(可选)

通过OUI安装,略过

2、安装oracle

通过OUI安装,略过

 

九、启动关闭

注:先关数据库,后关asm。先启asm,后启数据库

1、数据库

oracle>sqlplus / as sysdba
shutdown immediate       #关闭
startup                  #启动

2、ASM

grid>sqlplus / as sysasm
shutdown immediate
startup

3、通过srvctl启停

srvctl start|stop|enable asm
srvctl start|stop database -db orcl

4、EM

oracle>sqlplus / as sysdba

#启动
exec DBMS_XDB_CONFIG.SETHTTPPORT(5502);
exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500);
#关闭
exec DBMS_XDB_CONFIG.SETHTTPSPORT(0);
exec DBMS_XDB_CONFIG.SETHTTPPORT(0);
#查看端口
SELECT dbms_xdb_config.gethttpsport FROM DUAL;
SELECT dbms_xdb_config.gethttpport FROM DUAL;

 

你可能感兴趣的:(Oracle,DBA)