linux部署oracle11g
作者:互联网
部署环境:centos7.8
准备oracle安装包:Oracle Database 11.2.0.1.0 for Linux x86-64 (V17530-01_1of2.zip V17530-01_2of2.zip)
安装包解压到/data/database 目标安装到/opt/oracle
一、安装依赖
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
检测依赖包安装情况
rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
#二、准备swap分区
如何开启交换区呢,运行下列命令:
cd /usr/
mkdir swap
cd swap
dd if=/dev/zero of=swapfile bs=1G count=8 //将zero设备作为输出,写入swap,count写入多少次,这里一共写入4G,如果没有swap会自动创建
挂在swapfile上。
mkswap swapfile
swapon swapfile
激活swapfile ,加入到swap分区中
echo "/usr/swap/swapfile swap swap defaults 0 0 " >> /etc/fstab //开机引导时会自动启动
查看是否生效:
free -m //可以看到swap分区
三、准备用户和用户组
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle -d /home/oracle
passwd oracle
#(输入密码123456)
四、准备oracle的环境变量
/etc/profile
export PATH
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
source /etc/profile
五、创建安装目录并授权
mkdir -p /opt/oracle && chown -R oracle:oinstall /opt/oracle
安装文件也需要给oracle授权
chown -R oracle /data/database/
mkdir /opt/oraInventory && chown -R oracle:oinstall /opt/oraInventory
六、安装
su oracle
备份安装的文件
cd /data/database/
cp -a response responsebak
1.需要修改的文件
注意:可能是bug,INVENTORY_LOCATION的路径不能在ORACLE_BASE,也就是/opt/oracle下。于是在/opt/oraInventory直接建文件夹并授权
#去掉注释和空行
sed -i 's/^#.*$//g' response/db_install.rsp
sed -i '/^$/d' response/db_install.rsp
所有配置如下:
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=orcl
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/opt/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/opt/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.customComponents=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.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
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.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
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=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
静默安装
./runInstaller -silent -ignorePrereq -force -noconfig -responseFile /data/oracle/database/response/dbinstall.rsp
2.新开窗口,使用root账户运行以下脚本
sh /opt/oracle/oraInventory/orainstRoot.sh
sh /opt/oracle/product/11.2.0/dbhome_1/root.sh
之后已经可以使用sqlplus进行测试
3.安装数据库
#去掉注释和空行
sed -i 's/^#.*$//g' response/dbca.rsp
sed -i '/^$/d' response/dbca.rsp
所有配置如下:
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "123456"
SYSTEMPASSWORD = "123456"
DATAFILEDESTINATION = "/opt/oracle/oradata"
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl11.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
NODELIST=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
INSTANCENAME = "orcl11g"
SYSDBAUSERNAME = "sys"
静默安装
dbca -silent -responseFile response/dbca.rsp
4.配置监听
修改netca.rsp文件,这里没有特殊需求,使用默认的
#执行前先执行这一个:export DISPLAY=10.0.0.101:0.0 IP是本机IP; #执行监听安装 netca -silent -responseFile /data/database/response/netca.rsp
lsnrctl start lsnrctl status #4.配置tnsname 进入/data/oracle/product/11.2.0/dbhome_1/network/admin目录执行: cp samples/tnsnames.ora ./ 编辑文件 vim tnsnames.ora 把原有的删除即可,添加如下内容, db120 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 120.78.69.86)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) ) db114 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 114.215.40.56)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) ) 至此可以正常登录数据库了!!
标签:starterdb,部署,db,devel,install,linux,oracle,config,oracle11g 来源: https://www.cnblogs.com/pkszzcq/p/15062225.html