发布网友 发布时间:2022-05-03 08:29
共2个回答
懂视网 时间:2022-05-03 12:50
12.2 + Centos7.5
安装日志:
--查看内存
free -h # 或者使用 Free 查看内存和交换空间
--查看内核
uname -a
uname -r
--安装依赖包
Package Requirements(软件包需求),以下是 Oracle Database 11g 第2版??(11.2)所需的软件包列表:(其中后缀为 .el7.i686 需要从互联网上下载,而其他安装包可以由 CentOS 7.4 映像文件提供 )
ping www.baidu.com
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum list
yum -y install telnet
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat compat-libcap1 unixODBC unixODBC-devel
yum -y install compat-libstdc++-33.i686
yum -y install glibc.i686
yum -y install glibc-devel.i686
yum -y install libaio.i686
yum -y install ksh
yum -y install libaio-devel.i686
yum -y install libgcc.i686
yum -y install libstdc++.i686
yum -y install libstdc++-devel.i686
yum -y install libxcb.i686
yum -y install libX11.i686
yum -y install libXau.i686
yum -y install libXi.i686
yum -y install libXtst.i686
yum -y install libXrender.i686
yum -y install libXrender-devel.i686
# Oracle Linux 7和Red Hat Enterprise Linux 7必须安装以下或更高版本的包:
bc
binutils #≧-2.23.52.0.1-12.el7 (x86_64)
compat-libcap1 #≧-1.10-3.el7 (x86_64)
compat-libstdc++-33.i686 #≧-3.2.3-71.el7 (i686)
compat-libstdc++-33 #≧-3.2.3-71.el7 (x86_64)
glibc.i686 #≧-2.17-36.el7 (i686)
glibc #≧-2.17-36.el7 (x86_64)
glibc-devel.i686 #≧-2.17-36.el7 (i686)
glibc-devel #≧-2.17-36.el7 (x86_64)
ksh
libaio.i686 #≧-0.3.109-9.el7 (i686)
libaio #≧-0.3.109-9.el7 (x86_64)
libaio-devel.i686 #≧-0.3.109-9.el7 (i686)
libaio-devel #≧-0.3.109-9.el7 (x86_64)
libgcc.i686 #≧-4.8.2-3.el7 (i686)
libgcc #≧-4.8.2-3.el7 (x86_64)
libstdc++.i686 #≧-4.8.2-3.el7 (i686)
libstdc++ #≧-4.8.2-3.el7 (x86_64)
libstdc++-devel.i686 #≧-4.8.2-3.el7 (i686)
libstdc++-devel #≧-4.8.2-3.el7 (x86_64)
libxcb.i686 #≧-1.9-5.el7 (i686)
libxcb #≧-1.9-5.el7 (x86_64)
libX11.i686 #≧-1.6.0-2.1.el7 (i686)
libX11 #≧-1.6.0-2.1.el7 (x86_64)
libXau.i686 #≧-1.0.8-2.1.el7 (i686)
libXau #≧-1.0.8-2.1.el7 (x86_64)
libXi.i686 #≧-1.7.2-1.el7 (i686)
libXi #≧-1.7.2-1.el7 (x86_64)
libXtst.i686 #≧-1.2.2-1.el7 (i686)
libXtst #≧-1.2.2-1.el7 (x86_64)
libXrender.i686 #≧ (i686)
libXrender #≧ (x86_64)
libXrender-devel.i686 #≧ (i686)
libXrender-devel #≧ (x86_64)
make #≧-3.82-19.el7 (x86_64)
net-tools #≧-2.0-0.17.20131004git.el7 (x86_64) (for Oracle RAC and Oracle Clusterware)
nfs-utils #≧-1.3.0-0.21.el7.x86_64 (for Oracle ACFS)
smartmontools #≧-6.2-4.el7 (x86_64)
sysstat #≧-10.1.5-1.el7 (x86_64)
--禁用selinx,防火墙,并设置用户名
setenforce 0
sed -i -e ‘s@^SELINUX=enforcing@SELINUX=disabled@‘ /etc/selinux/config
systemctl disable firewalld.service && systemctl stop firewalld.service
hostnamectl set-hostname "hnsi-gwy"
# 配置主机IP地址和主机名的变量,然后在文件 /etc/hosts 的最后一行下面插入新的行
hostip=`routel |grep host |grep -v ‘127.0.0‘ | awk ‘NR==1{ print }‘ | awk ‘{ print $1 }‘`
sed -i ‘$a‘$hostip‘ ‘$HOSTNAME‘ ‘$HOSTNAME‘‘ /etc/hosts
设置内核参数 将设置的参数打印,并重定向到 /etc/sysctl.d/99-sysctl.conf文件中
/usr/bin/cat >/etc/sysctl.d/99-sysctl.conf << EOF
# This is a parameter set for Oracle database tuning
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 83886080
kernel.shmmax = 17179869184
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586
# Kernel.shmmax (parameter) is set to 50% of the physical memory
# kernel.shmall = 2097152
# kernel.shmmax = 536870912
# kernel.shmmni = 4096
EOF
[root@wjq soft]# sysctl –a //让内核参数文件立即生效
shmmax=物理内存*80%*80%,单位是字节
kernel.shmmax:表示单个共享内存段的最大值,以字节为单位,此值一般为物理内存的一半,不过大一点也没关系,这里设定的为4GB,即“4294967295/1024/1024/1024=4G”。
kernel.shmmin:表示单个共享内存段的最小值,默认为1byte
kernel.shmall:表示整个系统范围内可用共享内存页的总量,单位是页(page),在32位系统上一页等于4kB,也就是4096字节。计算公式是:shmmax/PAGE_SIZE
kernel.shmmni:表示整个系统范围内内存段的最大数量,一般为4096.
ip_local_port_range :表示端口的范围。在监听器帮助客户端进程和服务器进程建立连接时,会用到指定范围内的端口。
kernel.sem :表示设置的信号量,这4个参数内容大小固定。
net.core.rmem_default :表示接收套接字缓冲区大小的缺省值(以字节为单位)。
net.core.rmem_max :表示接收套接字缓冲区大小的最大值(以字节为单位)
net.core.wmem_default :表示发送套接字缓冲区大小的缺省值(以字节为单位)。
net.core.wmem_max :表示发送套接字缓冲区大小的最大值(以字节为单位)。
9、 修改资源控制文件
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
资源限制是针对单个进程的限制,不是针对整个系统总的设置
修改limits.conf以后,将马上生效。但是,如果用户已经登录系统,那么对于该用户的限制将在下一次用户重新登录以后才生效。如果要让对该用户的限制生效,只能让该用户注销然后重新登录就可以了。
/etc/security/limits.conf
core - 限制内核文件的大小
date - 最大数据大小
fsize - 最大文件大小
memlock - 最大锁定内存地址空间
nofile - 打开文件的最大数目
rss - 最大持久设置大小
stack - 最大栈大小
cpu - 以分钟为单位的最多 CPU 时间
noproc - 进程的最大数目
as - 地址空间限制
maxlogins - 此用户允许登录的最大数目
nofile - 打开文件的最大数目,该值不能等于/proc/sys/fs/file-max,如果等于file-max且打开的文件句柄的数量达到file-max,用户将不能登陆操作系统。
--创建用户和组
groupadd -g 1100 oinstall
groupadd -g 1001 dba
useradd -u 600 -g oinstall -G dba oracle
passwd oracle
--创建目录
mkdir -p /home/u01/app/oracle/product/12.2.0/dbhome_1
chown -R oracle:oinstall /home/u01
chmod -R 775 /home/u01
解压安装包,设置环境变量
unzip linuxx64_12201_database.zip
vi .bash_profile
# .bash_profile
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=hnsi-gwy; export ORACLE_HOSTNAME
ORACLE_UNQNAME=SIBCGWY; export ORACLE_UNQNAME
ORACLE_BASE=/home/u01/app/oracle; export ORACLE_BASE
DB_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export DB_HOME
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
ORACLE_SID=SIBCGWY; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
BASE_PATH=/usr/sbin:$PATH; export BASE_PATH
PATH=$ORACLE_HOME/bin:$BASE_PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export PS1=‘${LOGNAME}@${HOSTNAME}:${PWD}:SID=e[31;1m${ORACLE_SID}e[0m> ‘
export CLASSPATH
--相应文件模板的存放位置
find / -name *.rsp
[oracle@hnsi-gwy database]$ find /home/u01/ -name *.rsp
/home/u01/soft/database/response/dbca.rsp
/home/u01/soft/database/response/netca.rsp
/home/u01/soft/database/response/db_install.rsp
浏览响应文件内容
sed -n ‘/^[^#]/p‘ response/db_install.rsp
编辑Oracle数据库软件响应文件db_install.rsp
vim db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/u01/app/oraInventory
ORACLE_HOME=/home/u01/app/oracle/product/12.2.0/dbhome_1
ORACLE_BASE=/home/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_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
oracle.install.db.rac.configurationType=
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=false
oracle.install.db.racOneServiceName=
oracle.install.db.rac.serverpoolName=
oracle.install.db.rac.serverpoolCardinality=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.ConfigureAsContainerDB=true
oracle.install.db.config.PDBName=
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.password.PDBADMIN=
oracle.install.db.config.starterdb.managementOption=false
oracle.install.db.config.starterdb.omsHost=
oracle.install.db.config.starterdb.omsPort=
oracle.install.db.config.starterdb.emAdminUser=
oracle.install.db.config.starterdb.emAdminPassword=
oracle.install.db.config.starterdb.enableRecovery=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
COLLECTOR_SUPPORTHUB_URL=
--获取帮助,启动静默安装
在静默安装Oracle软件之前,如果没有配置/etc/hosts文件,将会出现如五(1)的错误。
./runInstaller -help
./runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /home/u01/soft/database/response/db_install.rsp
You can find the log of this install session at:
/home/u01/app/oraInventory/logs/installActions2020-04-10_02-25-01AM.log
--配置监听器
浏览Oracle监听响应文件netca.rsp
[oracle@wjq database]$ sed -n ‘/^[^#]/p‘ response/netca.rsp
[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"}
编辑监听器配置响应文件netca.rsp
[oracle@wjq database]$ vim response/netca.rsp
[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_HOME/bin/netca -silent -responsefile /home/u01/soft/database/response/netca.rsp
查看监听状态,并启动监听器
lsnrctl status
--创建数据库
浏览Oracle数据库响应文件dbca.rsp
sed -n ‘/^[^#]/p‘ response/dbca.rsp
编辑响应文件dbca.rsp
vim response/dbca.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=SIBCGWY
sid=SIBCGWY
databaseConfigType=
RACOneNodeServiceName=
policyManaged=
createServerPool=
serverPoolName=
cardinality=
force=
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=1
pdbName=sibp_gwy
useLocalUndoForPDBs=
pdbAdminPassword=
nodelist=
templateName=General_Purpose.dbc
sysPassword=Orcl2020
systemPassword=Orcl2020
oracleHomeUserPassword=Orcl2020
emConfiguration=
emExpressPort=5500
runCVUChecks=
dbsnmpPassword=
omsHost=
omsPort=
emUser=
emPassword=
dvConfiguration=
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=
datafileJarLocation=
datafileDestination=
recoveryAreaDestination=
storageType=
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=
registerWithDirService=
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=LISTENER
variablesFile=
variables=
initParams=
sampleSchema=true
memoryPercentage=
databaseType=
automaticMemoryManagement=FALSE
totalMemory=0
静默创建数据库
$ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/u01/soft/database/response/dbca.rsp
[root@hnsi-gwy ~]# more /home/u01/app/oracle/cfgtoollogs/dbca/SIBCGWY/SIBCGWY.log
[ 2020-04-10 02:59:08.949 EDT ] Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 2%
[ 2020-04-10 02:59:18.593 EDT ] ORA-27104: system-defined limits for shared memory was misconfigured
DBCA_PROGRESS : 3%
[ 2020-04-10 02:59:18.595 EDT ] ORA-01034: ORACLE not available
[ 2020-04-10 02:59:18.596 EDT ] ORA-01034: ORACLE not available
[ 2020-04-10 02:59:23.765 EDT ] DBCA_PROGRESS : DBCA Operation failed.
解决:
vi /etc/sysctl.d/99-sysctl.conf
kernel.shmall = 2097152 #改为83886080
测试实例是否注册成功和能否登录到数据库
lsnrctl status
--停库停监听打补丁
压缩包:
17p6880880_122010_Linux-x86-64.zip
20191015DBp30138470_122010_Linux-x86-64.zip
20191015OJVMp30133625_122010_Linux-x86-64.zip
cd soft/
unzip /tmp/20191015DBp30138470_122010_Linux-x86-64.zip
$ORACLE_HOME/OPatch/opatch version
cd $ORACLE_HOME/
mv OPatch OPatchbak
unzip /tmp/17p6880880_122010_Linux-x86-64.zip
$ORACLE_HOME/OPatch/opatch version
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/u01/soft/30138470 -oh $ORACLE_HOME
$ORACLE_HOME/OPatch/opatch apply /tmp/30138470 -analyze
$ORACLE_HOME/OPatch/opatch apply /tmp/30138470
报错
Prerequisite check "CheckSystemCommandAvailable" failed.
OPatch failed with error code 73
解决:
参考 Doc ID 1581604.1
yum -y install psmisc
OPatch found the word "error" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
chmod: changing permissions of ‘/home/u01/app/oracle/product/12.2.0/dbhome_1/bin/extjobO’: Operation not permitted
make: [iextjob] Error 1 (ignored)
$ORACLE_HOME/OPatch/opatch apply /tmp/30133625 -analyze
$ORACLE_HOME/OPatch/opatch apply /tmp/30133625
启动数据库、监听
cd $ORACLE_HOME/OPatch
./datapatch -verbose
验证是否打补丁成功
set lines 200 pages 200
select * from dba_registry_history;
dbca -silent -deleteDatabase -sourcedb SIBCGWY -sid SIBCGWY -sysDBAUserName system -sysDBAPassword Orcl2020
$ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/u01/soft/database/response/dbca.rsp
ORACLE12C静默安装(CDB)
标签:clu cluster 禁用 -o 没有 rmi filesyste 需要 list
热心网友 时间:2022-05-03 09:58
建库的时候可以选择不建成CDB PDB,初学者没必要使用CDB数据库追问怎么重建库追答dbca 常规新建一个即可