龙空技术网

Centos7.6上静默安装oracle11.2.0.4.0

月牙讲数据库运维 2284

前言:

现在各位老铁们对“centos安装保存了数据库文件在哪里”大致比较着重,你们都需要分析一些“centos安装保存了数据库文件在哪里”的相关内容。那么小编也在网上汇集了一些关于“centos安装保存了数据库文件在哪里””的相关内容,希望同学们能喜欢,我们快快来了解一下吧!

很多同学使用图形化安装oracle数据库,可是生产上大多数,是不会安装图形化包的,所以必须掌握怎么静默安装oracle数据库,下面就详细介绍怎么静默安装oracle11g数据库。

1.配置主机名

vi /etc/sysconfig/networkNETWORKING=yesHOSTNAME=host100
2.配置hosts信息
vi /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.0.100    host100
3.安装必要的包

先检查哪些包没安装

for i in binutils compat-gcc-44 compat-libstdc++-33 control-center \  gcc gcc-c++ glibc glibc-common glibc-devel libaio libgcc elfutils-libelf-devel \  libstdc++ libstdc++-devel libXp make compat-libcap1\  compat-libstdc++-33 libaio-devel sysstat unixODBC unixODBC-devel kshdo  rpm -q $i &>/dev/null || F="$F $i"done ;echo $F;unset F’

缺少的包,用YUM安装就可以

4.修改内核参数

vi /etc/sysctl.conf 到末尾 以下只出自oracle-rdbms-server-11gR2-preinstall自动做的修改

用#注释掉kernel.shmmax和kernel.shmall开头的两行

添加如下:

kernel.shmmax = 4398046511104kernel.shmall = 1073741824kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576fs.aio-max-nr = 1048576fs.file-max = 6815744vm.swappiness=10

以上参数为使用oracle 验证包自动配置的参数结果,vm.swappiness=10为减少使用SWAP,该值默认是60

kernel.shmall:表示共享内存总量,以页为单位

kernel.shmmax:参数用来定义单个共享内存段的最大值,单位为Byte(字节)。

可以用一下脚本,设置kernel.shmall,kernel.shmmax参数值,其它值不用修改

#!/bin/bashpage_size=`getconf PAGE_SIZE`phys_pages=`getconf _PHYS_PAGES`if [ -z "$page_size" ]; then  echo Error:  cannot determine page size  exit 1fiif [ -z "$phys_pages" ]; then  echo Error:  cannot determine number of memory pages  exit 2fishmall=`expr $phys_pages`shmmax=`expr $shmall \* $page_size`echo \# Maximum shared segment size in bytesecho kernel.shmmax = $shmmaxecho \# Maximum number of shared memory segments in pagesecho kernel.shmall = $shmall
5.修改的oracle用户限制

vi /etc/security/limits.conf 末尾添加:

oracle   soft   nofile   1024oracle   hard   nofile   65536oracle   soft   nproc    16384oracle   hard   nproc    16384oracle   soft   stack    10240oracle   hard   stack    32768
6. 修改的/etc/pam.d/login

vi /etc/pam.d/login 末尾添加:

session    required     pam_limits.so
7. 关闭的防火墙和selinux

关闭的防火墙:

linux6:

service iptables stop

chkconfig iptables off

linux7:

systemctl stop firewalld

systemctl mask firewalld

禁用selinux:

setenforce 0

getenforce

vi /etc/selinux/config 确保以下内容

SELINUX=disabled

8. 更改ulimit 设置

vi /etc/profile 末尾添加:

if [ /$USER = "oracle" ]; then    if [ /$SHELL = "/bin/ksh" ]; then        ulimit -p 16384        ulimit -n 65536    else        ulimit -u 16384 -n 65536    fi    umask 022fi
9. 建立组合用户
groupadd -g 501 oinstallgroupadd -g 502 dbauseradd -u 501 -g oinstall -G dba  oracle -d /home/oraclepasswd oracle
10. 建立安装目录
[root@ ~]#mkdir -p /u01/app/oracle/product/11.2.0/db_1mkdir -p /oracle/oradatachmod -R 775 /oraclechmod -R 775 /u01chown -R oracle:oinstall /oraclechown -R oracle:oinstall /u01
11. 设置oracle用户的环境变量

