目录
1、环境
1.1、配置本地YUM源
1.2、安装依赖包
1.3、创建用户组
1.4、创建软件安装目录和数据库目录
1.5、准备其它条件
1.7、关闭防火墙与selinux
1.8、解压数据库文件
2、安装数据库
2.1、安装数据库软件
3、静默进行创建监听
4、建立pdb类型数据库
4.1、准备pdb响应文件
4.1.2、dbca建库
5、普通建库
5.1、准备响应文件
5.2、dbca建立普通库
mount -t auto /dev/cdrom /mnt
rm -rf /etc/yum.repos.d/
mkdir -p /etc/yum.repos.d/
cat >> /etc/yum.repos.d/CentOS-Media.repo<
yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel libXext* unzip
groupadd -g 1001 oinstall
groupadd -g 1002 dba
groupadd -g 1003 oper
groupadd -g 1004 asmdba
groupadd -g 1005 backupdba
groupadd -g 1006 dgdba
groupadd -g 1007 kmdba
groupadd -g 1008 racdba
useradd -u 1001 -m -g oinstall -G dba,oper,asmdba,backupdba,dgdba,kmdba,racdba oracle
id oracle
a=1
echo oracle:$a|chpasswd
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01
mkdir -p /oracle/oinstall
chown -R oracle:oinstall /oracle
hostnamectl set-hostname oracle12c
cat >> /etc/hosts <
cat >> /etc/sysctl.conf <> /etc/security/limits.conf <> /etc/profile <> /etc/csh.login <> /etc/pam.d/login <
cat >>/home/oracle/.bash_profile<
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/=enforcing/=disabled/g' /etc/selinux/config
setenforce 0
getenforce
cd /oracle/
unzip linuxx64_12201_database.zip
chown -R oracle:oinstall database/
cat >/tmp/db_install.rsp <
[oracle@oracle12c db]$ netca -silent -responsefile /u01/app/oracle/product/12.2/db/assistants/netca/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/app/oracle/product/12.2/db/assistants/netca/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/12.2/db/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@oracle12c db]$
mkdir /oradata
chown oracle:oinstall
cat >/oracle/database/response/dbca_install.rsp<
dbca -silent -createDatabase -responseFile /oracle/database/response/dbca_install.rsp
[oracle@oracle12c templates]$ dbca -silent -createDatabase -responseFile /oracle/database/response/dbca_install.rsp
Enter SYS user password:
Enter SYSTEM user password:
Enter PDBADMIN User Password:
Copying database files
1% complete
13% complete
25% complete
Creating and starting Oracle instance
26% complete
30% complete
31% complete
35% complete
38% complete
39% complete
41% complete
Completing Database Creation
42% complete
43% complete
44% complete
46% complete
49% complete
50% complete
Creating Pluggable Databases
55% complete
75% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
[oracle@oracle12c ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sat Apr 4 13:14:34 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
SQL>
cat >/oracle/database/response/dbca_nopdb.rsp<
dbca -silent -createDatabase -responseFile /oracle/database/response/dbca_nopdb.rsp
[oracle@oracle12c response]$ dbca -silent -createDatabase -responseFile /oracle/database/response/dbca_nopdb.rsp
Enter SYS user password:
Enter SYSTEM user password:
Copying database files
1% complete
2% complete
18% complete
33% complete
Creating and starting Oracle instance
35% complete
40% complete
44% complete
49% complete
50% complete
53% complete
55% complete
Completing Database Creation
56% complete
57% complete
58% complete
62% complete
65% complete
66% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/oab/oab.log" for further details.
[oracle@oracle12c response]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sat Apr 4 13:12:57 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
SQL>
增加控制启动项
cat >/lib/systemd/system/oracle.service<2>&1 &
ExecStop=/root/scripts/dbstop.sh 2>&1 &
[Install]
WantedBy=multi-user.target
EOF
cat /lib/systemd/system/oracle.service
mkdir -p /root/scripts/
cat >/root/scripts/dbstart.sh</root/scripts/dbstop.sh<