操作系统:RHEL4U8 x86_64 DB版本:Oracle 10gR2 一、准备工作 1、创建用户和组: # groupadd oinstall # groupadd dba # id oracle # useradd -g oinstall -G dba oracle 2、创建目录并修改权限: # mkdir -p /opt/U01 # cd /opt/U01 # ln -s /opt/U01 /U01 # mkdir -p /U01/app/oracle/oraInventory # mkdir -p /U01/app/oracle/oradata # mkdir -p /U01/app/oracle/flash_recovery_area # mkdir -p /U01/app/oracle/admin # mkdir -p /U01/app/oracle/product/10.2.0 # chown -R oracle:oinstall /U01/app/oracle # chmod -R 775 /U01/app/oracle 3、检查hosts文件设置: # cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 4、检查软件包:rpm -q --qf '%{NAME}-%{VERSION}(%{ARCH})\n' libaio rpm -qa|egrep 'binutils|compat-db|control-center|gcc|gcc-c++|glibc|glibc-common|gnome-libs|libstdc++|libstdc++-devel|make|pdksh|sysstat|xscreensaver'|sort > /tmp/rpm.txt 5、设置内核参数 vi /etc/sysctl.conf kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 262144 net.core.rmem_max = 262144 net.core.wmem_default = 262144 net.core.wmem_max = 262144 sysctl -p 6、设置环境变量: $ cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export ORACLE_BASE=/U01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/10.2.0 export ORACLE_SID=dbatest export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$LD_LIBRARY_PATH PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export PATH 二、安装Oracle软件 1、解压软件: # gunzip 10201_database_linux_x86_64.cpio.gz # cpio -idmv < 10201_database_linux_x86_64.cpio 2、设置oraInst.loc文件: # vi /etc/oraInst.loc inventory_loc=/U01/app/oracle/oraInventory inst_group=oinstall 3、准备response文件 FROM_LOCATION 确认设置路径正确 n_configurationOption = 1 1 - Create a Database 2 - Configure an ASM instance 3 - Install Software Only ORACLE_HOME=/U01/app/oracle/product/10.2.0 ORACLE_HOME_NAME="OraDbHome1" 4、安装Oracle软件 # su - oracle $ ./runInstaller -ignoreSysPrereqs -force -silent -responseFile /opt/database/response/enterprise.rsp 5、执行脚本: # sh /U01/app/oracle/oraInventory/orainstRoot.sh # sh /U01/app/oracle/product/10.2.0/root.sh 三、创建数据库(oracle用户下执行) $ dbca -silent -createDatabase -templateName /U01/app/oracle/product/10.2.0/assistants/dbca/templates/General_Purpose.dbc -sid dbatest -gdbName dbatest -characterSet ZHS16GBK Copying database files 1% complete ... 100% complete Look at the log file "/U01/app/oracle/product/10.2.0/cfgtoollogs/dbca/dbatest/dbatest.log" for further details. #检查安装 $ cat /U01/app/oracle/product/10.2.0/cfgtoollogs/dbca/dbatest/dbatest.log | less 四、配置监听程序和本地服务名 $ cd $ORACLE_HOME/network/admin $ vi sqlnet.ora # sqlnet.ora Network Configuration File: /U01/app/oracle/product/10.2.0/network/admin/sqlnet.ora # Generated by Oracle configuration tools. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) # 设置本地服务名 $ cat tnsnames.ora # tnsnames.ora Network Configuration File: /U01/app/oracle/product/10.2.0/network/admin/tnsnames.ora # Generated by Oracle configuration tools. EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) ) test = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = zw_75_57)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = dbatest)(server=dedicated) ) ) orcl = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = zw_75_57)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = dbatest)(server=dedicated) ) ) # 设置监听程序 $ vi listener.ora # listener.ora Network Configuration File: /U01/app/oracle/product/10.2.0/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /U01/app/oracle/product/10.2.0) (PROGRAM = extproc) ) (SID_DESC = (SID_NAME = dbatest) (ORACLE_HOME = /U01/app/oracle/product/10.2.0) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) (ADDRESS = (PROTOCOL = TCP)(HOST = zw_75_57)(PORT = 1521)) ) ) #启动监听: $ lsnrctl start #测试连通性: $ tnsping test 五、设置自动重启 #设置/etc/oratab文件: $ vi /etc/oratab dbatest:/U01/app/oracle/product/10.2.0:Y #修改DB启动脚本 $ vi $ORACLE_HOME/bin/dbstart ORACLE_HOME_LISTNER=$1 修改为:ORACLE_HOME_LISTNER=$ORACLE_HOME #修改DB关闭脚本 $ vi $ORACLE_HOME/bin/dbshut ORACLE_HOME_LISTNER=$1 修改为:ORACLE_HOME_LISTNER=$ORACLE_HOME #修改/etc/rc.d/rc.local # cat /etc/rc.d/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local . /etc/rc.d/rc.tune su - oracle "-c dbstart" 六、Oracle卸载 停止监听 关闭数据库 # /U01/app/oracle/bin/localconfig delete # rm -rf /U01/app/oracle/* # rm -f /etc/oraInst.loc /etc/oratab # rm -rf /etc/oracle # rm -f /etc/inittab.cssd # rm -f /usr/local/bin/coraenv /usr/local/bin/dbhome /usr/local/bin/oraenv
【二】Oracle clone方式安装
|
Linux下Oracle安装(非界面)
最新推荐文章于 2024-05-10 12:22:13 发布
【一】Oracle静默安装