1据忘、系統(tǒng)環(huán)境:centos7厘托、linuxx64_12201_database.zip
2浆洗、配置主機(jī)名:vi /etc/hosts,添加配置項(xiàng)192.168.1.200? bogon
3赤嚼、創(chuàng)建oracle用戶以及用戶組:
? ??groupadd -g54321 oinstall
????groupadd -g54322 dba
????groupadd -g54323 oper
????useradd -u 54321 -g oinstall -G dba,oper? oracle
? ? 并使用root用戶需改oracle用戶的登錄密碼旷赖。
? ??不必非要按照叫oinstall,和dba更卒,只不過一般文檔上就這么叫
????oinstall組用于安裝數(shù)據(jù)庫
????dba組用于管理數(shù)據(jù)庫
????-g 表示這個用戶的主組
????-G 標(biāo)識這個用戶的其它組
????一個用戶可以屬于多個用戶組等孵,但是一個用戶只能指定一個組作為其主組
4、使用oralce用戶上傳安裝文件
5蹂空、安裝依賴軟件
yum install binutils -y?
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y?
yum install compat-libstdc++-33.i686 -y?
yum install glibc -y?
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh-yyuminstalllibaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y?
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libXi -y?
yum install libXi.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install make -y?
yum install nfs-utils -y
yum install net-tools -y
yum install smartmontools -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
6俯萌、限制oracle用戶資源使用: vi /etc/security/limits.conf?
添加如下信息:
? ??oracle soft nofile 1024
????oracle hard nofile 65536
????oracle soft nproc 16384
????oracle hard nproc 16384
????oracle soft stack 1024
????0oracle hard stack 32768?
????oracle hard memlock 134217728
????oracle soft memlock 134217728
7、配置內(nèi)核參數(shù):
? ? 添加如下:
????fs.file-max =6815744
????kernel.sem =25032000100128
????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 =900065500
? ??運(yùn)行sysctl -p命令更改當(dāng)前內(nèi)核參數(shù)
8上枕、修改設(shè)置SELINUX
? ??????vi /etc/selinux/config
? ? ? ? 將`SELINUX`修改為permissive咐熙,即:SELINUX=permissive
? ? ? ? ?setenforce Permissive
9、禁用防火墻:
? ??systemctl stop firewalld
? ? systemctl disable firewalld
10辨萍、創(chuàng)建oralce安裝目錄
? ??mkdir -p /usr/local/products/oracle12c
? ??chown -R oracle:oinstall /usr/local
????chmod -R 775 /usr/local/
11棋恼、配置環(huán)境變量并驗(yàn)證
? ??export TMP=/tmp
????export TMPDIR=$TMP
????export ORACLE_HOSTNAME=bogon(注:主機(jī)名)
????export ORACLE_UNQNAME=cdb1
????export ORACLE_BASE=/usr/local/products
????export ORACLE_HOME=$ORACLE_BASE/oracle12c
????export ORACLE_SID=cdb1
????export PATH=/usr/sbin:/usr/local/bin:$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
? ? 使文件生效:source .bash_profile
? ? 驗(yàn)證:echo $ORACLE_HOME
12、解壓安裝包:unzip linuxx64_12201_database.zip
13锈玉、修改配置文件
? ??cd database/response/
????vim db_install.rsp
? ? 修改內(nèi)容如下:
? ??oracle.install.option=INSTALL_DB_SWONLY
????UNIX_GROUP_NAME=oinstall
????INVENTORY_LOCATION=/usr/local/products/oracle12c/oraInventory
????ORACLE_HOME=/usr/local/products/oracle12c
????ORACLE_BASE=/usr/local/products
????oracle.install.db.InstallEdition=EE
????oracle.install.db.OSDBA_GROUP=dba
????oracle.install.db.OSBACKUPDBA_GROUP=dba
????oracle.install.db.OSDGDBA_GROUP=dba
????oracle.install.db.OSKMDBA_GROUP=dba
????oracle.install.db.OSRACDBA_GROUP=dba
14爪飘、安裝oracle
?命令行方式:
./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \
-showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/usr/local/products/oracle12c/oraInventory \
ORACLE_HOME=/usr/local/products/oracle12c \
ORACLE_BASE=/usr/local/products \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba
響應(yīng)文件安裝:
./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \
-showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp
安裝完成后使用root用戶執(zhí)行以下腳本:
? ??/usr/local/products/oracle12c/oraInventory/orainstRoot.sh
????/usr/local/products/oracle12c/root.sh
執(zhí)行命令:sqlplus / as sysdba
[oracle@solang ~]$ sqlplus / as sysdba
SQL*Plus:Release12.2.0.1.0ProductiononSun May2711:52:012018
Copyright (c)1982,2016, Oracle.Allrights reserved.
Connectedtoan idle instance.
SQL>
此時數(shù)據(jù)庫安裝成功。
15拉背、創(chuàng)建數(shù)據(jù)庫:
?dbca -silent -createDatabase \?
-templateName/usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc \?
-gdbname cdb1 -sid cdb1 -responseFile/home/oracle/database/response/dbca.rsp \?
-characterSetAL32UTF8 \?
-sysPasswordOraPasswd1 \?
-systemPasswordOraPasswd1 \
?-createAsContainerDatabasetrue\?
-numberOfPDBs1\?
-pdbName pdb1 \?
-pdbAdminPasswordOraPasswd1 \?
-automaticMemoryManagementfalse\?
-ignorePreReqs
數(shù)據(jù)文件目錄datafileDestination默認(rèn)安裝在$ORACLE_BASE/oradata下
注意:密碼設(shè)置需要密碼長度至少8位师崎,包含至少1個大寫字符,1個小寫字符和1個數(shù)字[0-9]椅棺。?
再次執(zhí)行命令:sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sat May 4 14:31:46 2019
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 status from v$instance;
STATUS
------------
OPEN
SQL>
16犁罩、數(shù)據(jù)庫監(jiān)聽配置:
查看監(jiān)聽狀態(tài):lsnrctl status
[oracle@bogon ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 04-MAY-2019 14:34:14
Copyright (c) 1991, 2016, Oracle.? All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
? TNS-00511: No listener
? Linux Error: 111: Connection refused
[oracle@bogon ~]$
此時監(jiān)聽未啟動
使用默認(rèn)的netca.rsp文件?
?執(zhí)行命令netca -silent -responseFile /home/oracle/database/response/netca.rsp
[oracle@bogon ~]$ netca -silent -responseFile /home/oracle/database/response/netca.rsp
Parsing command line arguments:
? ? Parameter "silent" = true
? ? Parameter "responsefile" = /home/oracle/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
? ? Running Listener Control:
? ? ? /usr/local/products/oracle12c/bin/lsnrctl start LISTENER
? ? Listener Control complete.
? ? Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@bogon ~]$
啟動成功齐蔽,此時再次查看監(jiān)聽狀態(tài):
[oracle@bogon ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 04-MAY-2019 14:36:30
Copyright (c) 1991, 2016, Oracle.? All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bogon)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias? ? ? ? ? ? ? ? ? ? LISTENER
Version? ? ? ? ? ? ? ? ? TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date? ? ? ? ? ? ? ? 04-MAY-2019 14:35:24
Uptime? ? ? ? ? ? ? ? ? ? 0 days 0 hr. 1 min. 6 sec
Trace Level? ? ? ? ? ? ? off
Security? ? ? ? ? ? ? ? ? ON: Local OS Authentication
SNMP? ? ? ? ? ? ? ? ? ? ? OFF
Listener Parameter File? /usr/local/products/oracle12c/network/admin/listener.ora
Listener Log File? ? ? ? /usr/local/products/diag/tnslsnr/bogon/listener/alert/log.xml
Listening Endpoints Summary...
? (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bogon)(PORT=1521)))
? (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "880ae9e0f0144dbee055266a1fb8e3c7" has 1 instance(s).
? Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "cdb1" has 1 instance(s).
? Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "cdb1XDB" has 1 instance(s).
? Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "pdb1" has 1 instance(s).
? Instance "cdb1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@bogon ~]$
監(jiān)聽配置成功。
17床估、結(jié)束:
? ? 啟動監(jiān)聽:lsnrctl start
? ? 停止監(jiān)聽:lsnrctl stop