Oracle19C的RPM安装,快速生成测试环境

--0.环境准备
关闭selinux(重启永久生效)
[root@yuanzj19crpm ~]# sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config & setenforce 0 &&
关闭防火墙
[root@yuanzj19crpm ~]# systemctl disable firewalld.service && systemctl stop firewalld.service
修改用户限制文件
[root@yuanzj19crpm ~]# cat >> /etc/security/limits.conf << "EOF"
oracle soft nproc 655350
oracle hard nproc 655350
oracle soft nofile 655350
oracle hard nofile 655360
oracle soft stack 102400
EOF

--1.安装依赖包(ol7操作系统带)
[root@yuanzj19crpm ~]# yum install oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

--2.配置oracle环境
cat  >>  /home/oracle/.bash_profile << "EOF"
export ORACLE_SID=orcl
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib 
export PATH=$ORACLE_HOME/bin:$PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias asmcmd='rlwrap asmcmd'
alias sas='sqlplus / as sysdba'
EOF

--3.安装rlwrap-0.43-2.el7.x86_64.rpm(百度自行下载)
[root@yuanzj19crpm ~]# yum -y install rlwrap-0.43-2.el7.x86_64.rpm

--4.安装数据库软件
[root@yuanzj19crpm ~]# yum install oracle-database-ee-19c-1.0-1.x86_64.rpm

--5.配置友好提示
[root@yuanzj19crpm ~]# cat >> $ORACLE_HOME/sqlplus/admin/glogin.sql << "EOF"
set linesize 9999 pagesize 9999
set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "
EOF
------------------------------第6,7,8根据需求任选一项即可----------------------
--6.配置多租户数据库实例(实例名:ORCLCDB,pdbname:ORCLPDB1 默认配置)
[root@yuanzj19crpm ~]# /etc/init.d/oracledb_ORCLCDB-19c configure
[root@yuanzj19crpm ~]# vim /etc/init.d/oracledb_ORCLCDB-19c
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_VERSION=19c
export ORACLE_SID=ORCLCDB
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=ORCLCDB
export PDB_NAME=ORCLPDB1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true

--7.定制多租户数据库实例(实例名:orcl,pdbname:orclpdb)
[root@yuanzj19crpm ~]# vim /etc/init.d/oracledb_ORCLCDB-19c
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_VERSION=19c
export ORACLE_SID=orcl
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=ZHS16GBK
export PDB_NAME=orclpdb
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true

--8.定制非多租户数据库实例(实例名:orcl)
[root@yuanzj19crpm ~]# vim /etc/init.d/oracledb_ORCLCDB-19c
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_VERSION=19c
export ORACLE_SID=orcl
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=ZHS16GBK
export PDB_NAME=orclpdb
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=false

--9.编辑配置文件
[root@yuanzj19crpm ~]# vim /etc/sysconfig/oracledb_orcl-19c.conf
# LISTENER_PORT: Database listener
LISTENER_PORT=1521
# ORACLE_DATA_LOCATION: Database oradata location
ORACLE_DATA_LOCATION=/opt/oracle/oradata
# EM_EXPRESS_PORT: Oracle EM Express listener
EM_EXPRESS_PORT=5500


---------------------------补充知识--------------------------
使用dbca建立一个 12.2非多租户的数据库:

[oracle@yuanzj19crpm ~]$
dbca -silent -createDatabase \
> -templateName General_Purpose.dbc \
> -gdbname yuanzja -sid yuanzja -responseFile NO_VALUE \
> -characterSet AL32UTF8 \
> -sysPassword OraPasswd1 \
> -systemPassword OraPasswd1 \
> -createAsContainerDatabase false \
> -databaseType MULTIPURPOSE \
> -automaticMemoryManagement false \
> -totalMemory 1536 \
> -storageType FS \
> -datafileDestination "/opt/oracle/oradata/" \
> -redoLogFileSize 50 \
> -emConfiguration NONE \
> -ignorePreReqs

多租户数据库,增加几个参数如下:

dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname yuanzjb -sid yuanzjb -responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword OraPasswd1 \
-systemPassword OraPasswd1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName pdb1 \
-pdbAdminPassword OraPasswd1 \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-totalMemory 1536 \
-storageType FS \
-datafileDestination "/opt/oracle/oradata/" \
-redoLogFileSize 50 \
-emConfiguration NONE \
-ignorePreReqs

触发器自启动pdb
CREATE TRIGGER open_all_pdbs
   AFTER STARTUP ON DATABASE
BEGIN
   EXECUTE IMMEDIATE 'alter pluggable database all open';
END open_all_pdbs;
/

 

你可能感兴趣的:(oracle,安装部署)