您的位置:首页 > 数据库 > Oracle

Oracle 12c R2 静默安装

2017-04-15 23:08 579 查看

环境

OS:centos7

Oracle:Oracle 12.2.0.1

Hosts file

cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.119   centos7

安装准备

配置/etc/sysctl.conf

[root@centos7 ~]# vim /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf f
ile
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
#
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500


#使配置生效

[root@centos7 ~]# /sbin/sysctl -p

配置/etc/security/limits.d/20-nproc.conf

[root@centos7 ~]# vim /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          soft    nproc     4096
root       soft    nproc     unlimited
oracle   soft   nofile    1024
oracle   hard   nofile    65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
oracle   hard   memlock    134217728
oracle   soft   memlock    134217728


安装一些包:

yum install -y binutils \

compat-libcap1 \
compat-libstdc++-33 \
compat-libstdc++-33.i686 \
glibc \
glibc.i686 \
glibc-devel \
glibc-devel.i686 \
ksh \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
libX11 \
libX11.i686 \
libXau \
libXau.i686 \
libXi \
libXi.i686 \
libXtst \
libXtst.i686 \
libgcc \
libgcc.i686 \
libstdc++ \
libstdc++.i686 \
libstdc++-devel \
libstdc++-devel.i686 \
libxcb \
libxcb.i686 \
make \
nfs-utils \
net-tools \
smartmontools \
sysstat \
unixODBC \
unixODBC-devel
gcc \
gcc-c++ \
libXext \
libXext.i686 \
zlib-devel \
zlib-devel.i686


#创建用户和组

[root@centos7 ~]# unzip linuxx64_12201_database.zip ^C
[root@centos7 ~]# groupadd -g 54321 oinstall
[root@centos7 ~]# groupadd -g 54322 dba
[root@centos7 ~]# groupadd -g 54323 oper
[root@centos7 ~]# useradd -u 54321 -g oinstall -G dba,oper oracle
[root@centos7 ~]# passwd oracle


#关闭selinux和防火墙:

vim /etc/selinux/config

SELINUX=disabled

[root@centos7 ~]# systemctl stop firewalld

[root@centos7 ~]# systemctl disable firewalld


#创建目录:

[root@centos7 ~]# mkdir -p /u01/app/oracle/product/12.2.0.1/db_1
[root@centos7 ~]#
[root@centos7 ~]# chown -R oracle:oinstall /u01
[root@centos7 ~]# chmod 775 /u01


#配置环境变量:

[root@centos7 ~]# vim /home/oracle/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=centos7
export ORACLE_UNQNAME=cdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=cdb

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib


安装

编辑应答文件:

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=cdb1
oracle.install.db.config.starterdb.SID=cdb1
oracle.install.db.config.starterdb.characterSet=AL32UTF8
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true


开始安装:

[oracle@centos7 database]$ ./runInstaller -force -silent -noconfig -responseFile /u01/database/response/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 11715 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 2047 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-04-15_08-36-48PM. P[oracle@centos7 database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
/u01/app/oracle/oraInventory/logs/installActions2017-04-15_08-36-48PM.log
The installation of Oracle Database 12c was successful.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2017-04-15_08-36-48PM.log' for more details.

As a root user, execute the following script(s):
1. /u01/app/oracle/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/12.2.0.1/db_1/root.sh

Successfully Setup Software.


执行两个脚本:

[root@centos7 ~]# /u01/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@centos7 ~]# /u01/app/oracle/product/12.2.0.1/db_1/root.sh
Check /u01/app/oracle/product/12.2.0.1/db_1/install/root_centos7_2017-04-15_20-56-27-813321685.log for the output of root script
[root@centos7 ~]#


配置,添加监听:

[oracle@centos7 response]$ cat netca.rsp | grep -Ev "^#|^$"

[GENERAL]
RESPONSEFILE_VERSION="12.2"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
[oracle@centos7 response]$ netca -silent -responsefile /u01/database/response/netca.rsp

Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/database/response/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.0.1/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@centos7 response]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 15-APR-2017 21:05:32

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=centos7)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                15-APR-2017 21:05:24
Uptime                    0 days 0 hr. 0 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0.1/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/centos7/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos7)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully


创建数据库,修改相应文件,有些参数有默认值就不需要

[oracle@centos7 response]$ cat /home/oracle/dbca.rsp | grep -Ev '^#|^$'
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=cdb1
sid=cdb1
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=false
createServerPool=false
serverPoolName=
cardinality=
force=false
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=1
pdbName=cdb1pdb
useLocalUndoForPDBs=true
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/12.2.0.1/db_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword=
serviceUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=false
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=false
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}
storageType=FS
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=false
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=LISTENER
variablesFile=
variables=DB_UNIQUE_NAME=cdb1,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=cdb1,ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1,SID=cdb1
initParams=undo_tablespace=UNDOTBS1,memory_target=796MB,processes=300,db_recovery_file_dest_size=2780MB,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=cdb1XDB),db_recovery_file_dest={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME},db_block_size=8192BYTES,diagnostic_dest={ORACLE_BASE},audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,nls_territory=AMERICA,local_listener=LISTENER_CDB1,compatible=12.2.0,control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl"),db_name=cdb1,audit_trail=db,remote_login_passwordfile=EXCLUSIVE,open_cursors=300
sampleSchema=false
memoryPercentage=40
databaseType=MULTIPURPOSE
automaticMemoryManagement=true
totalMemory=0

 创建数据库

[oracle@centos7 response]$ dbca -silent -createDatabase  -responseFile  /home/oracle/dbca.rsp

[WARNING] [DBT-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (2,730 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
[WARNING] [DBT-11209] Current available physical memory is less than the required physical memory (796MB) for creating the database.
Enter SYS user password:

Enter SYSTEM user password:

Enter PDBADMIN User Password:

[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (3,571 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
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/cdb1/cdb1.log" for further details.

查看状态

[oracle@centos7 response]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sat Apr 15 23:07:08 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL> select status from v$instance;

STATUS
------------
OPEN
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: