我使用的是虚拟机
内存不少于1G, 1.5G没用那么容易卡
磁盘不少于40G 建议50G以上
我设置为orcl
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERNDS=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEEROUTES=yes
IPV6_PEEROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=ens33
UUID=43d6070e-ee02-46e4-a6cb-fe2ce2013d5a
DEVICE=ens33
ONBOOT=yes
IPADDR0=192.168.42.132
GATEWAY0=192.168.42.2
DNS1=8.8.8.8
DNS2=114.114.114.114
ip地址必须和ifcfg-ens33 中的GATEWAY0相同
使用默认yum源即可, 163的也可以
yum clean all && yum makecache
wget ifconfig vim 等你需要的
vim /etc/selinux/config
SELINUX=disabled
查看防火墙状态
firewall-cmd --state
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
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
vim /etc/sysctl.conf 请根据自己实际情况修改,内核参数如下
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
/sbin/sysctl -p 刷新内核参数表
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
vim /etc/pam.d/login
session required pam_limits.so
vim /etc/profile
if [ $USER = “oracle” ]; then
if [ $SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
source /etc/profile
groupadd oinstall
groupadd dba
groupadd asmadmin
groupadd asmdba
useradd -g oinstall -G dba,asmdba oracle -d /home/oracle
passwd oracle
mkdir /u01
mkdir /u01/app
mkdir -p /u01/app/oracle/oradata //存放数据库的数据目录
mkdir -p /u01/app/oracle/oradata_back //存放数据库备份文件
chmod -R 775 /u01/app //权限
chown -R oracle:oinstall /u01 //属主属组
vim /etc/proile
PATH= P A T H : PATH: PATH:HOME/.local/bin:KaTeX parse error: Expected 'EOF', got '#' at position 73: … #̲日志存放位置 export T…TMP
export ORACLE_HOSTNAME=Oracle #主机名
export ORACLE_UNQNAME=orcl #库名称
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=KaTeX parse error: Expected 'EOF', got '#' at position 78: … #̲库名称 export PATH…PATH
export PATH= O R A C L E H O M E / b i n : ORACLE_HOME/bin: ORACLEHOME/bin:PATH
export LD_LIBRARY_PATH= O R A C L E H O M E / l i b : / l i b : / u s r / l i b e x p o r t C L A S S P A T H = ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH= ORACLEHOME/lib:/lib:/usr/libexportCLASSPATH=ORACLE_HOME/jlib: O R A C L E H O M E / r d b m s / j l i b e x p o r t P A T H = / u s r / s b i n : ORACLE_HOME/rdbms/jlib export PATH=/usr/sbin: ORACLEHOME/rdbms/jlibexportPATH=/usr/sbin:PATH
export PATH= O R A C L E H O M E / b i n : ORACLE_HOME/bin: ORACLEHOME/bin:PATH
export LD_LIBRARY_PATH= O R A C L E H O M E / l i b : / l i b : / u s r / l i b e x p o r t C L A S S P A T H = ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH= ORACLEHOME/lib:/lib:/usr/libexportCLASSPATH=ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
下载安装包到/home/oracle/ 下面 linuxx64_12201_database.zip
unzip linuxx64_12201_database.zip /home/oracle/
su – root
cd /home/oracle/
mkdir etc
cp /home/oracle/database/response/* /home/oracle/etc/
chmod 777 /home/oracle/etc/*.rsp
/home/oracle/etc/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY //30行安装类型,只装数据库软件
UNIX_GROUP_NAME=oinstall //35行主机名称(hostname查询)
INVENTORY_LOCATION=/u01/app/oracle/oraInventory //42行INVENTORY目录(不填就是默认值)
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1 //46行oracle目录
ORACLE_BASE=/u01/app/oracle //51行
oracle.install.db.InstallEdition=EE //63行oracle版本
oracle.install.db.OSDBA_GROUP=dba //80行
oracle.install.db.OSOPER_GROUP=oinstall //86行 自定义安装,否,使用默认组件
oracle.install.db.OSBACKUPDBA_GROUP=dba //91行
oracle.install.db.OSDGDBA_GROUP=dba //96行
oracle.install.db.OSKMDBA_GROUP=dba //101行
oracle.install.db.OSRACDBA_GROUP=dba //106行
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //180行数据库类型
oracle.install.db.config.starterdb.globalDBName=orcl //185行
oracle.install.db.config.starterdb.SID=orcl //190行
oracle.install.db.config.starterdb.characterSet=AL32UTF8 //216行
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //384行
DECLINE_SECURITY_UPDATES=true //398行//设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
su - oracle
cd /home/oracle/database
./runInstaller -force -silent -noconfig -responseFile /home/oracle/etc/db_install.rsp
可以边装边查看日志
tail –f /u01/app/oracle/oraInventory/logs/installActions2019-09-15_08-36-48PM.log
如果报错: 看看是否未授权 /home/oracle/etc/*.rsp
su - root
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/12.2.0.1/db_1/root.sh
部分只需要执行第二条脚本
su - oracle
netca -silent -responsefile /home/oracle/etc/netca.rsp
查看监听: netstat status
启动监听: netstat start
netstat -tlnp
vim /home/oracle/etc/dbca.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0//21行不可更改
gdbName=orcl //32
sid=orcl //42
databaseConfigType=SI //52
policyManaged=false //74
createServerPool=false //88
force=false //127
createAsContainerDatabase=true //163
numberOfPDBs=1 //172
pdbName=orclpdb //182
useLocalUndoForPDBs=true //192
templateName=/u01/app/oracle/product/12.2.0.1/db_1/assistants/dbca/templates/General_Purpose.dbc //223
emExpressPort=5500 //273
runCVUChecks=false //284
omsPort=0 //313
dvConfiguration=false //341
olsConfiguration=false //391
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/ //401
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/ //411
recoveryAreaDestination={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME} //421
storageType=FS //431
characterSet=AL32UTF8 //468字符集创建库之后不可更改
nationalCharacterSet=AL16UTF16 //478
registerWithDirService=false //488
listeners=LISTENER //526
variables=DB_UNIQUE_NAME=cdb1,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=orcl,ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1,SID=orcl //546
initParams=undo_tablespace=UNDOTBS1,memory_target=796MB,processes=300,db_recovery_file_dest_size=2780MB,nls_language=AMERICAN //555
sampleSchema=false //565
memoryPercentage=40 //574
databaseType=MULTIPURPOSE //584
automaticMemoryManagement=true //594
totalMemory=0 //604
cd /u01/database
dbca -silent -createDatabase -responseFile /home/oracle/etc//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.*
安装时间特别长, 注意别win10自动待机,导致安装到一半未完成
ps -ef | grep ora_ | grep -v grep
lsnrctl status (lsnrctl是oracle命令)
sqlplus / as sysdba
sqlplus sys/oracle as sysdba;
conn sys/oracle as sysdba;
select name,cdb from v$database;
select sys_context (‘USERENV’, ‘CON_NAME’) from dual;
select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
alter session set container=ORCLPDB;
select sys_context (‘USERENV’, ‘CON_NAME’) from dual;
create user test identified by oracle default tablespace users temporary tablespace temp;
alter user test account unlock;
grant create session, create any view, create any procedure, execute any procedure to test ;
grant connect, resource to test ;
vim /u01/app/oracle/product/12.2.0.1/db_1/network/admin/tnsnames.ora
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = orcl)(PORT = 1539))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
dbstop
su - oracle
lsnrctl start
dbstart
vi /etc/oratab
orcl:/u01/app/oracle/product/12.2.0.1/db_1:N
将上面的N改为Y
su - oracle
cd $ORACLE_HOME/bin
vi dbstart
修改 #ORACLE_HOME_LISTNER= 1 为 O R A C L E H O M E L I S T N E R = 1 为 ORACLE_HOME_LISTNER= 1为ORACLEHOMELISTNER=ORACLE_HOME
vi dbshut
修改 #ORACLE_HOME_LISTNER= 1 为 O R A C L E H O M E L I S T N E R = 1 为 ORACLE_HOME_LISTNER= 1为ORACLEHOMELISTNER=ORACLE_HOME
chmod 777 /etc/rc.d/rc.local
vi /etc/rc.d/rc.local
添加 su - oracle -lc dbstart