一、系统初始化

#根据需要优化下系统即可
[root@localhost tmp]# bash xc-init.sh

二、安装依赖

yum install -y binutils compat-libcap1 \
compat-libstdc++-33 gcc-c++ gcc \
glibc glibc-devel ksh libgcc libstdc++ \
libstdc++-devel libaio libaio-devel \
make sysstat unixODBC unixODBC-devel \
elfutils-libelf-devel

三、修改HOSTNAME

[root@localhost ~]# hostnamectl set-hostname xiangys-oracle

四、内核修改

[root@xiangys-oracle ~]# vim /etc/sysctl.conf
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.all.arp_announce=2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv4.conf.lo.arp_announce=2
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576

[root@xiangys-oracle ~]# sysctl -p

五、创建用户和组

[root@xiangys-oracle ~]# groupadd oinstall
[root@xiangys-oracle ~]# groupadd -g 502 dba
[root@xiangys-oracle ~]# useradd -u 502 -g oinstall -G dba oracle
[root@xiangys-oracle ~]# passwd oracle

六、添加文件句柄数

[root@xiangys-oracle ~]# vim /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768

七、网络设置

[root@xiangys-oracle ~]# vim /etc/hosts
192.168.10.86 xiangys-oracle

八、配置oracle用户环境变量

[root@xiangys-oracle ~]# vim /home/oracle/.bashrc
export PATH=PATH:HOME/bin
export ORACLE_SID=orcl
export ORACLE_BASE=/data/oracle/app/oracle/soft
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export ORACLE_HOME=/data/oracle/app/oracle/product/11.2.0/dbhome_1
export PATH=PATH:HOME/bin:ORACLE_HOME/bin
export LD_LIBRARY_PATH=ORACLE_HOME/lib:$LD_LIBRARY_PATH

九、创建目录

[root@xiangys-oracle ~]# mkdir -p /data/oracle/app/oracle
[root@xiangys-oracle ~]# chown -R oracle:oinstall /data/oracle
[root@xiangys-oracle ~]# chmod -R 775 /data/oracle

十、配置静默文件

[oracle@xiangys-oracle tmp]ll|grep zip
-rw-r--r-- 1 oracle oinstall 1239269270 12月 13 11:09 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r-- 1 oracle oinstall 1111416131 12月 13 11:09 p13390677_112040_Linux-x86-64_2of7.zip

[oracle@xiangys-oracle tmp] unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@xiangys-oracle tmp]$ unzip p13390677_112040_Linux-x86-64_2of7.zip

十一、创建静默安装目录

[oracle@xiangys-oracle tmp]mkdir db
[oracle@xiangys-oracle tmp] cd db/
11.1 创建静默安装文件
[oracle@xiangys-oracle db]$ vi oracleinstall.rsp         //配置静默安装库,注意:主机名等相关信息需要修改
添加以下文件
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
#hostname
ORACLE_HOSTNAME=xiangys-oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oracle/app/oraInventory
SELECTED_LANGUAGES=en
#oracle_home base
ORACLE_HOME=/data/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/data/oracle/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=false
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.config.starterdb.characterSet=
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
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.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
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_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=SKIP_UPDATES
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
11.2 创建静默创建网络文件
[oracle@xiangys-oracle db]vi netca.rsp        //配置静默初始化网络文件配置
添加如下文件
[GENERAL]
RESPONSEFILE_VERSION="11.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"}

11.3静默建库配置文件
[oracle@xiangys-oracle db] vi dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
GDBNAME = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
TEMPLATENAME = "General_Purpose.dbc"
CHARACTERSET = "AL32UTF8"
TOTALMEMORY = "2048"

十二、静默安装

[oracle@xiangys-oracle db]cd /tmp/database/
[oracle@xiangys-oracle ~] echo ORACLE_HOME
/data/oracle/app/oracle/product/11.2.0/dbhome_1
[oracle@xiangys-oracle database] ./runInstaller -silent -noconfig -responseFile /tmp/db/oracleinstall.rsp    //静默安装

以root身份执行1.2条脚本
[root@xiangys-oracle ~]# vi ~/.bashrc
export PATH=PATH:HOME/bin
export ORACLE_SID=orcl
export ORACLE_BASE=/data/oracle/app/oracle/soft
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export ORACLE_HOME=/data/oracle/app/oracle/product/11.2.0/dbhome_1
export PATH=PATH:HOME/bin:ORACLE_HOME/bin
export LD_LIBRARY_PATH=ORACLE_HOME/lib:$LD_LIBRARY_PATH

[root@xiangys-oracle ~]# source ~/.bashrc

[root@xiangys-oracle ~]# bash -x /data/oracle/app/oraInventory/orainstRoot.sh
[root@xiangys-oracle ~]# bash -x /data/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

十三、Oracle 排错

#查看二进制程序依赖库是否正常
[oracle@xiangys-oracle database]$ ldd /data/oracle/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus   

十四、静默建网

[oracle@xiangys-oracle database]$ netca -silent -responsefile /tmp/db/netca.rsp

十五、静默建库

[oracle@xiangys-oracle database]$ dbca -silent -responseFile /tmp/db/dbca.rsp

十六、管理数据库

16.1 查看oracle监控状况
[oracle@xiangys-oracle database]$ lsnrctl status
16.2 连接数据库
$ sqlplus / as sysdba   #以OS身份连接,oracle有两种认证,此类型为通过系统认证
SQL> connect / as sysdba    #登录后必须要执行该命令进行连接到db 
16.3 启动数据库
SQL> STARTUP
16.4 查看当前所有的数据库
SQL> select name from v$database;
最后修改日期: 2020年3月31日

作者

留言

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。