1、安装Redhat 6.8系统
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、必须安装以下软件包(或更高版本):
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)
例如:
# yum install libxcb*.i686
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
-G dba,oper,asmdba,backupdba,dgdba,kmdba,racdba oracle
--/usr/sbin/useradd -u 54337 -g oinstall -G dba,asmdba,racdba,asmoper,asmadmin grid
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
su - oracle
mkdir -p /home/oracle/u01/app/oracle
vi .bash_profile
stty erase ^H
export ORACLE_SID=orcl
export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.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 /home/oracle/app/oracle/product/12.1.0/dbhome_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 添加如下:
PDBORCLALL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborclall)
)
)
--安装完成后配置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;
--再次查看:
--show pdbs;
也可以通过sqlplus使用传统的startup和shutdown命令来启动和关闭PDB
alter session set container=PDB_TEST;
--返回CBD$ROOT组件
SQL> alter session set container=CDB$ROOT;
--现在再来看第十五步出现的错误
--首先我们现在来切换到其中一个pluggable database(可插拔数据库):PDB_TEST
alter session set container=PDB_TEST;
--接下来,我们再来查看这个可插拔数据库pluggable database(可插拔数据库):PDB_TEST中的相关数据文件
select file_name from dba_data_files;
之前创建的表空间wireless_site是在CDB(容器数据库下创建的),所以在pluggable database(可插拔数据库)看不到
--在pluggable database(可插拔数据库)下创建表空间:wireless_site
create tablespace wireless_sit;
--创建用户
create user wireless_site identified by wireless_site default tablespace wireless_site;
grant connect,resource to wireless_site;
--配置监听
--未配置pluggable database(可插拔数据库):pdb_test前,监听配置如下:
listener.ora
--配置PDB_TEST监听
使用netmgr工具
--配置tnsname
配置容器数据库tnsname
配置可插拔数据库tnsname
查看tnsname.ora文件内容:
--测试登陆:
tnsping pdb_test