时间:2021-07-01 10:21:17 帮助过:16人阅读
4、在/etc/hosts文件中添加主机名
[root@CentOS tmp]# reboot [root@CentOS tmp]# service iptables stop [root@CentOS ~]# systemctl stop firewalld [root@CentOS ~]# systemctl disable firewalld 6、安装Oracle 11g依赖包 [root@CentOS tmp]# yum install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel 7、添加安装用户和用户组 [root@CentOS tmp]# groupadd oinstall [root@CentOS tmp]# groupadd dba [root@CentOS tmp]# useradd -g oinstall -G dba oracle [root@CentOS tmp]# passwd oracle [root@CentOS tmp]# id oracle uid=1001(oracle) gid=1001(oinstall) 组=1001(oinstall),1002(dba) 8、修改内核参数配置文件 [root@CentOS ~]# vim /etc/sysctl.conf 添加以下内容 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 [root@CentOS ~]# /sbin/sysctl –p 其中kernel.shmmax = 2147483648 为本机物理内存(4G)的一半,单位为byte。 9、修改用户的限制文件 [root@CentOS ~]# vim /etc/security/limits.conf 添加以下内容 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 修改/etc/pam.d/login文件: [root@CentOS ~]# vim /etc/pam.d/login 添加以下内容: session required /lib64/security/pam_limits.so session required pam_limits.so 修改/etc/profile文件: [root@CentOS ~]# vim /etc/profile 添加以下内容: if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi [root@CentOS ~]# source /etc/profile 10、创建安装目录和设置文件权限 [root@CentOS ~]# mkdir -p /u01/app/oracle/product/11.2.0 [root@CentOS ~]# mkdir /u01/app/oracle/oradata [root@CentOS ~]# mkdir /u01/app/oracle/inventory [root@CentOS ~]# mkdir /u01/app/oracle/fast_recovery_area [root@CentOS ~]# chown -R oracle:oinstall /u01/app/oracle [root@CentOS ~]# chmod -R 775 /u01/app/oracle 11、设置oracle用户环境变量 [root@CentOS ~]# su - oracle [oracle@CentOS ~]$ vim .bash_profile 添加如下内容: export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0 export ORACLE_SID=orcl export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_UNQNAME=$ORACLE_SID export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH [oracle@CentOS ~]$ source .bash_profile 12、编辑静默安装响应文件 oracle@CentOS ~]$ cp -R /tmp/database/response/ . [oracle@CentOS ~]$ cd response/ [oracle@CentOS response]$ vim db_install.rsp 需要设置的选项如下: oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=CentOS UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oracle/inventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/u01/app/oracle/product/11.2.0 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba DECLINE_SECURITY_UPDATES=true 13、根据响应文件静默安装Oracle 11g [oracle@CentOS response]$ cd /tmp/database/ [oracle@CentOS database]$ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq 开始Oracle在后台静默安装。安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在后台进行,如果出现[FATAL],则安装程序已经停止了。 可以在以下位置找到本次安装会话的日志: /u01/app/oracle/inventory/logs/installActions2015-06-08_04-00-25PM.log 可以切换终端执行top命令查看后台进程一直是在安装的,/data目录也在不断增大, 当出现以下提示时,代表安装成功: 按照要求执行脚本。 打开终端,以root身份登录,执行脚本: [root@CentOS ~]# sh /u01/app/oracle/inventory/orainstRoot.sh [root@CentOS ~]# sh /u01/app/oracle/product/11.2.0/root.sh
14、以静默方式配置监听
重新使用oracle用户登录
[oracle@CentOS ~]$ netca /silent /responsefile /home/oracle/response/netca.rsp 成功运行后,在/u01/app/oracle/product/11.2.0/network/admin/中生成listener.ora和sqlnet.ora 通过netstat命令可以查看1521端口正在监听。 Yum安装netstat软件,软件包是在net-tools中。 [root@CentOS ~]# yum install net-tools [root@CentOS ~]# netstat -tnulp | grep 152115、以静默方式建立新库,同时也建立一个对应的实例。
[oracle@CentOS ~]$ vim /home/oracle/response/dbca.rsp
设置以下参数:GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "3277"
其中TOTALMEMORY = "3277"为3277 MB,物理内存4G*80%。
进行静默配置: [oracle@CentOS ~]$ dbca -silent -responseFile /home/oracle/response/dbca.rsp 建库后进行实例进程检查: [oracle@CentOS ~]$ ps -ef | grep ora_ | grep -v grep 查看监听状态: [oracle@CentOS ~]$ lsnrctl status 登录查看实例状态: [oracle@CentOS ~]$ sqlplus / as sysdba SQL> select status from v$instance;16、Oracle开机自启动设置
1、修改/u01/app/oracle/product/11.2.0/bin/dbstart
[oracle@CentOS ~]$ vim /u01/app/oracle/product/11.2.0/bin/dbstart
将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME
2、修改/u01/app/oracle/product/11.2.0/bin/dbshut
[oracle@CentOS ~]$ vim /u01/app/oracle/product/11.2.0/bin/dbshut
将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME
3、修改/etc/oratab文件
[oracle@CentOS ~]$ vim /etc/oratab
将orcl:/u01/app/oracle/product/11.2.0:N中最后的N改为Y,成为orcl:/u01/app/oracle/product/11.2.0:Y
4、输入命令dbshut和dbstart测试
[oracle@CentOS ~]$ dbshut
Oracle监听停止,进程消失。 [oracle@CentOS ~]$ dbstart Oracle监听启动,进程启动。
8、进行service oracle start/stop/restart测试
9、Reboot重启查看Oracle监听和实例进程均能自动启动。
17、启动em
1、删除早期DBCONSOLE创建的用户:
2、删除早期DBCONSOLE创建的对象:
3、重新创建DBCONSOLE:
$emca -config dbcontrol db -repos create
4、如果提示创建失败,输出类似 “Could not complete the configuration. Refer to the log file at /opt/oracle/cfgtoollogs/emca/orcl/emca_*.log for more details.” 的错误信息,请查看对应的日志文件, 日志文件的最后一行内容如果是 “ORA-00955: name is already used by an existing object”,则需要执行一次重建的命令:
$emca -config dbcontrol db -repos recreate
在执行上面命令的过程中需要根据提示输入对应的数据库信息及 SYS、DBSNMP 和 SYSMAN 的登录密码,最后输入 Y 进行确认,如:
STARTED EMCA at Mar 10, 2015 10:03:17 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl
Listener port number: 1521
Listener ORACLE_HOME [ /opt/oracle/11g ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
5、检查 em 的状态
$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://hemw-pc:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /opt/oracle/11g/hemw-pc_orcl/sysman/log
Oracle 11g 基于CentOS7安装并启动em
标签:opp too useradd ulimit recovery http tools png sysctl