Redhat 6.8部署oracle12.2.0.1.0
1、系统设置
service iptables stop
vi /etc/selinux/config
SELINUX=disabled
2、yum源本地配置
--挂载系统光驱镜像iso,或者挂载镜像文件mount -o loop /opt/6.8.iso /mnt
mount -o loop /dev/cdrom /mnt
vi /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
#baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
baseurl=file:///mnt
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
3、必须安装以下软件包,用yum,若包及对应32位包无法安装则用rpm,安装32位用yum install libxcb*.i686
yum -y install gcc
yum -y install gcc-c++
rpm -ivh bc-1.06.95-1.el6.x86_64.rpm
binutils-2.20.51.0.2-5.36.el6(x86_64)
compat-libcap1-1.10-1(x86_64)
compat-libstdc ++ - 33-3.2.3-69.el6(x86_64)
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.i686.rpm --nodeps --force
e2fsprogs-1.41.12-14.el6(x86_64)
e2fsprogs-libs-1.41.12-14.el6(x86_64)
glibc-2.12-1.107.el6(i686)
glibc-2.12-1.107.el6 (x86_64)
glibc-devel-2.12-1.107.el6(i686)
glibc-devel-2.12-1.107.el6(x86_64)
ksh
libaio-0.3.107-10.el6(x86_64)
libaio-0.3.107-10.el6( i686)
libaio-devel-0.3.107-10.el6(x86_64)
libaio-devel-0.3.107-10.el6(i686)
libX11-1.5.0-4.el6(i686)
libX11-1.5.0-4.el6(x86_64)
libXau-1.0.6-4.el6(i686)
libXau-1.0.6-4.el6(x86_64)
libXi-1.6.1-3.el6(i686)
libXi-1.6.1-3.el6(x86_64)
libXtst-1.2.1-2.el6(i686)
libXtst-1.2.1-2.el6(x86_64)
libgcc- 4.4.7-3.el6(i686)
libgcc-4.4.7-3.el6(x86_64)
libstdc ++ - 4.4.7-3.el6(i686)
libstdc ++ - 4.4.7-3.el6(x86_64)
libstdc++-devel- 4.4.7-3.el6(i686)
libstdc++-devel-4.4.7-3.el6(x86_64)
libxcb-1.8.1-1.el6(i686)
libxcb-1.8.1-1.el6(x86_64)
make- 3.81-20.el6(x86_64)
net-tools-1.60-110.el6_2(x86_64)(适用于Oracle RAC和Oracle Clusterware)
nfs-utils-1.2.3-36.el6(x86_64)(适用于Oracle ACFS)
smartmontools-5.43 -1.el6(x86_64)
sysstat-9.0.4-20.el6(x86_64)
4、创建oracle用户和组(根据实际情况适当创建,以下包括安装grid、dg、rac和使用ASM需要的用户和组)
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
#添加oper组
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/useradd -u 54336 -g oinstall -G dba,oper,asmdba,backupdba,dgdba,kmdba,racdba oracle
#/usr/sbin/useradd -u 54337 -g oinstall -G dba,asmdba,racdba,asmoper,asmadmin grid
passwd oracle
5、配置内核参数
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
--使参数生效;
/sbin/sysctl -p
6、在/etc/security/limits.conf加入相关配置
vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
7、修改/etc/pam.d/login
vi /etc/pam.d/login,添加:
session required pam_limits.so
8、修改ulimit
vi /etc/profile,添加:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536a
else
ulimit -u 16384 -n 65536
fi
fi
mkdir -p /u01
chown oracle:oinstall /u01
su - oracle
vi .bash_profile
stty erase ^H
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0./db_1
export LD_LIBRARY_PATH=/usr/lib:$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export DISPLAY=:0.0
umask=022
export PATH
source .bash_profile
9、下载安装介质、上传、解压(略)
10、开始安装
--安装过程中报错(少gcc相关包,依赖用yum未安装完整,可能是系统iso挂载方式有问题):
error in invoking target client_sharedlib or makefile /u01/app/oracle/product/12.2.0/db_1/lib/ins_rdbms.mk see -f installActions2019-09-06_10-52-58AM.log for details
tail -f installActions2019-09-06_10-52-58AM.log
11、执行netca创建监听(略)
12、执行dbca建库(略)
vi tnsname.ora 添加如下:
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLPDB)
)
)
--安装完成后cdb中配置pdb自启动
create or replace trigger startup_pdbs
after startup on database
begin
execute immediate 'alter pluggable database all open';
end startup_pdbs;
/
---------------------------------------------------------------------------------------------------------------------------------------------
--创建一个新PDB
create pluggable database pdb_test admin user pdb_test identified by pdb_test file_name_convert=('/u01/app/oracle/oradata/PDB_TEST/pdb_testseed/','/u01/app/oracle/oradata/PDB_TEST/pdb_test/');
--或者:
create pluggable database pdb_test admin user pdb_test identified by pdb_test;
--查看CDB中有多少个pluggable database(可插拔数据库):
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
--显示所创建的PDB
show pdbs
--启动一个创建好的PDB
alter pluggable database PDB_TEST open;
--关闭PDB:
alter pluggable database PDB_TEST close;
也可以通过sqlplus使用传统的startup和shutdown命令来启动和关闭PDB
alter session set container=PDB_TEST;