su - oracle

vi .bash_profile 末尾添加:

export ORACLE_BASE=/u01/appexport ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1export ORACLE_SID=crmdbexport PATH=$PATH:$ORACLE_HOME/binexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport NLS_LANG=AMERICAN_AMERICA.ZHS16GBKexport ORACLE_UNQNAME=crmdbexport NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'如果是UT8,可以设置export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
12.swap分区设置
fallocate -l 250M /swapfilechmod 600 /swapfilemkswap /swapfileswapon /swapfileswapon -s

在/etc/fstab中添加以下内容

/swapfile swap swap sw 0 0

13.获取软件安装配置文件

INVENTORY_LOCATION不要存放在ORACLE_BASE之下

cat db_install.rsp |grep -v "#"|sed    '/^ *$/d'oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0oracle.install.option=INSTALL_DB_SWONLYORACLE_HOSTNAME=cbov10-tidb57-206UNIX_GROUP_NAME=oinstallINVENTORY_LOCATION=/u01/app/oraInventorySELECTED_LANGUAGES=en,zh_CNORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1ORACLE_BASE=/u01/app/oracleoracle.install.db.InstallEdition=EEoracle.install.db.EEOptionsSelection=falseoracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0oracle.install.db.DBA_GROUP=dbaoracle.install.db.OPER_GROUP=oinstallSECURITY_UPDATES_VIA_MYORACLESUPPORT=falseDECLINE_SECURITY_UPDATES=trueoracle.installer.autoupdates.option=SKIP_UPDATES./runInstaller -silent -showProgress -responseFile /u01/soft/database/response/dbinstall.rsp
14.配置监听
export DISPLAY=127.0.0.1:1.0netca -silent -responsefile /u01/soft/database/response/netca.rsp在/u01/app/oracle/product/11.2.0/db_1/network/admin目录下创建tnsnames.ora文件CRMDB =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = cbov10-tidb57-206)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = crmdb)    )  )

如果监听一直出不来,可以使用alter system register手工注册

15.dbca静默建库

[GENERAL]RESPONSEFILE_VERSION = "11.2.0"OPERATION_TYPE = "createDatabase"[CREATEDATABASE]GDBNAME = "crmdb"SID="crmdb"TEMPLATENAME = "General_Purpose.dbc"CHARACTERSET = "ZHS16GBK"TOTALMEMORY = "512"SYSPASSWORD = "oracle"SYSTEMPASSWORD = "oracle"

/u01/app/oracle/product/11.2.0/db_1/assistants/dbca/templates/General_Purpose.dbc

在上述文件中,可以修改数据库文件,redo,归档模式,Controlfile存放位置和大小

dbca -silent -initParams log_archive_dest_1='location=/oracle/archivelog' -responseFile /u01/soft/database/response/db_create.rsp

设置timestamp时间显示格式

alter system set nls_date_format='yyyy-mm-dd hh24:mi:ss' scope=spfile;

/u03/app/oracle/product/11.2.0/db_1/assistants/dbca/templates/General_Purpose.dbc文件修改

