文章目录
创建用户组:
groupadd oinstall
groupadd dba
groupadd asmdba
groupadd backupdba
groupadd dgdba
groupadd kmdba
groupadd racdba
groupadd oper
useradd -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper -m oracle
echo oracle:oracle|chpasswd
创建安装目录:
mkdir -p /data/oracle/product/19.3.0/db_1
chown oracle:oinstall -R /data
chown -R oracle:oinstall /data
chmod -R 755 /data
安装依赖:
配置网络yum源可参考另一篇文章笔记
https://blog.csdn.net/m0_65016859/article/details/142457144?fromshare=blogdetail&sharetype=blogdetail&sharerId=142457144&sharerefer=PC&sharesource=m0_65016859&sharefrom=from_link
yum -y install bc binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make gcc gcc-c++ net-tools nfs-utils python python-configshell python-rtslib python-six targetcli smartmontools sysstat
环境变量配置:
su - oracle
vi .bash_profile
# for oracle
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=/data/oracle/product/19.3.0/db_1
export ORACLE_UNQNAME=cs
export ORACLE_SID=cqtkjtb
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LC_CTYPE=en_US.UTF-8
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
unset USERNAME
umask 022
stty erase ^H
alias rm='rm -i'
上传安装包,赋权并解压
chown -R oracle:oinstall LINUX.X64_193000_db_home.zip
unzip -q LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
cd $ORACLE_HOME/install/response
cp db_install.rsp db_install.rsp.bak
编辑安装响应文件:根据自己的路径修改
sed -i 's/^oracle.install.option=/oracle.install.option=INSTALL_DB_SWONLY/g' db_install.rsp
sed -i 's/^UNIX_GROUP_NAME=/UNIX_GROUP_NAME=oinstall/g' db_install.rsp
sed -i 's#^INVENTORY_LOCATION=#INVENTORY_LOCATION=/data/oracle/oraInventory#g' db_install.rsp
sed -i 's#^ORACLE_HOME=#ORACLE_HOME=/data/oracle/product/19.3.0/db_1#g' db_install.rsp
sed -i 's#^ORACLE_BASE=#ORACLE_BASE=/data/oracle#g' db_install.rsp
sed -i 's/^oracle.install.db.InstallEdition=/oracle.install.db.InstallEdition=EE/g' db_install.rsp
sed -i 's/^oracle.install.db.OSDBA_GROUP=/oracle.install.db.OSDBA_GROUP=dba/g' db_install.rsp
sed -i 's/^oracle.install.db.OSOPER_GROUP=/oracle.install.db.OSOPER_GROUP=dba/g' db_install.rsp
sed -i 's/^oracle.install.db.rootconfig.executeRootScript=/oracle.install.db.rootconfig.executeRootScript=false/g' db_install.rsp
sed -i 's#^INVENTORY_LOCATION=.*#INVENTORY_LOCATION=/data/oracle/inventory#' /data/oracle/product/19.3.0/db_1/install/response/db_install.rsp
sed -i 's/^oracle.install.db.OSBACKUPDBA_GROUP=/oracle.install.db.OSBACKUPDBA_GROUP=osbackupdba/' /data/oracle/product/19.3.0/db_1/install/response/db_install.rsp
sed -i 's/^oracle.install.db.OSDGDBA_GROUP=/oracle.install.db.OSDGDBA_GROUP=osdgdba/' /data/oracle/product/19.3.0/db_1/install/response/db_install.rsp
sed -i 's/^oracle.install.db.OSKMDBA_GROUP=/oracle.install.db.OSKMDBA_GROUP=oskmdba/' /data/oracle/product/19.3.0/db_1/install/response/db_install.rsp
sed -i 's/^oracle.install.db.OSRACDBA_GROUP=/oracle.install.db.OSRACDBA_GROUP=osracdba/' /data/oracle/product/19.3.0/db_1/install/response/db_install.rsp
查看参数修改情况:路径修改为自己的路径
grep -E 'oracle.install.option|UNIX_GROUP_NAME|INVENTORY_LOCATION|ORACLE_HOME|ORACLE_BASE|oracle.install.db.InstallEdition|oracle.install.db.OSDBA_GROUP|oracle.install.db.OSOPER_GROUP|oracle.install.db.rootconfig.executeRootScript|oracle.install.db.OSBACKUPDBA_GROUP|oracle.install.db.OSDGDBA_GROUP|oracle.install.db.OSKMDBA_GROUP|oracle.install.db.OSRACDBA_GROUP' /data/oracle/product/19.3.0/db_1/install/response/db_install.rsp
运行安装
cd $ORACLE_HOME
./runInstaller -silent -responseFile /data/oracle/product/19.3.0/db_1/install/response/db_install.rsp
根据提示进行安装
监听创建:无需修改响应文件
cd /data/oracle/product/19.3.0/db_1/assistants/netca/
netca /silent /responseFile /data/oracle/product/19.3.0/db_1/assistants/netca/netca.rsp
数据库实例创建:
cd /data/oracle/product/19.3.0/db_1/assistants/dbca/
sed -i 's/^gdbName=/gdbName=cqtkjtb/g' dbca.rsp
sed -i 's/^sid=/sid=cqtkjtb/g' dbca.rsp
sed -i 's/^databaseConfigType=/databaseConfigType=SI/g' dbca.rsp
sed -i 's/^templateName=/templateName=General_Purpose.dbc/g' dbca.rsp
sed -i 's/^sysPassword=/sysPassword=P@ssw0rd/g' dbca.rsp
sed -i 's/^systemPassword=/systemPassword=P@ssw0rd/g' dbca.rsp
sed -i 's/^emConfiguration=/emConfiguration=DBEXPRESS/g' dbca.rsp
sed -i 's/^dbsnmpPassword=/dbsnmpPassword=P@ssw0rd/g' dbca.rsp
sed -i 's#^datafileDestination=#datafileDestination=/data/oracle/oradata#g' dbca.rsp
sed -i 's/^characterSet=/characterSet=AL32UTF8/g' dbca.rsp
sed -i 's/^totalMemory=/totalMemory=3100/g' dbca.rsp
查看修改后的参数:
grep -E 'gdbName|sid|databaseConfigType|templateName|sysPassword|systemPassword|emConfiguration|dbsnmpPassword|datafileDestination|characterSet|totalMemory' /data/oracle/product/19.3.0/db_1/assistants/dbca/dbca.rsp
运行创建:
dbca -silent -createDatabase -responseFile /data/oracle/product/19.3.0/db_1/assistants/dbca/dbca.rsp
创建oracle数据库用户
CREATE USER "cqtkjtbtest" IDENTIFIED BY "cqtkjtbtest_JY.COM";
GRANT CONNECT TO CQTKJTBTEST;
GRANT RESOURCE TO CQTKJTBTEST;
GRANT CREATE SESSION TO CQTKJTBTEST;
SELECT * FROM dba_sys_privs WHERE grantee = 'CQTKJTBTEST';
sqlplus cqtkjtbtest/[email protected]:1521/cqtkjtb
标签:oracle19c,data,db,redhat7,静默,sed,install,oracle,rsp
From: https://blog.csdn.net/m0_65016859/article/details/142462560