Centos静默安装oracle 11g( 二 )


./runInstaller -silent -responseFile /data/database/response/db_install.rsp -ignorePrereq 

Centos静默安装oracle 11g

文章插图
 
安装成功后,切换root用户执行
#sh /data/oracle/inventory/orainstRoot.sh#sh /data/oracle/product/11.2.0/root.sh13. 以静默方式配置监听
su - oracle
export DISPLAY=ip:0.0 //根据输入实际IP
/data/oracle/product/11.2.0.4.0/bin.NETca -silent -responseFile /data/database/response/netca.rsp运行成功后会生成配置文件
Centos静默安装oracle 11g

文章插图
 
[oracle@oracle admin]$ cat listener.ora # listener.ora Network Configuration File: /data/oracle/product/11.2.0.4.0/network/admin/listener.ora# Generated by Oracle configuration tools.LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))(ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))))SID_LIST_LISTENER =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = orcl)(SID_NAME = orcl)))ADR_BASE_LISTENER = /data/oracle使用命令查看服务状态
lsnrctl statusnetstat -natp
Centos静默安装oracle 11g

文章插图
 

Centos静默安装oracle 11g

文章插图
 
14. 以静默方式建立新库,同时也建立一个对应的实例 。
[oracle@oracle admin]$ grep -v '^#' /data/database/response/dbca.rsp | more[GENERAL]RESPONSEFILE_VERSION = "11.2.0"OPERATION_TYPE = "createDatabase"[CREATEDATABASE]GDBNAME = "orcl"SID = "orcl"TEMPLATENAME = "General_Purpose.dbc"SYSPASSWORD = "chenzm123"SYSTEMPASSWORD = "chenzm123"SYSMANPASSWORD = "chenzm123"DBSNMPPASSWORD = "chenzm123"DATAFILEDESTINATION =/oradataRECOVERYAREADESTINATION=/data/oracle/fast_recovery_areaCHARACTERSET = "ZHS16GBK"NATIONALCHARACTERSET= "UTF8"[createTemplateFromDB]SOURCEDB = "oracle: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 /data/database/response/dbca.rsp
Centos静默安装oracle 11g

文章插图
 
15 . 设置oracle 开机启动
编辑配置文件/data/oracle/product/11.2.0/bin/dbshut
将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME
修改/data/oracle/product/11.2.0/bin/dbstart
将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@oracle dbca]$ cat /data/oracle/product/11.2.0.4.0/bin/dbshut | grep 'ORACLE_HOME_LISTNER='ORACLE_HOME_LISTNER=$ORACLE_HOME[oracle@oracle dbca]$ cat /data/oracle/product/11.2.0.4.0/bin/dbstart | grep 'ORACLE_HOME_LISTNER='ORACLE_HOME_LISTNER=$ORACLE_HOME修改/etc/oratab文件

orcl:/data/oracle/product/11.2.0.4.0:N中最后的N改为Y,成为orcl:/data/oracle/product/11.2.04.0:Y
Centos静默安装oracle 11g

文章插图
 
dbshut //测试数据库关闭dbstart // 测试数据库启动16、设置启动脚本
cat /etc/init.d/oracle #!/bin/bash#oracle: Start/Stop Oracle Database 11g R2#chkconfig: 345 90 10#description: The Oracle Database is an Object-Relational Database ManagementSystem.#. /etc/rc.d/init.d/functionsLOCKFILE=/var/lock/subsys/oracleORACLE_HOME=/data/oracle/product/11.2.0.4.0ORACLE_USER=oraclecase "$1" in'start')if [ -f $LOCKFILE ]; thenecho $0 already running.elseecho -n $"StartingOracle Database:"su - $ORACLE_USER -c"$ORACLE_HOME/bin/lsnrctl start"su - $ORACLE_USER -c"$ORACLE_HOME/bin/dbstart $ORACLE_HOME"su - $ORACLE_USER -c"$ORACLE_HOME/bin/emctl start dbconsole"touch $LOCKFILEfi;;'stop')if [ ! -f $LOCKFILE ]; thenecho $0 already stopping.elseecho -n $"StoppingOracle Database:"su - $ORACLE_USER -c"$ORACLE_HOME/bin/lsnrctl stop"su - $ORACLE_USER -c"$ORACLE_HOME/bin/dbshut"su - $ORACLE_USER -c"$ORACLE_HOME/bin/emctl stop dbconsole"rm -f $LOCKFILEfi;;'restart')$0 stopsleep 5$0 start;;'status')if [ -f $LOCKFILE ]; thenecho $0 started.elseecho $0 stopped.fi;;*)echo "Usage: $0[start|stop|status]"exit 1esacexit 0


推荐阅读