<?xml version = '1.0'?><DatabaseTemplate name="General_Purpose" description="" version="11.1.0.0.0">   <CommonAttributes>      <option name="OMS" value="false"/>      <option name="JSERVER" value="true"/>      <option name="SPATIAL" value="true"/>      <option name="IMEDIA" value="true"/>      <option name="XDB_PROTOCOLS" value="true">         <tablespace id="SYSAUX"/>      </option>      <option name="ORACLE_TEXT" value="true">         <tablespace id="SYSAUX"/>      </option>      <option name="SAMPLE_SCHEMA" value="false"/>      <option name="CWMLITE" value="true">         <tablespace id="SYSAUX"/>      </option>      <option name="EM_REPOSITORY" value="true">         <tablespace id="SYSAUX"/>      </option>      <option name="APEX" value="true"/>      <option name="OWB" value="true"/>      <option name="DV" value="false"/>   </CommonAttributes>   <Variables/>   <CustomScripts Execute="false"/>   <InitParamAttributes>      <InitParams>         <initParam name="db_name" value=""/>         <initParam name="dispatchers" value="(PROTOCOL=TCP) (SERVICE={SID}XDB)"/>         <initParam name="audit_file_dest" value="{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump"/>         <initParam name="compatible" value="11.2.0.0.0"/>         <initParam name="remote_login_passwordfile" value="EXCLUSIVE"/>         <initParam name="processes" value="150"/>         <initParam name="undo_tablespace" value="UNDOTBS1"/>         <initParam name="control_files" value="("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/flash_recovery_area/{DB_UNIQUE_NAME}/control02.ctl")"/>         <initParam name="diagnostic_dest" value="{ORACLE_BASE}"/>         <initParam name="db_recovery_file_dest" value="{ORACLE_BASE}/flash_recovery_area"/>         <initParam name="audit_trail" value="db"/>         <initParam name="memory_target" value="250" unit="MB"/>         <initParam name="db_block_size" value="8" unit="KB"/>         <initParam name="open_cursors" value="300"/>         <initParam name="db_recovery_file_dest_size" value="" unit="MB"/>         <initParam name="nls_date_format" value="yyyy-mm-dd hh24:mi:ss"/>      </InitParams>      <MiscParams>         <databaseType>MULTIPURPOSE</databaseType>         <maxUserConn>20</maxUserConn>         <percentageMemTOSGA>40</percentageMemTOSGA>         <customSGA>false</customSGA>         <archiveLogMode>true</archiveLogMode>         <initParamFileName>{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/pfile/init.ora</initParamFileName>      </MiscParams>      <SPfile useSPFile="true">{ORACLE_HOME}/dbs/spfile{SID}.ora</SPfile>   </InitParamAttributes>   <StorageAttributes>      <DataFiles>         <Location>{ORACLE_HOME}/assistants/dbca/templates/Seed_Database.dfb</Location>         <SourceDBName>seeddata</SourceDBName>         <Name id="1" Tablespace="SYSTEM" Contents="PERMANENT" Size="670" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/system01.dbf</Name>         <Name id="2" Tablespace="SYSAUX" Contents="PERMANENT" Size="440" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/sysaux01.dbf</Name>         <Name id="3" Tablespace="UNDOTBS1" Contents="UNDO" Size="25" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/undotbs01.dbf</Name>         <Name id="4" Tablespace="USERS" Contents="PERMANENT" Size="5" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/users01.dbf</Name>      </DataFiles>      <TempFiles>         <Name id="1" Tablespace="TEMP" Contents="TEMPORARY" Size="20">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/temp01.dbf</Name>      </TempFiles>      <ControlfileAttributes id="Controlfile">         <maxDatafiles>100</maxDatafiles>         <maxLogfiles>16</maxLogfiles>         <maxLogMembers>3</maxLogMembers>         <maxLogHistory>1</maxLogHistory>         <maxInstances>8</maxInstances>         <image name="control01.ctl" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>         <image name="control02.ctl" filepath="{ORACLE_BASE}/flash_recovery_area/{DB_UNIQUE_NAME}/"/>      </ControlfileAttributes>      <RedoLogGroupAttributes id="1">         <reuse>false</reuse>         <fileSize unit="KB">51200</fileSize>         <Thread>1</Thread>         <member ordinal="0" memberName="redo01a.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>         <member ordinal="1" memberName="redo01b.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>      </RedoLogGroupAttributes>      <RedoLogGroupAttributes id="2">         <reuse>false</reuse>         <fileSize unit="KB">51200</fileSize>         <Thread>1</Thread>         <member ordinal="0" memberName="redo02a.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>         <member ordinal="1" memberName="redo02b.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>      </RedoLogGroupAttributes>      <RedoLogGroupAttributes id="3">         <reuse>false</reuse>         <fileSize unit="KB">51200</fileSize>         <Thread>1</Thread>         <member ordinal="0" memberName="redo03a.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>         <member ordinal="1" memberName="redo03b.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>      </RedoLogGroupAttributes>   </StorageAttributes></DatabaseTemplate>
16.安全配置

解除密码180天有效期限制,这个一步非常重要

alter profile default limit password_life_time unlimited;  

标签: #centos安装保存了数据库文件在哪里