1_oracle_11gr2_install_on_centos_x86_64
来源:互联网 发布:php 表单 编辑:程序博客网 时间:2024/06/05 22:31
一、Oracle预安装环境准备
Created Saturday 13 August 2016
Doc Information:
http://docs.oracle.com
http://metalink.oracle.com
1.1、相关概念:
ASM:Automatic Storage Management
1.2、硬件需求:
1.4G以下的物理内存直接给物理内存的2倍
2.学习环境中,没有必要单独分一个/tmp分区出来
3.根分区一般给25-30G左右即可
1.3、安装准备:
1.ip addr2.hostname3./etc/hosts#hostname oracle_svr#cat /etc/hosts127.0.0.1 oracle_svr localhost localhost.localdomain localhost4 localhost4.localdomain4::1 oracle_svr localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.3.88 oracle_svr
1.4、创建用户和组
groupadd oinstallgropuadd dbauseradd -g oinstall -G dba oracle
1.5、修改内核参数
编辑以下配置文件
1. /etc/sysctl.conf
kernel.shmmax = 2147483648 //这个参数表示虚拟内存为2G,oracle官方要求虚拟内存至少要有物理内存的一半,实际我们可以给到和物理内存一样大
kernel.core_uses_pid = 1kernel.shmall = 2097152kernel.shmmax = 2147483648kernel.shmmni = 4096kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000net.core.rmem_default = 262144net.core.rmem_max = 262144
2. /etc/security/limits.conf
oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536
3. /etc/pam.d/login
session required pam_limits.so
1.6、oracle安装的标准目录
mkdir /u01/app/oracle -pchown -R oracle:oinstall /u01chmod -R 755 /u01
1.7、oracle环境变量
编辑oracle用户的环境变量配置 ~oracle/.bash_profile
export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=/u01/app/oracle/product/11.2/db_1export ORACLE_SID=orclexport NSL_LANG=american_america.zhs16gbkexport PATH=$ORACLE_HOME/bin:$PATH
如果要使用vnc之类的工具来安装oracle,那么则要执行下面的命令
xhost +export DISPLAY=192.168.3.88:0.0
二、安装oracle
2.1、切换用户
su - oracle
cd oracle_install_path; ./runInstaller
2.2、进入到图形安装界面
2.2.1、选择“高级安装”
2.2.2、安装目录
下面就不附加图片了,只提供文字说明,有时间会做补充的
如果之前已经设置好了环境变量,那么就安装软件会自动读取到安装目录的
2.2.3、选择安装类型
一般情况下是选择企业版的,也可以选择定制
2.2.4、选择安装的组件
2.2.5、产品特定的先决条件检查
2.3、数据库创建
相关的变量
2.3.1 用oracle用户执行dbca命令
来进入创建数据库向导
2.3.2 创建一个数据库
查看相应的端口,可以在$ORACLE_HOME/install/portlist.ini这个文件中来查看。
2.3.3 选择数据库类型
这里选一般类型或者是数据仓库
2.3.4 数据库标识(Database Identification)
2.3.5 管理选项
这里可以选择是否使用em(Enterprise Manager),这里推荐使用em,可以使用浏览器来管理你自己的数据库
2.3.6 创建账号密码
这里都设置一样的,这里就设置简单一点,都为oracle
2.3.7 选择存储机制
这里就选择文件系统,先暂时不牵扯asm
2.3.8 选择oracle数据存放地址
这里选择所有的数据都存放在公共的位置
$ORACLE_BASE/oradata其实就是/u01/app/oracle/oradata,如echo $ORACLE_BASE/u01/app/oracle
2.3.9 是否打开闪回区和归档日志
这里归档日志就暂时不打开了,以后也可以使用其它的方式来打开。
2.3.10 是否要使用一些参考方案
这里为了学习,所以就勾选了“sample schemas”,当然在实际生产环境中,是不会勾选这个的
2.3.11 初始化参数设置
内存使用大小,这个可以根据自己内存的实际大小来设置
这个选项可以暂时不考虑,以后也可以通过其它的方式来更改
字符集设置,这部分非常的关键,因为一旦设置后就不可更改。
- 字符集设置,在实际生产中只会有两种选择,要么第二种,要么第三种,那么什么时候使用第二种,什么时候选择第3种呢。
如果一个项目中只在国内使用,不会涉及到其它的字符集,那么选择第三种是最合适的,”ZHS16GBK - GBK-16-bit Simpled
Chinese“ 那么剩下的就只能选择第二种了,比如中外合适企业或者是给国外客户做的项目,当然下面的国家字符集也是需要修改的 - National Character Set:就选中国如下图所示,AL16UTF16-Unicode UTF-16 Universal character set
Default Language:看具体情况,这里也选择中文
Default Territory:默认的日期格式,这里也要选择中文
2.3.12 控制文件的存放地址
2.3.13 数据文件存放地址
2.3.14 重做日志存放路径
这里有3个重做日志,存放的位置都是一样的
2.3.12 开始创建数据库
这里有个警告
大概是说主机名不能有下划线,可以尝试之后再运行下面提示的命令emca来重新配置em
修改主机名后,再重新运行dbca,选择修改数据库,这个时候就没有问题了
至此,数据库就创建完成了,关闭这个窗口即可
三、EM管理架构
em一旦建立之后就不要再修改主机名了
3.1数据库、监听、EM之间的关系
Database <- Listener <- EM <- Client
整个流程是client通过EM来访问数据库,EM需要使用监听,然后通过监听来连接数据库
3.2如何创建监听和服务名
我们的步骤是先安装数据库软件,然后是创建数据库,再然后是创建监听,监听文件位置是在$ORACLE_HOME/network/admin/listener.ora,再创建一个服务名,监听和服务名分别使用netca命令,该命令需要在xwindow下来运行,服务名配置文件和监听文件是在一个位置,$ORACLE_HOME/network/admin/tnsnames.ora
3.3如果先启动数据库实例后,再创建的监听和服务名,但是监听没有识别到oracle实例应如何处理
sqlplus / as sysdbaalter system register;exitlsnrctl status
3.4启动EM
使用oracle用户执行emctl start dbconsole
3.5访问em
https://host_name:1158/em
3.6查看EM受支持的时区
cat $ORACLE_HOME/sysman/admin/supportedtzs.lst | grep -i shanghai
3.7修改EM默认时区
cat >> $ORACLE_HOME/sysman/config/emd.properties << EOFagentTZRegion=Asia/ShanghaiEOF
四、oracle数据库及相关软件的启动和关闭
4.1关闭顺序:
1.isqlplus、EM,
emctl stop dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://HIENHA:1158/em/console/aboutApplicationStopping Oracle Enterprise Manager 11g Database Control ... ... Stopped.
2.监听,
$ lsnrctl stopLSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-AUG-2016 10:57:30Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=10)))The command completed successfully
3.oracle实例(shutdown immediate,这种关闭方式是安全的)
$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Sun Aug 21 10:57:57 2016Copyright (c) 1982, 2009, Oracle. All rights reserved.???: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> shutdown immediate????????????????ORACLE ???????
4.2启动顺序
4.2.1.监听
$ lsnrctl startLSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-AUG-2016 10:59:16Copyright (c) 1991, 2009, Oracle. All rights reserved.Starting /u01/app/oracle/product/11.2/db_1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionSystem parameter file is /u01/app/oracle/product/11.2/db_1/network/admin/listener.oraLog messages written to /u01/app/oracle/diag/tnslsnr/HIENHA/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=10)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HIENHA)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=10)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionStart Date 21-AUG-2016 10:59:16Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2/db_1/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/HIENHA/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=10))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HIENHA)(PORT=1521)))The listener supports no servicesThe command completed successfully[oracle@HIENHA admin]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-AUG-2016 10:59:20Copyright (c) 1991, 2009, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=10)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionStart Date 21-AUG-2016 10:59:16Uptime 0 days 0 hr. 0 min. 4 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2/db_1/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/HIENHA/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=10))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HIENHA)(PORT=1521)))The listener supports no servicesThe command completed successfully
4.2.2oracle
$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Sun Aug 21 11:01:40 2016Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to an idle instance.SQL> startupORACLE instance started.Total System Global Area 1987563520 bytesFixed Size 2214696 bytesVariable Size 1191183576 bytesDatabase Buffers 788529152 bytesRedo Buffers 5636096 bytes????????????????SQL>
4.2.3EM、isqlplus
最后总结一下其实就是;
数据库、监听、EM、isqlplus
- 1_oracle_11gr2_install_on_centos_x86_64
- 1
- 1
- 1
- 1
- 1
- 1
- 1》
- 1
- 1
- 1
- 1
- (1)
- 1
- 1
- 1
- 1
- 1
- linux firefox能正常那个上网,但是在软件中心却不能下载软件
- JavaScript与Objective-C之间的通信
- 服务器端编程的10大性能问题
- POJ 1410 线段相交模版
- sprintf函数的用法
- 1_oracle_11gr2_install_on_centos_x86_64
- js select option对象小结
- MYSQL添加新用户并指定数据库
- java中 HashMap和Hashtable,list、set和map 的区别
- JAVA面试宝典8
- 优化
- hdu5475 An easy problem(线段树+单点更新+区间求积)
- 决策树-模型与学习
- Min Stack