第2章 Oracle 11g体系结构

合集下载

oracle 11gr2图文安装rac版

oracle 11gr2图文安装rac版

Oracle 11G R2 RAC实施过程图文版(本文仅限于11G R2 on redhatlinux 6.x系列)内容目录1 实施准备 (2)1.1 调研与方案制定 (2)1.2 存储划分方案(参考) (3)1.3 介质 (4)2 设置系统 (4)2.1 系统检查 (4)2.1.1 cpu信息 (4)2.1.1 确认内存大小 (5)2.1.2 检查文件系统 (5)2.1.3 检查网络设置 (6)2.2 设置操作系统 (7)2.2.1 主机正名 (7)2.2.2 配置本地主机名解析hosts文件 (7)2.2.3 修改内核参数 (7)2.2.4 关闭防火墙服务 (8)2.2.5 关闭selinux (8)2.2.6 配置时钟同步 (9)2.3 设置软件安装/运行用户 (9)2.3.1 创建用户 (9)2.3.2 设置初始密码 (10)2.3.3 设置用户进程资源配额 (10)2.4 设置存储 (10)2.4.1 多路径软件配置 (10)2.4.2 udev绑定参考 (11)3 安装软件 (12)3.1 准备安装介质 (12)3.1.1 准备目录和权限(所有节点) (12)3.1.2 上传zip包(推荐ftp方式) (12)3.1.3 使用grid用户解包 (13)3.2 安装集群软件 (13)3.2.1 运行安装程序runInstaller (13)3.2.2 设置grid用户环境变量 (37)3.2.3 验证资源和服务状态,确定成功安装 (37)3.2.4 验证缺省监听 (38)3.2.5 查看scan_listener (39)3.3 安装数据库软件 (39)3.3.1 运行交互式安装程序runInstaller (39)3.3.2 为oracle用户的添加软件环境变量 (47)4 创建数据库 (47)4.1 创建asm diskgroup (47)4.1.1 以grid用户运行asmca工具 (47)4.2 创建数据库zbwshx(在1节点操作) (49)5 应用累计补丁更新PSU (69)5.1 升级补丁工具opatch (69)5.2 补丁1节点软件 (69)5.3 补丁2节点软件 (71)5.4 升级数据库(1节点操作) (71)6 附加脚本(可选) (72)6.1 调整数据库一些缺省设置 (72)6.2 管理集群服务 (73)7 初始化业务环境(举例) (73)1 实施准备1.1 调研与方案制定1.2 存储划分方案(参考)存储要1T1T分配,超过2T会有问题1.3 介质2 设置系统2.1 系统检查2.1.1 cpu信息1 查看物理cpu数shell(root)>cat /proc/cpuinfo |grep physical\ id|sort|uniq2 查看单个cpu coresshell(root)>cat /proc/cpuinfo |grepcpu\ cores|uniq3 查看单个是否超线程shell(root)>cat /proc/cpuinfo |grepcpu\ cores|uniq4 合计cpu coresshell(root)>cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c shell(root)>mpstat 12.1.1 确认内存大小物理内存是256Gswap取值算法为物理内存的一倍,当物理内存超过64G,建议>=物理内存,这里32G符合最小2.1.2 检查文件系统/var和/tmp空间至少2G,建议10G/dev/shm共享空间设为物理内存/2 2.1.3 检查网络设置检查1节点public网卡设置检查2节点public网卡设置检查1节点private网卡地址(第一组)检查2节点private网卡设置(第一组)检查1节点 private网卡(第二组)检查2节点private网卡(第二组)2.2 设置操作系统2.1.1 主机正名1节点(全部小写最好了)2节点注意:重新登陆确认改变生效2.1.2 配置本地主机名解析hosts文件shell(root)>vi /etc/hosts#public address192.168.9.101 zbwshx01192.168.9.102 zbwshx02#public vip address192.168.9.103 zbwshx01-vip192.168.9.104 zbwshx02-vip192.168.9.105 zbwshx-cluster-scan(建议3个,用DNS解析)#private group #110.10.11.11 zbwshx01-priv110.10.11.12 zbwshx02-priv1#private group #210.10.12.11 zbwshx01-priv210.10.12.12 zbwshx02-priv2#NTP服务器192.168.5.11 ntpserver2.1.3 修改内核参数1.编辑sysctl.confshell(root)>vi /etc/sysctl.conf#ORACLE SETTINGfs.aio-max-nr = 1048576fs.file-max = 6815744#{shmall}单位pages,命令"echo $((物理内存/$(getconf PAGESIZE)))"(计算:物理内存/4096)kernel.shmall = 67108864#{shmmax},单位bytes,为物理内存一半,echo $((256*1024*1024*1024/2))kernel.shmmax = 137438953472(物理内存/2)kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586net.ipv4.ipfrag_high_thresh=524288net.ipv4.ipfrag_low_thresh=393216net.ipv4.tcp_rmem=4096 524288 16777216net.ipv4.tcp_wmem=4096 524288 16777216net.ipv4.tcp_timestamps=0net.ipv4.tcp_sack=0net.ipv4.tcp_window_scaling=1net.core.optmem_max=524287dev_max_backlog=2500sunrpc.tcp_slot_table_entries=128sunrpc.udp_slot_table_entries=128net.ipv4.tcp_mem=16384 16384 16384#多心跳网卡时需要多播技术net.ipv4.conf.default.rp_filter = 0#多播设备eth2,eth4net.ipv4.conf.eth2.rp_filter = 0net.ipv4.conf.eth4.rp_filter = 02.生效shell(root)>modprobesunrpcshell(root)>sysctl -p2.1.4 关闭防火墙服务shell(root)>chkconfig --level 2345 iptables offshell(root)>chkconfig --level 2345 ip6tables offshell(root)>service iptables stopshell(root)>service ip6tables stop2.1.5 关闭selinuxshell(root)>setenforce 0shell(root)>vi /etc/selinux/configSELINUX=disabled2.1.6 配置时钟同步∙配置NTP服务器<非数据库内容,略>∙配置ntp客户端shell(root)>vi /etc/ntp.conf注释掉其他restrict和server条目,增加如下serverntpserverrestrictntpserver mask 255.255.255.255nomodifynotrapnoquery ∙修改ntpd配置文件shell(root)>vi /etc/sysconfig/ntpdSYNC_HWCLOCK=yesOPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"∙重启ntpd进程shell(root)>chkconfig --level 2345 ntpd onshell(root)>service ntpd start∙确认握手成功shell(root)>ntpq -p(初次同步需要一定时间)∙检查状态shell(root)>ntpstat2.2 设置软件安装/运行用户2.2.1 创建用户shell(root)>groupadd -g 10501 oinstallshell(root)>groupadd -g 10502 asmadminshell(root)>groupadd -g 10503 asmdbashell(root)>groupadd -g 10504 asmopershell(root)>groupadd -g 10505 dbashell(root)>groupadd -g 10506 opershell(root)>useradd -m -u 10501 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" gridshell(root)>useradd -m -u 10502 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle2.2.2 设置初始密码shell(root)>password gridshell(root)>password oracle2.2.3 设置用户进程资源配额shell(root)>vi /etc/security/limits.conf#ORACLE SETTINGroot soft nproc 2047root hard nproc 16384root soft nofile 1024root hard nofile 65536root soft stack 10240root hard stack 32768grid soft nproc 2047grid hard nproc 16384grid soft nofile 1024grid hard nofile 65536grid soft stack 10240grid hard stack 32768oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240oracle hard stack 327682.3 设置存储要求:✓同一个lun/vdisk在每个节点上设备名一致✓根据方案,通过scsi_id确认每一个lun/vdisk从存储上划分正确的✓共享模式要求在lun/vdisk在每个节点能同时读写✓RAC安装,lun/vdisk在操作系统上的设备名的属主是grid,组主是asmadmin,权限6602.3.1 多路径软件配置<非数据库内容,略>redhatlinux自带多路径软件multipath的参考文档官方文档:https:///documentation/zh-CN/Red_Hat_Enterprise_Linux/6/html/DM_Multipath/index.html百度搜索文档:/i6241962348353946114/绑定用户组案例:/2014/01/multipath实现设备用户组设置.html2.3.2 udev绑定参考注意:∙如果多路径软件已经实现了设备名绑定、属(组)主设置、权限设置,则不需要再配置udev∙udev不具有多路径failover能力∙本例为scsi磁盘∙∙1.shell(root)>fdisk -l|grep Disk\ /dev/sd根据系统人员告知,设备sda是本地操作系统宿主硬盘,不能使用,剩下的是共享磁盘2.查看scsi_idshell(root)>scsi_id -gvu /dev/sdN3.新建或编辑udev的rule文件shell(root)>vi /etc/udev/rules.d/99-oracle.rules(必须是99)KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk",ENV{ID_SERIAL}=="36006016010402600126dd2e653ebe511", NAME+="crs_01", OWNER="grid", GROUP="asmadmin", MODE="0660"KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk",ENV{ID_SERIAL}=="360060160104026004eb5b3db53ebe511", NAME+="crs_02", OWNER="grid", GROUP="asmadmin", MODE="0660"KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk",ENV{ID_SERIAL}=="360060160104026006edcb7d153ebe511", NAME+="crs_03", OWNER="grid", GROUP="asmadmin", MODE="0660"KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk",ENV{ID_SERIAL}=="36006016010402600f0b413ee53ebe511", NAME+="fra_data_01", OWNER="grid", GROUP="asmadmin", MODE="0660"KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk",ENV{ID_SERIAL}=="36006016010402600162f6d1254ebe511", NAME+="zbwshx_data_01", OWNER="grid", GROUP="asmadmin", MODE="0660"4.启动udevshell(root)>udevadm control reload-rulesshell(root)>start_udev3 安装软件3.1 准备安装介质(介质上传到/u01/media/oracle/linux_x64目录)3.1.1 准备目录和权限(所有节点)shell(root)>mkdir -p /u01/media/oracle/linux_x64shell(root)>chown -R grid:oinstall /u01shell(root)>chmod -R g+w /u013.1.2 上传zip包(推荐ftp方式)✓用grid用户上传✓上传grid安装包,database安装包,补丁包,补丁工具✓上传后介质属主grid,组主oinstall3.1.3 使用grid用户解包shell(grid)>cd /u01/media/oracle/linux_x64shell(grid)>unzip p1*******_112040_Linux-x86-64_1of7.zipshell(grid)>unzip p1*******_112040_Linux-x86-64_2of7.zipshell(grid)>unzip p1*******_112040_Linux-x86-64_3of7.zip3.2 安装集群软件3.2.1 运行安装程序runInstallershell(grid)>cd gridshell(grid)>./runInstaller提示:为了把x-windows程序的界面投射到windows终端上,需要执行2个步骤1.在windows上启动本地X11Forward程序,推荐x-manager中的xpassive(端口默认6000,注意firewall)2.在服务器上设定shell环境变量:export DISPLAY=YourIP:0.03.执行xclock测试在DHCP+DNS的环境,需要激活GNS,这里关闭本方案只有一个SCAN IP,使用/etc/hosts解析(也就是说需要将SCAN IP写入到/etc/hosts 下)建立主机之间ssh互信,这样可以免密码互相登陆,oracle安装过程中会把1节点的软件自动复制到2节点。

Oracle_11g 安装图解(详细版)

Oracle_11g 安装图解(详细版)

Oracle 11g安装图文攻略呵呵,花了一个多小时,左右把11g安装折腾好了。

其中折腾SQL Developer 花了好长时间,总算搞定了。

好了,先总结下安装步骤,希望给后面的童鞋提高安装效率。

呵呵。

一、Oracle 下载注意Oracle分成两个文件,下载完后,将两个文件解压到同一目录下即可。

路径名称中,最好不要出现中文,也不要出现空格等不规则字符。

官方下地址:/technetwork/database/enterprise-edition/downloads/ index.html以下两网址来源此官方下载页网。

win 32位操作系统下载地址:/otn/nt/oracle11g/112010/win32_11gR2_database_ 1of2.zip/otn/nt/oracle11g/112010/win32_11gR2_database_ 2of2.zipwin 64位操作系统下载地址:/otn/nt/oracle11g/112010/win64_11gR2_database_ 1of2.zip/otn/nt/oracle11g/112010/win64_11gR2_database_ 2of2.zip二、Oracle安装1. 解压缩文件,将两个压缩包一起选择,鼠标右击 -> 解压文件如图2.两者解压到相同的路径中,如图:3. 到相应的解压路径上面,找到可执行安装文件【 setup.exe 】双击安装。

如图:4. 安装第一步:配置安全更新,这步可将自己的电子邮件地址填写进去(也可以不填写,只是收到一些没什么用的邮件而已)。

取消下面的“我希望通过My Oracle Support接受安全更新(W)”。

如图:5. 安全选项,直接选择默认创建和配置一个数据库(安装完数据库管理软件后,系统会自动创建一个数据库实例)。

如图:6. 系统类,直接选择默认的桌面类就可以了。

(若安装到的电脑是,个人笔记本或个人使用的电脑使用此选项) 如图:7. 典型安装。

51CTO学院-51CTO-OCP线上远程培训班-报名【已结束】

51CTO学院-51CTO-OCP线上远程培训班-报名【已结束】

51cto学院-51CTO-OCP线上远程培训班-报名【已结束】适用人群学生、在职人员等想提高数据库技能的人群;有初级数据库工作经验的数据库管理人员。

课程简介OCP认证对您有何帮助?1.增加可信度2.提高收入3.解决复杂问题能力市场竞争激烈,务必抢占先机准备OCP认证考试会拓展您的知识基础;接触到广泛丰富的重要特性、功能和任务,未来可在工作中运用;超过90%的考生表示OCP认证使他们在找新工作时更具可信度。

培训对象:学生、在职人员等想提高数据库技能的人群;有初级数据库工作经验的数据库管理人员。

上课方式:国内独有交互式教学模式:视频+直播,如同面授效果的直播培训讲师+班主任全程跟踪教学让您真正放心、安心、舒心的专心学习课程第一章第1部分Oracle介绍20课时15小时3分钟1第1章Oracle11g 体系结构概述(0)[免费观看]13分钟2第1章Oracle11g 体系结构概述(1)54分钟Oracle体系结构单实例体系结构实例内存结构实例进程结构数据库存储结构3第1章Oracle11g 体系结构概述(2)38分钟4第2章安装和创建数据库(2)41分钟5第2章安装和创建数据库(1)42分钟在Linux下使用OUI安装Oracle软件使用DBCA创建数据库了解Oracle数据库常用管理具: OEM,Oracle SQL Developer,sqlplus6第2章安装和创建数据库(4)39分钟7第2章安装和创建数据库(3)55分钟8第3讲实例管理(1)51分钟数据库初始化参数:静态参数、动态参数、静态参数文件、动态参数文件描述启动和关闭数据库时的多个阶段使用警报日志和跟踪文件使用数据字典和动态性能视图9第3讲实例管理(2)53分钟10第4讲配置Oracle网络(1)25分钟了解什么是Oracle网络,使用netca和netmgr配置侦听器侦听器的静态注册和动态注册演示oracle客户端的使用使用Oracle共享服务器体系结构11第4讲配置Oracle网络(2)55分钟12第4讲配置Oracle网络(3)53分钟13第5讲Oracle存储结构(2)33分钟14第5讲Oracle存储结构(1)1小时25分钟了解oracle存储结构,解释什么是表空间、区使用sqlplus和OEM创建和管理表空间15第5讲Oracle存储结构(3)12分钟16第6讲Oracle安全管理(1)1小时6分钟创建和管理数据库用户账户权限管理:系统权限和对象权限,授予和撤销权限创建和管理角色创建和管理配置文件使用标准数据库审核:语句审计、权限审计、对象审计创建和管理数据库用户账户权限管理:系统权限和对象权限,授予和撤销权限创建和管理角色创建和管理配置文件使用标准数据库审核:语句审计、权限审计、对象审计17第6讲Oracle安全管理(2)39分钟18第6讲Oracle安全管理(3)28分钟19第6讲Oracle安全管理(4)35分钟20第6讲Oracle安全管理(5)1小时17分钟21第7讲DDL和模式对象(1)53分钟概念叙述:什么是object,schema 创建简单的表表的管理:重命名表、添加、删除、重命名列、更改列的属性表分区的管理:range分区、list分区创建和使用临时表数据类型:number,char,nchar,varchar2,nvarchar2 约束:唯一性约束、主键约束、外键约束、检查约束,约束的状态描述其他对象:索引、简单视图、复杂视图、同义词、序列22第8讲DML与并发性(1)1小时2分钟常见的DML语句演示:insert,update,delete,truncate,merge 了解什么是事务、事务的隔离性PL/SQL:if判断、case判断、while循环、loop循环存储过程、触发器监视和解决锁定冲突撤销概述、事务与撤销数据、管理撤销23第9讲使用select语句查询56分钟select语句的常用方法创建演示模式执行基本的SELECT语句限制查询检索的行排序查询检索的行&、&&符号替换24第10讲单行函数与转换函数(1)1小时4分钟描述和使用SQL中的字符、数字和日期函数描述SQL中可用的各种类型转换函数使用T O_CHAR,TO_NUMBER和TO_DATE转换函数使用select语句中应用条件表达式25第11讲分组函数21分钟分组函数使用group by子句分组数据使用having子句包含或者排除分组行26第7讲DDL和模式对象(2)1小时26分钟27第7讲DDL和模式对象(3)59分钟28第7讲DDL和模式对象(4)1小时4分钟29第7讲DDL和模式对象(5)28分钟30第12讲SQL连接48分钟使用同等连接和非同等连接编写select语句访问多个表的数据使用自连接将表联结到自身使用外连接查看不满足连接条件的数据生成两个或者更多个表的笛卡尔积31第8讲DML与并发性(2)1小时3分钟32第8讲DML与并发性(3)15分钟33第8讲DML与并发性(4)52分钟34第8讲DML与并发性(5)24分钟35第13讲子查询和集合运算符1小时4分钟定义子查询描述子查询能解决问题的类型列举子查询的类型写单行和多行子查询描述集合运算符使用集合运算符将多个查询合并为一个查询控制返回行的顺序36第10讲单行函数与转换函数(2)25分钟第三章第3部分高级数据库管理17课时10小时28分钟37第14讲数据库备份和恢复(1)1小时1分钟备份和恢复问题失败类型实例恢复为数据库的可恢复性作准备38第15讲用户管理的备份和恢复(1)1小时使用RMAN BACKUP命令创建备份配置RMAN默认值管理和监视RMAN备份39第16讲使用RMAN还备份数据(1) 50分钟40第14讲数据库备份和恢复(2)21分钟41第16讲使用RMAN还备份数据(2) 23分钟42第16讲使用RMAN还备份数据(3) 59分钟43第16讲使用RMAN还备份数据(4) 31分钟44第19讲自动存储管理ASM1小时7分钟45第20讲资源管理器、调度程序55分钟46第21讲移动和重组数据(1)33分钟47第22讲AWR与报警系统48分钟48第17讲使用RMAN恢复数据49分钟恢复目录49第19讲闪回技术即将发布50第25讲性能调整51第23讲全球化28分钟51CTO学院网址:52第21讲移动和重组数据(2)37分钟53第18讲用户管理的备份、还原、恢复即将发布课程地址:/course/course_id-3373.html。

oracle11g常用命令

oracle11g常用命令

第一章:日志管理1.forcing log switchessql> alter system switch logfile;2.forcing checkpointssql> alter system checkpoint;3.adding online redo log groupssql> alter database add logfile [group 4]sql> ('/disk3/log4a.rdo','/disk4/log4b.rdo') size 1m;4.adding online redo log memberssql> alter database add logfile membersql> '/disk3/log1b.rdo' to group 1,sql> '/disk4/log2b.rdo' to group 2;5.changes the name of the online redo logfilesql> alter database rename file 'c:/oracle/oradata/oradb/redo01.log' sql> to 'c:/oracle/oradata/redo01.log';6.drop online redo log groupssql> alter database drop logfile group 3;7.drop online redo log memberssql> alter database drop logfile member 'c:/oracle/oradata/redo01.log';8.clearing online redo log filessql> alter database clear [unarchived] logfile 'c:/oracle/log2a.rdo';ing logminer analyzing redo logfilesa. in the init.ora specify utl_file_dir = ' 'b. sql> executedbms_logmnr_d.build('oradb.ora','c:\oracle\oradb\log');c. sql> executedbms_logmnr_add_logfile('c:\oracle\oradata\oradb\redo01.log',sql> dbms_logmnr.new);d. sql> executedbms_logmnr.add_logfile('c:\oracle\oradata\oradb\redo02.log',sql> dbms_logmnr.addfile);e. sql> executedbms_logmnr.start_logmnr(dictfilename=>'c:\oracle\oradb\log\oradb.ora ');f. sql> select * fromv$logmnr_contents(v$logmnr_dictionary,v$logmnr_parameterssql> v$logmnr_logs);g. sql> execute dbms_logmnr.end_logmnr;第二章:表空间管理1.create tablespacessql> create tablespace tablespace_name datafile'c:\oracle\oradata\file1.dbf' size 100m,sql> 'c:\oracle\oradata\file2.dbf' size 100m minimum extent 550k [logging/nologging]sql> default storage (initial 500k next 500k maxextents 500 pctinccease 0)sql> [online/offline] [permanent/temporary] [extent_management_clause]2.locally managed tablespacesql> create tablespace user_data datafile'c:\oracle\oradata\user_data01.dbf'sql> size 500m extent management local uniform size 10m;3.temporary tablespacesql> create temporary tablespace temp tempfile'c:\oracle\oradata\temp01.dbf'sql> size 500m extent management local uniform size 10m;4.change the storage settingsql> alter tablespace app_data minimum extent 2m;sql> alter tablespace app_data default storage(initial 2m next 2m maxextents 999);5.taking tablespace offline or onlinesql> alter tablespace app_data offline;sql> alter tablespace app_data online;6.read_only tablespacesql> alter tablespace app_data read only|write;7.droping tablespacesql> drop tablespace app_data including contents;8.enableing automatic extension of data filessql> alter tablespace app_data add datafile'c:\oracle\oradata\app_data01.dbf'size 200msql> autoextend on next 10m maxsize 500m;9.change the size fo data files manuallysql> alter database datafile 'c:\oracle\oradata\app_data.dbf'resize 200m;10.Moving data files: alter tablespacesql> alter tablespace app_data rename datafile'c:\oracle\oradata\app_data.dbf'sql> to 'c:\oracle\app_data.dbf';11.moving data files:alter databasesql> alter database rename file 'c:\oracle\oradata\app_data.dbf'sql> to 'c:\oracle\app_data.dbf';第三章:表1.create a tablesql> create table table_name (column datatype,column datatype]....) sql> tablespace tablespace_name [pctfree integer] [pctused integer] sql> [initrans integer] [maxtrans integer]sql> storage(initial 200k next 200k pctincrease 0 maxextents 50)sql> [logging|nologging] [cache|nocache]2.copy an existing tablesql> create table table_name [logging|nologging] as subquery3.create temporary tablesql> create global temporary table xay_temp as select * from xay;on commit preserve rows/on commit delete rows4.pctfree = (average row size - initial row size) *100 /average row size pctused = 100-pctfree- (average row size*100/available data space)5.change storage and block utilization parametersql> alter table table_name pctfree=30 pctused=50 storage(next 500k sql> minextents 2 maxextents 100);6.manually allocating extentssql> alter table table_name allocate extent(size 500k datafile'c:/oracle/data.dbf');7.move tablespacesql> alter table employee move tablespace users;8.deallocate of unused spacesql> alter table table_name deallocate unused [keep integer]9.truncate a tablesql> truncate table table_name;10.drop a tablesql> drop table table_name [cascade constraints];11.drop a columnsql> alter table table_name drop column comments cascade constraints checkpoint 1000;alter table table_name drop columns continue;12.mark a column as unusedsql> alter table table_name set unused column comments cascade constraints;alter table table_name drop unused columns checkpoint 1000;alter table orders drop columns continue checkpoint 1000data_dictionary : dba_unused_col_tabs第四章:索引1.creating function-based indexessql> create index summit.item_quantity onsummit.item(quantity-quantity_shipped);2.create a B-tree indexsql> create [unique] index index_name on table_name(column,.. asc/desc) tablespacesql> tablespace_name [pctfree integer] [initrans integer] [maxtrans integer]sql> [logging | nologging] [nosort] storage(initial 200k next 200k pctincrease 0sql> maxextents 50);3.pctfree(index)=(maximum number of rows-initial number ofrows)*100/maximum number of rows4.creating reverse key indexessql> create unique index xay_id on xay(a) reverse pctfree 30storage(initial 200ksql> next 200k pctincrease 0 maxextents 50) tablespace indx;5.create bitmap indexsql> create bitmap index xay_id on xay(a) pctfree 30 storage( initial 200k next 200ksql> pctincrease 0 maxextents 50) tablespace indx;6.change storage parameter of indexsql> alter index xay_id storage (next 400k maxextents 100);7.allocating index spacesql> alter index xay_id allocate extent(size 200k datafile'c:/oracle/index.dbf');8.alter index xay_id deallocate unused;第五章:约束1.define constraints as immediate or deferredsql> alter session set constraint[s] = immediate/deferred/default;set constraint[s] constraint_name/all immediate/deferred;2. sql> drop table table_name cascade constraintssql> drop tablespace tablespace_name including contents cascade constraints3. define constraints while create a tablesql> create table xay(id number(7) constraint xay_id primary key deferrablesql> using index storage(initial 100k next 100k) tablespace indx);primary key/unique/references table(column)/check4.enable constraintssql> alter table xay enable novalidate constraint xay_id;5.enable constraintssql> alter table xay enable validate constraint xay_id;第六章:LOAD数据1.loading data using direct_load insertsql> insert /*+append */ into emp nologgingsql> select * from emp_old;2.parallel direct-load insertsql> alter session enable parallel dml;sql> insert /*+parallel(emp,2) */ into emp nologgingsql> select * from emp_old;ing sql*loadersql> sqlldr scott/tiger \sql> control = ulcase6.ctl \sql> log = ulcase6.log direct=true第七章:reorganizing dataing expoty$exp scott/tiger tables(dept,emp) file=c:\emp.dmp log=exp.log compress=n direct=ying import$imp scott/tiger tables(dept,emp) file=emp.dmp log=imp.log ignore=y3.transporting a tablespacesql>alter tablespace sales_ts read only;$exp sys/.. file=xay.dmp transport_tablespace=y tablespace=sales_tstriggers=n constraints=n$copy datafile$imp sys/.. file=xay.dmp transport_tablespace=ydatafiles=(/disk1/sles01.dbf,/disk2/sles02.dbf)sql> alter tablespace sales_ts read write;4.checking transport setsql> DBMS_tts.transport_set_check(ts_list=>'sales_ts' ..,incl_constraints=>true);在表transport_set_violations 中查看sql> dbms_tts.isselfcontained 为true 是,表示自包含第八章: managing password security and resources1.controlling account lock and passwordsql> alter user juncky identified by oracle account unlock;er_provided password functionsql> function_name(userid in varchar2(30),password in varchar2(30),old_password in varchar2(30)) return boolean3.create a profile : password settingsql> create profile grace_5 limit failed_login_attempts 3sql> password_lock_time unlimited password_life_time 30sql>password_reuse_time 30 password_verify_function verify_function sql> password_grace_time 5;4.altering a profilesql> alter profile default failed_login_attempts 3sql> password_life_time 60 password_grace_time 10;5.drop a profilesql> drop profile grace_5 [cascade];6.create a profile : resource limitsql> create profile developer_prof limit sessions_per_user 2sql> cpu_per_session 10000 idle_time 60 connect_time 480;7. view => resource_cost : alter resource costdba_Users,dba_profiles8. enable resource limitssql> alter system set resource_limit=true;第九章:Managing users1.create a user: database authenticationsql> create user juncky identified by oracle default tablespace users sql> temporary tablespace temp quota 10m on data password expire sql> [account lock|unlock] [profile profilename|default];2.change user quota on tablespacesql> alter user juncky quota 0 on users;3.drop a usersql> drop user juncky [cascade];4. monitor userview: dba_users , dba_ts_quotas第十章:managing privileges1.system privileges: view =>system_privilege_map ,dba_sys_privs,session_privs2.grant system privilegesql> grant create session,create table to managers;sql> grant create session to scott with admin option;with admin option can grant or revoke privilege from any user or role;3.sysdba and sysoper privileges:sysoper: startup,shutdown,alter database open|mount,alter database backup controlfile,alter tablespace begin/end backup,recover databasealter database archivelog,restricted sessionsysdba: sysoper privileges with admin option,create database,recover database until4.password file members: view:=> v$pwfile_users5.O7_dictionary_accessibility =true restriction access to view or tables in other schema6.revoke system privilegesql> revoke create table from karen;sql> revoke create session from scott;7.grant object privilegesql> grant execute on dbms_pipe to public;sql> grant update(first_name,salary) on employee to karen with grant option;8.display object privilege : view => dba_tab_privs, dba_col_privs9.revoke object privilegesql> revoke execute on dbms_pipe from scott [cascade constraints];10.audit record view :=> sys.aud$11. protecting the audit trailsql> audit delete on sys.aud$ by access;12.statement auditingsql> audit user;13.privilege auditingsql> audit select any table by summit by access;14.schema object auditingsql> audit lock on summit.employee by access whenever successful;15.view audit option : view=>all_def_audit_opts,dba_stmt_audit_opts,dba_priv_audit_opts,dba_obj_audit_opts16.view audit result: view=>dba_audit_trail,dba_audit_exists,dba_audit_object,dba_audit_session,dba_audit_statement第十一章: manager role1.create rolessql> create role sales_clerk;sql> create role hr_clerk identified by bonus;sql> create role hr_manager identified externally;2.modify rolesql> alter role sales_clerk identified by commission; sql> alter role hr_clerk identified externally;sql> alter role hr_manager not identified;3.assigning rolessql> grant sales_clerk to scott;sql> grant hr_clerk to hr_manager;sql> grant hr_manager to scott with admin option;4.establish default rolesql> alter user scott default role hr_clerk,sales_clerk; sql> alter user scott default role all;sql> alter user scott default role all except hr_clerk; sql> alter user scott default role none;5.enable and disable rolessql> set role hr_clerk;sql> set role sales_clerk identified by commission; sql> set role all except sales_clerk;sql> set role none;6.remove role from usersql> revoke sales_clerk from scott;sql> revoke hr_manager from public;7.remove rolesql> drop role hr_manager;8.display role informationview: =>dba_roles,dba_role_privs,role_role_privs,dba_sys_privs,role_sys_privs,role_tab_privs,session_roles第十二章: BACKUP and RECOVERY1.v$sga,v$instance,v$process,v$bgprocess,v$database,v$datafile,v$sgasta t2. Rman need set dbwr_IO_slaves or backup_tape_IO_slaves andlarge_pool_size3. Monitoring Parallel Rollback> v$fast_start_servers , v$fast_start_transactions4.perform a closed database backup (noarchivelog)> shutdown immediate> cp files /backup/> startup5.restore to a different location> connect system/manager as sysdba> startup mount> alter database rename file '/disk1/../user.dbf'to'/disk2/../user.dbf';> alter database open;6.recover syntax--recover a mounted database>recover database;>recover datafile '/disk1/data/df2.dbf';>alter database recover database;--recover an opened database>recover tablespace user_data;>recover datafile 2;>alter database recover datafile 2;7.how to apply redo log files automatically>set autorecovery on>recover automatic datafile 4;plete recovery:--method 1(mounted databae)>copy c:\backup\user.dbf c:\oradata\user.dbf>startup mount>recover datafile 'c:\oradata\user.dbf;>alter database open;--method 2(opened database,initially opened,not system or rollback datafile)>copy c:\backup\user.dbf c:\oradata\user.dbf (alter tablespace offline)>recover datafile 'c:\oradata\user.dbf' or>recover tablespace user_data;>alter database datafile 'c:\oradata\user.dbf' online or>alter tablespace user_data online;--method 3(opened database,initially closed not system or rollback datafile)>startup mount>alter database datafile 'c:\oradata\user.dbf' offline;>alter database open>copy c:\backup\user.dbf d:\oradata\user.dbf>alter database rename file 'c:\oradata\user.dbf'to'd:\oradata\user.dbf'>recover datafile 'e:\oradata\user.dbf' or recover tablespace user_data; >alter tablespace user_data online;--method 4(loss of data file with no backup and have all archive log) >alter tablespace user_data offline immediate;>alter database create datafile 'd:\oradata\user.dbf'as'c:\oradata\user.dbf''>recover tablespace user_data;>alter tablespace user_data online9.perform an open database backup> alter tablespace user_data begin backup;> copy files /backup/> alter database datafile '/c:/../data.dbf' end backup;> alter system switch logfile;10.backup a control file> alter database backup controlfile to 'control1.bkp';> alter database backup controlfile to trace;11.recovery (noarchivelog mode)> shutdown abort> cp files> startup12.recovery of file in backup mode>alter database datafile 2 end backup;13.clearing redo log file>alter database clear unarchived logfile group 1;>alter database clear unarchived logfile group 1 unrecoverable datafile;14.redo log recovery>alter database add logfile group 3 'c:\oradata\redo03.log'size 1000k; >alter database drop logfile group 1;>alter database open;or >cp c:\oradata\redo02.log' c:\oradata\redo01.log>alter database clear logfile 'c:\oradata\log01.log';。

Oracle11g安装与卸载

Oracle11g安装与卸载
Oracle数据库11g标准版是为中小型企业提供的功能全面的数据库,它 以较低的成本为中小企业提供了世界一流数据库的性能、可用性、可 伸缩性和安全性。Oracle数据库10g标准版可运行在多至四处理器的单 一服务器或集群服务器上,它是经济有效地开发和部署数据库应用程 序的安全选择。 易于安装和管理,提供内置的自动化管理功能 借助Oracle 真正应用集群实现全天候的可用性和按需伸缩性 附带可通过web浏览器快速构建web应用的工具 适用于所有数据、所有应用系统和所有平台,包括Windows和Linux
Oracle安装
安装程序成功下载,将会得到如下2个文件:
解压文件将得到database文件夹,文件组织如下:
点击setup.exe执行安装程序,开始安装。
Oracle安装
点击安装程序将会出现右上界面 稍候出现右下安装界面
步骤 1/9:配置安全更新 1、填写电子邮件地址(可以不填) 2、去掉复选框 3、点击下一步 附注: 如何没有填写电子邮件地址,将会 出现提示信息,不影响安装,点击 是(Y),继续安装
运行regedit命令,打开注册表窗口。删除注册表中与Oracle相关的内容,具体如 下: 1、删除HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE目录。 2、删除HKEY _LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services中所有以oracle或OraWeb为 开头的键。 3、删除 HKEY_LOCAL_MACHINE/SYSETM/CurrentControlSet/Services/Eventlog/application 中所有以oracle开头的键。 4、删除HKEY_CLASSES_ROOT目录下所有以Ora、Oracle、Orcl或EnumOra为前 缀的键。 5、删除 HKEY_CURRENT_USER/SOFTWARE/Microsoft/windows/CurrentVersion/Explorer/ MenuOrder/Start Menu/Programs中所有以oracle 开头的键。 6、删除HKDY_LOCAL_MACHINE/SOFTWARE/ODBC/ODBCINST.INI中除Microsoft ODBC for Oracle注册表键以外的所有含有Oracle的键。 • 7、删除环境变量中的PATHT CLASSPATH中包含Oracle的值。 • 8、删除“开始”/“程序”中所有Oracle的组和图标。 • 9、删除所有与Oracle相关的目录,包括: • 1、c:\Program file\Oracle目录。 • 2、ORACLE_BASE目录。 • 3、c:\Documents and Settings\系统用户名、LocalSettings\Temp目录下的临 时文件。

Oracle11g数据类型

Oracle11g数据类型

Oracle11g数据类型1. 字符类型数据类型长度说明CHAR(n BYTE/CHAR)默认1字节,n值最⼤为2000末尾填充空格以达到指定长度,超过最⼤长度报错。

默认指定长度为字节数,字符长度可以从1字节到四字节。

NCHAR(n)默认1字符,最⼤存储内容2000字节末尾填充空格以达到指定长度,n为Unicode字符数。

默认为1字节。

NVARCHAR2(n)最⼤长度必须指定,最⼤存储内容4000字节变长类型。

n为Unicode字符数VARCHAR2(n BYTE/CHAR)最⼤长度必须指定,⾄少为1字节或者1字符,n值最⼤为4000变长类型。

超过最⼤长度报错。

默认存储的是长度为0的字符串。

VARCHAR同VARCHAR2不建议使⽤2. 数字类型数据类型长度说明NUMBER(p[,s])1-22字节。

P取值范围1到38S取值范围-84到127存储定点数,值的绝对值范围为1.0 x 10 -130⾄1.0 x 10 126。

值⼤于等于1.0 x 10 126时报错。

p 为有意义的10进制位数,正值s为⼩数位数,负值s表⽰四舍五⼊到⼩数点左部多少位。

BINARY_FLOAT5字节,其中有⼀长度字节。

32位单精度浮点数类型。

符号位1位,指数位8位,尾数位23位。

BINARY_DOUBLE9字节,其中有⼀长度字节。

64位双精度浮点数类型。

3. 时间、时间间隔类型时间字段可取值范围:时间字段时间类型有效值时间间隔类型有效值YEAR-4712⾄9999,包括0任何整数MONTH01⾄120⾄11DAY01⾄31任何整数HOUR00 ⾄ 230 ⾄ 23MINUTE00 ⾄ 590⾄ 59SECOND00 to 59.9(n),9(n)不适⽤与DATE类型0 to 59.9(n)TIMEZONE_HOUR-1⾄14,不适⽤与DATE和TIMESTAMP类型不可⽤TIMEZONE_MINUTE00⾄59,不适⽤与DATE和TIMESTAMP类型不可⽤TIMEZONE_REGION不可⽤TIMEZONE_ABBR不可⽤时间、时间间隔类型:数据类型长度说明DATE7字节默认值为SYSDATE的年、⽉,⽇为01。

Oracle Database Quick Installation Guide 11g Release 2 (11.2) for Linux x86-64

Quick Installation Guide11g Release 2 (11.2) for Linux x86-64E24326-02May 2012This guide describes how to quickly install Oracle Database 11g Release 2 (11.2) on Linux x86-64 systems. It includes information about the following:1 Reviewing Information About This GuideThis guide describes how to install Oracle Database by using the default installation options.Tasks Described in This GuideThe procedures in this guide describe how to:∙Configure your system to support Oracle Database∙Install Oracle Database on a local file system by using the Typical Installation option∙Configure a general-purpose Oracle Database installation that uses the local file system for database file storageResults of a Successful InstallationAfter you successfully install Oracle Database:∙The database that you created and the default Oracle Net listener process run on the system.∙Oracle Enterprise Manager Database Control run on the system and can be accessed by using a Web browser.Tasks Not Described in This GuideThis guide covers the Typical Installation scenario and does not describe how to complete the following tasks:∙Using the Advanced Installation option to install the software∙Installing the software on a system that has an existing Oracle software installation∙Installing Oracle Clusterware and Oracle Real Application Clusters on a cluster∙Enabling Enterprise Manager e-mail notifications or automated backups ∙Enabling core file creation∙Verifying UDP and TCP kernel parameters∙Using alternative storage options such as Oracle Automatic Storage Management∙Installing and configuring Oracle Grid InfrastructureWhere to Get Additional Installation InformationFor more information about installing Oracle Database, including information about the tasks not described in this guide, refer to one of the following guides:All these guides are available on the product disc. To access them, use a Web browser to open the welcome.htm file located in the top-level directory of the media. Platform-specific documentation is available in PDF and HTML formats in the Documentation section..2 Logging In to the System as rootBefore you install the Oracle software, you must complete several tasks as the root user. To log in as the root user, complete one of the following procedures:Note:You must install the software from an X Window System workstation, an X terminal, or a PC or other system with X server software installed ∙Following are the steps for installing the software from an X Window System workstation or X terminal:1.Start a local terminal session, for example, an X terminal (xterm).2.If you are not installing the software on the local system, thenenter the following command to enable the remote host todisplay X applications on the local X server:3.$ xhost fully_qualified_remote_host_nameFor example:$ xhost 4.If you are not installing the software on the local system, thenuse the ssh, rlogin, or telnet command to connect to the systemwhere you want to install the software:5.$ telnet fully_qualified_remote_host_name6.If you are not logged in as the root user, then enter the followingcommand to switch user to root:7.$ sudosh8.password:9.#∙Following are the steps for installing the software from a PC or other system with X server software:Note:If necessary, refer to your X server documentation for moreinformation about completing this procedure. Depending onthe X server software that you are using, you may have tocomplete the tasks in a different order.1.Start the X server software.2.Configure the security settings of the X server software to permitremote hosts to display X applications on the local system.3.Connect to the remote system where you want to install thesoftware and start a terminal session on that system, for example,an X terminal (xterm).4.If you are not logged in as the root user on the remote system,then enter the following command to switch user to root:5.$ sudosh6.password:7.#3 Checking the Hardware RequirementsThe system must meet the following minimum hardware requirements:3.1 Memory RequirementsThe following are the memory requirements for installing Oracle Database11g Release 2 (11.2):∙Minimum: 1 GB of RAMRecommended: 2 GB of RAM or moreTo determine the RAM size, enter the following command:# grepMemTotal /proc/meminfoIf the size of the RAM is less than the required size, then you must install more memory before continuing.∙The following table describes the relationship between installed RAM and the configured swap space recommendation:Note:On Linux, the HugePages feature allocates non-swappablememory for large page tables using memory-mapped files.If you enable HugePages, then you should deduct thememory allocated to HugePages from the available RAMbefore calculating swap space.∙To determine whether the system architecture can run the software, enter the following command:∙# uname -mNote:This command displays the processor type. Verify that theprocessor architecture matches the Oracle software releaseto install. If you do not see the expected output, then youcannot install the software on this system.To determine the size of the configured swap space, enter the following command:# grepSwapTotal /proc/meminfoIf necessary, refer to the operating system documentation for information about how to configure additional swap space.To determine the available RAM and swap space, enter the following command:# freeIMPORTANT:∙Oracle recommends that you take multiple values for theavailable RAM and swap space before finalizing a value.This is because the available RAM and swap space keepchanging depending on the user interactions with thecomputer.∙Contact your operating system vendor for swap spaceallocation guidance for your server. The vendor guidelinessupersede the swap space requirements listed in this guide. Automatic Memory ManagementStarting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The shared memory should be sized to be at least the greaterof MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on that computer.To determine the amount of shared memory available, enter the following command:# df -h /dev/shm/Note:MEMORY_MAX_TARGET and MEMORY_TARGET cannot be used when LOCK_SGA is enabled or with HugePages on Linux.3.2 System ArchitectureTo determine whether the system architecture can run the software, enter the following command:# uname -mNote:This command displays the processor type. Verify that the processor architecture matches the Oracle software release to install. If you do not see the expected output, then you cannot install the software on this system.3.3 Disk Space RequirementsThe following are the disk space requirements for installing Oracle Database 11g Release 2 (11.2):∙At least 1 GB of disk space in the /tmp directoryTo determine the amount of disk space available in the /tmp directory,enter the following command:# df -h /tmpIf there is less than 1 GB of free disk space available in the /tmp directory, then complete one of the following steps:o Delete unnecessary files from the /tmp directory to meet the disk space requirement.o Set the TMP and TMPDIR environment variables when settingthe oracle user's environment.See Also:"Configuring the oracle User's Environment" for moreinformation about setting TMP and TMPDIRo Extend the file system that contains the /tmp directory. Ifnecessary, contact the system administrator for informationabout extending file systems.∙To determine the amount of free disk space on the system, enter the following command:∙# df -h∙The following tables describe the disk space requirements for software files, and data files for each installation type on Linux x86-64:∙∙∙Additional disk space, either on a file system or on an Oracle Automatic Storage Management disk group is required for the fast recovery area if you choose to configure automated backups.4 Checking the Software RequirementsDepending on the products that you intend to install, verify that the following softwares are installed on the system.∙Operating System Requirements∙Kernel Requirements∙Package Requirements∙Compiler Requirements∙Additional Software RequirementsNote:Oracle Universal Installer performs checks on the system to verify that it meets the listed requirements. To ensure that these checks pass, verify the requirements before you start Oracle Universal Installer.4.1 Operating System RequirementsThe following or later versions of the operating system are required for Oracle Database 11g Release 2 (11.2):∙Asianux Server 3 SP2∙Oracle Linux 4 Update 7∙Oracle Linux 5 Update 2 (with Red Hat Compatible Kernel)∙Oracle Linux 5 Update 5∙Oracle Linux 6∙Oracle Linux 6 (with Red Hat Compatible Kernel)∙Red Hat Enterprise Linux 4 Update 7∙Red Hat Enterprise Linux 5 Update 2∙Red Hat Enterprise Linux 5 Update 5 (with the Oracle Unbreakable Enterprise Kernel for Linux)∙Red Hat Enterprise Linux 6∙Red Hat Enterprise Linux 6 (with the Oracle Unbreakable Enterprise Kernel for Linux)∙SUSE Linux Enterprise Server 10 SP2∙SUSE Linux Enterprise Server 11Starting with Oracle Database 11g Release 2 (11.2), the Security Enhanced Linux (SE Linux) feature is supported for Oracle Linux 4, Oracle Linux 5, Oracle Linux 6, Red Hat Enterprise Linux 4, Red Hat Enterprise Linux 5, and Red Hat Enterprise Linux 6.To determine the distribution and version of Linux installed, enter the following command:# cat/proc/versionNote:Only the distributions and versions listed in the earlier list are supported. Do not install the software on other versions of Linux.4.2 Kernel RequirementsThe following are the kernel requirements for Oracle Database 11g Release 2 (11.2):∙On Oracle Linux 4 and Red Hat Enterprise Linux 42.6.9 or later∙On Oracle Linux 5 Update 52.6.32-100.0.19 or later∙On Oracle Linux 5 Update 22.6.18 or later (with Red Hat Compatible Kernel)∙On Oracle Linux 62.6.32-100.28.5.el6.x86_64 or later∙On Oracle Linux 62.6.32-71.el6.x86_64 or later (with Red Hat Compatible Kernel)∙On Red Hat Enterprise Linux 5 Update 5 with the Oracle Unbreakable Enterprise Kernel for Linux2.6.32 or later∙On Red Hat Enterprise Linux 6 with the Oracle Unbreakable Enterprise Kernel for Linux2.6.32-100.28.5.el6.x86_64 or later∙On Red Hat Enterprise Linux 62.6.32-71.el6.x86_64 or later∙On Asianux Server 3, Oracle Linux 5 Update 2, and Red Hat Enterprise Linux 5 Update 22.6.18 or later∙On SUSE Linux Enterprise Server 102.6.16.21 or later∙On SUSE Linux Enterprise Server 112.6.27.19 or laterSee Also:"About Oracle Unbreakable Enterprise Kernel for Linux" section in Oracle Database Installation Guide for LinuxTo determine whether the required kernel is installed, enter the following command:# uname -rThe following is a sample output displayed by running this command on an Oracle Linux 5.0 system:2.6.18-128.el5PAEIn this example, the output shows the kernel version (2.6.18) and errata level (-128.el5PAE) on the system.If the kernel version does not meet the requirement specified earlier in this section, then contact the operating system vendor for information about obtaining and installing kernel updates.4.3 Package RequirementsThe following are the list of packages required for Oracle Database 11g Release 2 (11.2):Note:∙Oracle recommends that you install your Linux operatingsystem with the default software packages (RPMs), unlessyou specifically intend to perform a minimal installation,and follow the directions for performing such an installationto ensure that you have all required packages for Oraclesoftware.∙Oracle recommends that you do not customize RPMsduring a default operating system installation. A defaultinstallation includes most required packages, and helps youto limit manual checks of package dependencies.∙If you did not perform a default Linux installation, youintend to use LDAP, and you want to use thescripts odisrvreg,oidca, or schemasync, then install the Kornshell RPM for your Linux distribution.∙You must install the packages (or later versions) listed inthe following table. Also, ensure that the list of RPMs andall the prerequisites for these RPMs are installed.∙If you are using Oracle Unbreakable Enterprise Kernel, thenall required kernel packages are installed as part of theOracle Unbreakable Enterprise Kernel installation.∙For Orace Linux 6 the Oracle Validated RPM has beenreplaced by the Oracle RDBMS Server 11gR2 Pre-installRPM. See the "Completing a Minimal Linux Installation"section in Oracle Database Installation Guide.Note:Starting with Oracle Database 11g Release 2 (11.2.0.2), all the 32-bit packages, except for gcc-32bit-4.3, listed in the following table are no longer required for installing a database on Linux x86-64. Only the 64-bit packages are required. However, for any Oracle Database 11g release before 11.2.0.2, both the 32-bit and 64-bit packages listed in the following table are required.∙The following or later version of packages for Oracle Linux 4 and Red Hat Enterprise Linux 4 must be installed:∙binutils-2.15.92.0.2∙compat-libstdc++-33-3.2.3∙compat-libstdc++-33-3.2.3 (32 bit)∙elfutils-libelf-0.97∙elfutils-libelf-devel-0.97∙expat-1.95.7∙gcc-3.4.6∙gcc-c++-3.4.6∙glibc-2.3.4-2.41∙glibc-2.3.4-2.41 (32 bit)∙glibc-common-2.3.4∙glibc-devel-2.3.4∙glibc-headers-2.3.4∙libaio-0.3.105∙libaio-0.3.105 (32 bit)∙libaio-devel-0.3.105∙libaio-devel-0.3.105 (32 bit)∙libgcc-3.4.6∙libgcc-3.4.6 (32-bit)∙libstdc++-3.4.6∙libstdc++-3.4.6 (32 bit)∙libstdc++-devel 3.4.6∙make-3.80∙numactl-0.6.4.x86_64∙pdksh-5.2.14∙sysstat-5.0.5∙The following or later version of packages for Asianux 3, Oracle Linux 5, and Red Hat Enterprise Linux 5 must be installed:∙binutils-2.17.50.0.6∙compat-libstdc++-33-3.2.3∙compat-libstdc++-33-3.2.3 (32 bit)∙elfutils-libelf-0.125∙elfutils-libelf-devel-0.125∙gcc-4.1.2∙gcc-c++-4.1.2∙glibc-2.5-24∙glibc-2.5-24 (32 bit)∙glibc-common-2.5∙glibc-devel-2.5∙glibc-devel-2.5 (32 bit)∙glibc-headers-2.5∙ksh-20060214∙libaio-0.3.106∙libaio-0.3.106 (32 bit)∙libaio-devel-0.3.106∙libaio-devel-0.3.106 (32 bit)∙libgcc-4.1.2∙libgcc-4.1.2 (32 bit)∙libstdc++-4.1.2∙libstdc++-4.1.2 (32 bit)∙libstdc++-devel 4.1.2∙make-3.81∙sysstat-7.0.2∙The following or later version of packages for Oracle Linux 6, and Red Hat Enterprise Linux 6 must be installed:∙binutils-2.20.51.0.2-5.11.el6 (x86_64)∙compat-libcap1-1.10-1 (x86_64)∙compat-libstdc++-33-3.2.3-69.el6 (x86_64)∙compat-libstdc++-33-3.2.3-69.el6.i686∙gcc-4.4.4-13.el6 (x86_64)∙gcc-c++-4.4.4-13.el6 (x86_64)∙glibc-2.12-1.7.el6 (i686)∙glibc-2.12-1.7.el6 (x86_64)∙glibc-devel-2.12-1.7.el6 (x86_64)∙glibc-devel-2.12-1.7.el6.i686∙ksh∙libgcc-4.4.4-13.el6 (i686)∙libgcc-4.4.4-13.el6 (x86_64)∙libstdc++-4.4.4-13.el6 (x86_64)∙libstdc++-4.4.4-13.el6.i686∙libstdc++-devel-4.4.4-13.el6 (x86_64)∙libstdc++-devel-4.4.4-13.el6.i686∙libaio-0.3.107-10.el6 (x86_64)∙libaio-0.3.107-10.el6.i686∙libaio-devel-0.3.107-10.el6 (x86_64)∙libaio-devel-0.3.107-10.el6.i686∙make-3.81-19.el6∙sysstat-9.0.4-11.el6 (x86_64)∙The following or later version of packages for SUSE Linux Enterprise Server 10 must be installed:∙binutils-2.16.91.0.5∙compat-libstdc++-5.0.7∙gcc-4.1.0∙gcc-c++-4.1.2∙glibc-2.4-31.63∙glibc-devel-2.4-31.63∙glibc-devel-32bit-2.4-31.63∙ksh-93r-12.9∙libaio-0.3.104∙libaio-32bit-0.3.104∙libaio-devel-0.3.104∙libaio-devel-32bit-0.3.104∙libelf-0.8.5∙libgcc-4.1.2∙libstdc++-4.1.2∙libstdc++-devel-4.1.2∙make-3.80∙numactl-0.9.6.x86_64∙sysstat-8.0.4∙The following or later version of packages for SUSE Linux Enterprise Server 11 must be installed:∙binutils-2.19∙gcc-4.3∙gcc-32bit-4.3∙gcc-c++-4.3∙glibc-2.9∙glibc-32bit-2.9∙glibc-devel-2.9∙glibc-devel-32bit-2.9∙ksh-93t∙libaio-0.3.104∙libaio-32bit-0.3.104∙libaio-devel-0.3.104∙libaio-devel-32bit-0.3.104∙libstdc++33-3.3.3∙libstdc++33-32bit-3.3.3∙libstdc++43-4.3.3_20081022∙libstdc++43-32bit-4.3.3_20081022∙libstdc++43-devel-4.3.3_20081022∙libstdc++43-devel-32bit-4.3.3_20081022∙libgcc43-4.3.3_20081022∙libstdc++-devel-4.3∙make-3.81∙sysstat-8.1.5To determine whether the required packages are installed, enter commands similar to the following:# rpm -q package_nameIf a package is not installed, then install it from the Linux distribution media or download the required package version from the Linux vendor's Web site.4.4 Compiler RequirementsIntel C++ Compiler 10.1 or later and the version of GNU C and C++ compilers listed under "Package Requirements" are supported with these products. Note:Intel Compiler v10.1 can be used only with the standard template libraries of the gcc versions mentioned in the Package Requirements section, to build Oracle C++ Call Interface (OCCI) applications.Oracle XML Developer's Kit is supported with the same compilers as OCCI. 4.5 Additional Software RequirementsDepending on the components you want to use, you must ensure that the following software are installed:4.5.1 Oracle ODBC DriversYou should install ODBC Driver Manager for UNIX. You can download and install the Driver Manager from the following URL:To use ODBC, you must also install the following additional ODBC RPMs, depending on your operating sytem:∙On Oracle Linux 4 and Red Hat Enterprise Linux 4:o unixODBC-2.2.11 (32-bit) or latero unixODBC-devel-2.2.11 (64-bit) or latero unixODBC-2.2.11 (64-bit) or later∙On Asianux Server 3, Oracle Linux 5, and Red Hat Enterprise Linux 5: o unixODBC-2.2.11 (32-bit) or latero unixODBC-devel-2.2.11 (64-bit) or latero unixODBC-2.2.11 (64-bit) or later∙On Oracle Linux 6 and Red Hat Enterprise Linux 6:o unixODBC-2.2.14-11.el6 (x86_64) or latero unixODBC-2.2.14-11.el6.i686 or latero unixODBC-devel-2.2.14-11.el6 (x86_64) or latero unixODBC-devel-2.2.14-11.el6.i686 or later∙On SUSE 10:o unixODBC-32 bit-2.2.11 (32-bit) or latero unixODBC-2.2.11 (64-bit) or latero unixODBC-devel-2.2.11 (64-bit) or later∙On SUSE 11:o unixODBC-2.2.12 or latero unixODBC-devel-2.2.12 or latero unixODBC-32bit-2.2.12 (32-bit) or later4.5.2 Oracle JDBC/OCI DriversUse JDK 6 (Java SE Development Kit 1.6.0_21) or JDK 5 (1.5.0_24) with the JNDI extension with the Oracle Java Database Connectivity and Oracle Call Interface drivers. However, these are not mandatory for the database installation. Note that IBM JDK 1.5 is installed with this release.4.5.3 Linux-PAM LibraryInstall the latest Linux-PAM (Pluggable Authentication Modules for Linux) library to enable the system administrator to choose how applications authenticate users.4.5.4 Oracle Messaging GatewayOracle Messaging Gateway supports the integration of Oracle Streams Advanced Queuing (AQ) with the following software:∙IBM WebSphere MQ V6.0, client and server, with corrective service diskette 5 (CSD05) or later:∙MQSeriesClient∙MQSeriesServer∙MQSeriesRuntime∙TIBCO Rendezvous 7.3If you require a CSD for WebSphere MQ, then refer to the following Web site for download and installation information:/support/entry/portal/Downloads/Software/WebSphere/Web Sphere_MQ4.5.5 Programming LanguagesThe following products are certified for use with:∙Pro* COBOLMicro Focus Server Express 5.14.5.6 Browser RequirementsWeb browsers must support Java Script, and the HTML 4.0 and CSS 1.0 standards. The following Web browsers are supported for Oracle Enterprise Manager Database Control:∙Netscape Navigator 8.1∙Netscape Navigator 9.0∙Microsoft Internet Explorer 6.0 SP2∙Microsoft Internet Explorer 7.0 SP1∙Microsoft Internet Explorer 8.0∙Microsoft Internet Explorer 9.0∙Firefox 2.0∙Firefox 3.0.7∙Firefox 3.5∙Firefox 3.6∙Safari 3.0.4∙Safari 3.1∙Safari 3.2∙Safari 4.0.x∙Google Chrome 3.0∙Google Chrome 4.0See Also:Chapter 2, "Oracle Application Express Installation Requirements" and "Recommended Pre-installation Tasks" in Oracle Application Express Installation Guide5 Creating Required Operating System Groups and UsersThe following local operating system groups and users are required if you are installing Oracle Database:∙The Oracle Inventory group (typically, oinstall)∙The OSDBA group (typically, dba)∙The Oracle software owner (typically, oracle)∙The OSOPER group (optional. Typically, oper)To determine whether these groups and users exist, and if necessary, to create them, follow these steps:1.To determine whether the oinstall group exists, enter the followingcommand:2.# more /etc/oraInst.locIf the output of this command shows the oinstall group name, then the group exists.If the oraInst.loc file exists, then the output from this command issimilar to the following:inventory_loc=/u01/app/oraInventoryinst_group=oinstallThe inst_group parameter shows the name of the Oracle Inventorygroup, oinstall.3.To determine whether the dba group exists, enter the followingcommand:4.# grepdba /etc/groupIf the output from this commands shows the dba group name, then the group exists.5.If necessary, enter the following commands to createthe oinstall and dba groups:6.# /usr/sbin/groupaddoinstall7.# /usr/sbin/groupadddba8.To determine whether the oracle user exists and belongs to the correctgroups, enter the following command:9.# id oracleIf the oracle user exists, then this command displays information about the groups to which the user belongs. The output should be similar tothe following, indicating that oinstall is the primary group and dba is a secondary group:uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper)10.If necessary, complete one of the following actions:o If the oracle user exists, but its primary group is not oinstall or it is not a member of the dba group, then enter the followingcommand:o# /usr/sbin/usermod -g oinstall -G dba oracleo If the oracle user does not exist, enter the following command to create it:o# /usr/sbin/useradd -g oinstall -G dba oracleThis command creates the oracle user and specifies oinstall asthe primary group and dba as the secondary group.11.Enter the following command to set the password of the oracle user:12.# passwd oracle6 Configuring Kernel ParametersVerify that the kernel parameters shown in the following table are set to values greater than or equal to the minimum value shown. The procedure following the table describes how to verify and set the values.Note:∙Enter commands similar to the following to view the current values of the kernel parameters:Note:Make a note of the current values and identify any valuesthat you must change.∙If the value of any kernel parameter is different from the recommended value, then complete the following steps:ing any text editor, create or edit the /etc/sysctl.conf file, andadd or edit lines similar to the following:Note:Include lines only for the kernel parameter values tochange. For the semaphore parameters (kernel.sem),you must specify all four values. However, if any ofthe current values are larger than the minimum value,then specify the larger value.fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576By specifying the values in the /etc/sysctl.conf file, they persist when you restart the system. However, on SUSE Linux Enterprise Server systems, enter the following command to ensure that the system reads the /etc/sysctl.conf file when it restarts:# /sbin/chkconfigboot.sysctl on2.Enter the following command to change the current values of thekernel parameters:3.# /sbin/sysctl -pReview the output from this command to verify that the values are correct. If the values are incorrect, edit the /etc/sysctl.conf file, then enter this command again.4.Enter the command /sbin/sysctl -a to confirm that the values areset correctly.5.On SUSE systems only, enter the following command to cause thesystem to read the /etc/sysctl.conf file when it restarts:6.# /sbin/chkconfigboot.sysctl on7.On SUSE systems only, you must enter the GID of the oinstallgroup as the value for theparameter /proc/sys/vm/hugetlb_shm_group. Doing this grantsmembers of oinstall a group permission to create shared memory segments.For example, where the oinstall group GID is 501:# echo 501 > /proc/sys/vm/hugetlb_shm_groupAfter running this command, use vi to add the following textto /etc/sysctl.conf, and enable the boot.sysctl script to run onsystem restart:vm.hugetlb_shm_group=501Note:Only one group can be defined asthe vm.hugetlb_shm_group.8.After updating the values of kernel parameters inthe /etc/sysctl.conf file, either restart the computer, or run thecommand sysctl -p to make the changes inthe /etc/sysctl.conf file available in the active kernel memory. Check Resource Limits for the Oracle Software Installation UsersFor each installation software owner, check the resource limits for installation, using the following recommended ranges:Table 1 Installation Owner Resource Limit Recommended Ranges1.Log in as an installation owner.2.Check the soft and hard limits for the file descriptor setting. Ensure thatthe result is in the recommended range. For example:3.$ ulimit -Sn4.40965.$ ulimit -Hn6.655367.Check the soft and hard limits for the number of processes available to auser. Ensure that the result is in the recommended range. For example:8.$ ulimit -Su9.204710.$ ulimit -Hu11.1638412.13.Check the soft limit for the stack setting. Ensure that the result is in therecommended range. For example:14.$ ulimit -Ss15.1024016.$ ulimit -Hs17.3276818.Repeat this procedure for each Oracle software installation owner.If necessary, update the resource limits inthe /etc/security/limits.conf configuration file for the installation owner. For example, add the following lines to the /etc/security/limits.conf file:oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240Note:∙The values mentioned in this example are illustrative andnot actual values that must be added.∙When the limits.conf file is changed, these changes takeeffect immediately. However, if the grid or oracle users arelogged in, then these changes do not take effect until youlog these users out and log them back in. You must do thisbefore you attempt to use these accounts to install.7 Creating Required DirectoriesCreate directories with names similar to the following, and specify the correct owner, group, and permissions for them:∙The Oracle base directory∙An optional Oracle data file directory。

环境构筑之oracle11g数据库创建

Oracle11g 数据库图文创建步骤1.创建相关a). MALL业务数据库数据库名:BFMALL作用:MALL业务和卡数据平台b). POS数据库数据库名:BFPOS作用:POS销售数据平台c). 前提条件oracle11g server主程序已安装完成2.创建步骤(以业务数据库BFMALL为创建范例)a). 在业务服务器上运行database configuration assistant数据库创建工具,如下图所示:b). 欢迎界面,如下图所示:c). 创建数据库,如下图所示:d). 默认一般用途或事务处理,如下图所示:e). 数据库名称按照命名规约填写,业务数据库命名为BFMALL,POS数据库则命名为BFPOS,如下图所示:f). 管理选项,可启用自动磁盘备份,如下图所示:g). 所有帐户均使用同一管理口令,便于记忆,本例设置为DHHZDHHZ,如下图所示:h). 存储选项,本例默认采用文件系统,正式环境根据实际情况,即可配置于服务器自身硬盘分区,也可配置于磁盘存储阵列,如下图所示:i). 安装位置可自行指定,本例采用oracle默认位置,正式环境一般基于空间较大、非系统盘的硬盘分区中,如下图所示:j). 恢复配置,正式环境必须选用归档模式,便于日后通过归档日志恢复,本例鉴于减小资源消耗不采用,同时快速恢复区的大小根据机器内存大小进行适当分配,如下图所示:k). 数据库内容,不选用示例,如下图所示:l). 初始化参数,正式环境需根据实际情况设置,本例自动分配,如下图所示:i). 安装设置,本例默认,如下图所示:m). 自动维护,本例采用,如下图所示:n). 数据库存储一览,如下图所示:o). 创建选项,如下图所示:p). 最终确认安装配置项目,如下图所示:q). 正在创建,如下图所示:r). 数据库BFMALL创建完成,如下图所示:s). 重复以上步骤,创建POS数据库BFPOS,完成即可。

Oracle 11gR2 RAC ASM Multipath ESXi Openfile

Oracle 11gR2 RAC ASM Multipath ESXiOpenfiler 1.介绍硬件配置:FUJITSU PRIMERGY RX300 S7 ,内存128G,硬盘2T虚拟机版本:VMware ESXi 5.5 update1Openfiler版本:2.99.1虚拟客户机:Oracle Linux 6 update 7Oracle数据库版本:11.2.0.4rac架构规划:安装VMware ESXi 5.5 update1 (略)安装Openfiler(略)Openfilter配置:https://10.10.10.200:446使用默认的用户名密码进行登陆User:openfilerPass:password安装Oracle Linux 6.7 (略)安装时选择“Desktop”模式,安装完成后关闭防火墙和selinux 安装必要的软件包:配置本地yum安装源:mount -o loop OracleLinux-R6-U7-Server-x86_64-dvd.iso /mediacd /etc/you.repos.dvilocal.repo[oel6]name=Enterprise Linux 6.7 DVDbaseurl=file:///media/Servergpgcheck=0enabled=1yum install oracle-rdbms-server-11gR2-preinstall安装Oracle:(以下操作在所有节点)cat /etc/sysctl.conf# oracle-rdbms-server-11gR2-preinstall setting for fs.file-max is 6815744fs.file-max = 6815744# oracle-rdbms-server-11gR2-preinstall setting for kernel.sem is '250 32000 100 128'kernel.sem = 250 32000 100 128# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmni is 4096kernel.shmmni = 4096# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 1073741824 on x86_64# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 2097152 on i386# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmax is 4398046511104 on x86_64 # oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmax is 4294967295 on i386 kernel.shmmax = 4398046511104# oracle-rdbms-server-11gR2-preinstall setting for kernel.panic_on_oops is 1 per Orabug 19212317kernel.panic_on_oops = 1# oracle-rdbms-server-11gR2-preinstall setting for net.core.rmem_default is 262144net.core.rmem_default = 262144# oracle-rdbms-server-11gR2-preinstall setting for net.core.rmem_max is 4194304net.core.rmem_max = 4194304# oracle-rdbms-server-11gR2-preinstall setting for net.core.wmem_default is 262144net.core.wmem_default = 262144# oracle-rdbms-server-11gR2-preinstall setting for net.core.wmem_max is 1048576net.core.wmem_max = 1048576# oracle-rdbms-server-11gR2-preinstall setting for fs.aio-max-nr is 1048576fs.aio-max-nr = 1048576# oracle-rdbms-server-11gR2-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500 net.ipv4.ip_local_port_range = 9000 65500cat /etc/security/limits.conf# oracle-rdbms-server-11gR2-preinstall setting for nofile soft limit is 1024oracle soft nofile 1024# oracle-rdbms-server-11gR2-preinstall setting for nofile hard limit is 65536oracle hard nofile 65536# oracle-rdbms-server-11gR2-preinstall setting for nproc soft limit is 16384# refer orabug15971421 for more info.oracle soft nproc 16384# oracle-rdbms-server-11gR2-preinstall setting for nproc hard limit is 16384oracle hard nproc 16384# oracle-rdbms-server-11gR2-preinstall setting for stack soft limit is 10240KBoracle soft stack 10240# oracle-rdbms-server-11gR2-preinstall setting for stack hard limit is 32768KBoracle hard stack 32768# oracle-rdbms-server-11gR2-preinstall setting for memlock hard limit is maximum of {128GB (x86_64) / 3GB (x86) or 90 % of RAM}oracle hard memlock 134217728# oracle-rdbms-server-11gR2-preinstall setting for memlock soft limit is maximum of {128GB (x86_64) / 3GB (x86) or 90% of RAM}oracle soft memlock 134217728grid soft nofile 1024grid hard nofile 65536grid soft nproc 16384grid hard nproc 16384grid soft stack 10240grid hard stack 32768grid hard memlock 134217728grid soft memlock 134217728配置iSCSI(启动器)服务:serviceiscsi startserviceiscsid startchkconfigiscsi onchkconfigiscsid on[root@host1 rules.d]# iscsiadm -m discovery -t sendtargets -p 10.10.10.20010.10.10.200:3260,1 .openfiler:tsn.a5e4c27b1e4d10.10.10.201:3260,1 .openfiler:tsn.a5e4c27b1e4d10.10.10.200:3260,1 .openfiler:tsn.a55e30d0c0e910.10.10.201:3260,1 .openfiler:tsn.a55e30d0c0e9手工登录:iscsiadm -m node -T 10.10.10.200:3260,1 .openfiler:tsn.a5e4c27b1e4d –l -p 10.10.10.200iscsiadm -m node -T 10.10.10.201:3260,1 .openfiler:tsn.a5e4c27b1e4d –l -p 10.10.10.200iscsiadm -m node -T 10.10.10.200:3260,1 10.10.10.200:3260,1 .openfiler:tsn.a55e30d0c0e9 –l -p 10.10.10.200iscsiadm -m node -T 10.10.10.201:3260,1 10.10.10.200:3260,1 .openfiler:tsn.a55e30d0c0e9 –l -p 10.10.10.200Display current sessions# iscsiadm -m sessiontcp: [1] 10.10.10.200:3260,1 .openfiler:tsn.a5e4c27b1e4d (non-flash)tcp: [2] 10.10.10.201:3260,1 .openfiler:tsn.a5e4c27b1e4d (non-flash)tcp: [3] 10.10.10.200:3260,1 .openfiler:tsn.a55e30d0c0e9 (non-flash)tcp: [4] 10.10.10.201:3260,1 .openfiler:tsn.a55e30d0c0e9 (non-flash)安装multipath:yum install device-mapper-multipath配置multipath:cat /etc/multipath.confblacklist {devnode "^sda[1-2]"}defaults {user_friendly_names yespath_grouping_policymultibusfailback immediateno_path_retry fail}启动服务:servicemultipathd startcat/etc/udev/rules.d/12-dm-permissions.rulesENV{DM_NAME}=="mpathb", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="oracleasm/disk-$env{DM_NAME}"Reload UDEV ( OEL 6 style )udevadm control --reload-rulesstart_udevcat /etc/hosts:10.10.10.11 host1 10.10.10.12 host2 10.10.10.21 host1-vip10.10.10.22 host2-vip10.10.10.31 host-cluster host-cluster-scan192.168.1.11 host1-priv192.168.1.12 host2-priv建用户:groupadd -g 5000 asmadmingroupadd -g 5001 asmdbagroupadd -g 5002 asmopergroupadd -g 6000 oinstallgroupadd -g 6001 dbagroupadd -g 6002 operuseradd -u 2000 -g oinstall -G asmadmin,asmdba,asmoper griduseradd -u 2001 -g oinstall -G dba,asmdba oracleoracle用户可能之前已经创建,这里命令会报错可使用usermod命令修改oracle用户所属组,否则后台使用DBCA创建库的时候会出错passwd gridpasswd oracle建目录:mkdir –p /oracle/grid_basemkdir –p /oracle/grid_homemkdir –p /oracle/app/product/11.2/db_1chown –R grid:asmadmin /oraclechown –R oracle:oinstall /oracle/app设置环境变量:grid 用户环境变量:export ORACLE_BASE=/oracle/grid_baseexport ORACLE_HOME=/oracle/grid_homeexport GRID_HOME=/oracle/grid_homeexport PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/binexport ORACLE_SID=+ASM1export LD_LIBRARY_PATH=$GRID_HOME/lib:$GRID_HOME/lib32export NLS_LANG=AMERICAN_AMERICA.ZHS16GBKoracle用户环境变量:export ORACLE_BASE=/oracle/appexport ORACLE_HOME=/oracle/app/product/11.2/db_1export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin export ORACLE_SID=rac1export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK安装Grid Infrastructure(使用grid用户):检查状态:[root@host1 ~]# crsctl stat res -t--------------------------------------------------------------------------------NAME TARGET STATE SERVER STATE_DETAILS --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.DATA1.dgONLINE ONLINE host1ONLINE ONLINE host2ora.LISTENER.lsnrONLINE ONLINE host1ONLINE ONLINE host2ora.asmONLINE ONLINE host1 StartedONLINE ONLINE host2 Startedora.gsdOFFLINE OFFLINE host1OFFLINE OFFLINE host2workONLINE ONLINE host1ONLINE ONLINE host2ora.onsONLINE ONLINE host1ONLINE ONLINE host2--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.LISTENER_SCAN1.lsnr1 ONLINE ONLINE host1ora.cvu1 ONLINE ONLINE host1ora.host1.vip1 ONLINE ONLINE host1ora.host2.vip1 ONLINE ONLINE host2ora.oc4j1 ONLINE ONLINE host1ora.scan1.vip1 ONLINE ONLINE host1打补丁(GI):两节点都执行,使用grid用户cd/oracle/grid_home/crs/install[root@host1 install]# ./rootcrs.pl -unlockUsing configuration parameter file: ./crsconfig_paramsCRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'host1' CRS-2673: Attempting to stop 'ora.crsd' on 'host1'CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'host1'CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'host1'CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'host1'CRS-2673: Attempting to stop 'ora.oc4j' on 'host1'CRS-2673: Attempting to stop 'ora.DATA1.dg' on 'host1'CRS-2677: Stop of 'ora.cvu' on 'host1' succeededCRS-2672: Attempting to start 'ora.cvu' on 'host2'CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'host1' succeededCRS-2673: Attempting to stop 'ora.scan1.vip' on 'host1'CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'host1' succeededCRS-2673: Attempting to stop 'ora.host1.vip' on 'host1'CRS-2676: Start of 'ora.cvu' on 'host2' succeededCRS-2677: Stop of 'ora.scan1.vip' on 'host1' succeededCRS-2672: Attempting to start 'ora.scan1.vip' on 'host2'CRS-2677: Stop of 'ora.host1.vip' on 'host1' succeededCRS-2672: Attempting to start 'ora.host1.vip' on 'host2'CRS-2676: Start of 'ora.scan1.vip' on 'host2' succeededCRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on 'host2'CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'host2' succeededCRS-2677: Stop of 'ora.oc4j' on 'host1' succeededCRS-2672: Attempting to start 'ora.oc4j' on 'host2'CRS-2676: Start of 'ora.host1.vip' on 'host2' succeededCRS-2677: Stop of 'ora.DATA1.dg' on 'host1' succeededCRS-2673: Attempting to stop 'ora.asm' on 'host1'CRS-2677: Stop of 'ora.asm' on 'host1' succeededCRS-2676: Start of 'ora.oc4j' on 'host2' succeededCRS-2673: Attempting to stop 'ora.ons' on 'host1'CRS-2677: Stop of 'ora.ons' on 'host1' succeededCRS-2673: Attempting to stop 'work' on 'host1'CRS-2677: Stop of 'work' on 'host1' succeededCRS-2792: Shutdown of Cluster Ready Services-managed resources on 'host1' has completed CRS-2677: Stop of 'ora.crsd' on 'host1' succeededCRS-2673: Attempting to stop 'ora.ctssd' on 'host1'CRS-2673: Attempting to stop 'ora.evmd' on 'host1'CRS-2673: Attempting to stop 'ora.asm' on 'host1'CRS-2673: Attempting to stop 'ora.mdnsd' on 'host1'CRS-2677: Stop of 'ora.evmd' on 'host1' succeededCRS-2677: Stop of 'ora.mdnsd' on 'host1' succeededCRS-2677: Stop of 'ora.asm' on 'host1' succeededCRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'host1'CRS-2677: Stop of 'ora.ctssd' on 'host1' succeededCRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'host1' succeededCRS-2673: Attempting to stop 'ora.cssd' on 'host1'CRS-2677: Stop of 'ora.cssd' on 'host1' succeededCRS-2673: Attempting to stop 'ora.crf' on 'host1'CRS-2677: Stop of 'ora.crf' on 'host1' succeededCRS-2677: Stop of 'ora.gipcd' on 'host1' succeededCRS-2673: Attempting to stop 'ora.gpnpd' on 'host1'CRS-2677: Stop of 'ora.gpnpd' on 'host1' succeededCRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'host1' has completedCRS-4133: Oracle High Availability Services has been stopped.Successfully unlock /oracle/grid_home更新OPatch软件:cd /oracle/grid_homerm -rfOPatch/unzip p6880880_112000_Linux-x86-64.zipcd /oracle/soft/gridunzip p2*******_112040_Linux-x86-64.zipcd/oracle/grid_home/OPatch/./opatchnapply -oh /oracle/grid_home -local /oracle/soft/grid/20996923./opatchlspatches./opatchlsinventory打补丁(DB):两个节点都执行,使用oracle用户cd /oracle/app/product/11.2/db_1/rm -rfOPatch/unzip p6880880_112000_Linux-x86-64.zipcd/oracle/soft/db/unzip p2*******_112040_Linux-x86-64.zipcd /oracle/app/product/11.2/db_1/OPatch./opatchnapply -oh /oracle/app/product/11.2/db_1 -local /oracle/soft/db/20760982./opatchlspatches./opatchlsinventory在root用户下开启crs服务:/oracle/grid_home/rdbms/install/rootadd_rdbms.sh/oracle/grid_home /crs/install/rootcrs.pl -patch系统检查:crsctl check hascrsctl check crscrsctl stat res -t ifconfig–a创建数据库DBCA:调整VKTM优先级:参考文档:百度文库:Oracle 11gR2 RAC ESXiOpenfiler/link?url=zhS05_Rf3zH0CQF-RFpIwOr8S2-q2qw8IHFLDlz9e6UusN-WFN0L vHW9Tm0tRR-MCFuiajwOQaZimYyZpXUJ5zX2Hf45K_V2uTC2qh4wlXSOracle RAC安装中使用multipath实现存储设备持久化/s/blog_48567d850101jxmj.htmlLinux平台的多路径软件multipath的使用案例/23135684/viewspace-745789/Oracle 11g R2+RAC+ASM+OracleLinux6.4安装详解(图)/xmlrpc.php?r=blog/article&id=4681351&uid=29655480在Oracle Enterprise Linux 和iSCSI 上构建您自己的Oracle RAC 11g 集群/technetwork/cn/articles/hunter-rac11gr2-iscsi-083834-zhs.htmlRAC 11.2.0.4 setup using OPENFILER with Multipath ISCSI diskshttp://www.hhutzler.de/blog/rac-11-2-0-4-setup-using-openfiler-with-multipathed-iscsi-disks/#s etup-iscsi-clients-rac-nodesUDEV setup in a Multipath env for RAC/ASMhttp://www.hhutzler.de/blog/udev-setup-for-a-multipath-env/。

Oracle11g RAC 实施手册

一系统网络资源1.1网络分配:主机名公网(public) 专网(private) 虚拟网(vip)Rac1 IP IP IPRac2 IP IP IP1.2 硬件资源Cpu :Intel(R) Xeon(TM) MP CPU 3.16GHz*2内存:1G硬盘:20G共享磁盘:6G1.3 操作系统安装1.3.1 操作系统版本:Red Hat Enterprise Linux AS release 4 (Nahant Update 4) 1.3.2 系统分区分区信息分区类型分区大小/boot ext3 100M/ ext3 10240MSwap swap 2048/oracle ext3 10240M/opt ext3 5120M/tmp ext3 1024M1.3.3 系统语言简体中文,ENGLISH(USA)1.3.4 安装模式完全安装二数据安装资源2.1 数据库安装包2.1.1 ORACLE 11G软件包:下载地址:Oracle Database 11g Release 1 (11.1.0.6.0) for Linux x86Oracle Database 11g Release 1 Client (11.1.0.6.0) for Linux x86Oracle Database 11g Examples (formerly Companion)Oracle Clusterware Release 1 (11.1.0.6.0) for Linux x86Oracle Database Gateways 11g Release 1 (11.1.0.6.0) for Linux x862.1.2 ORACLE 11G-ASMlib工具包:下载地址:/technology/software/tech/linux/asmlib/rhel4.htmloracleasm-2.6.9-42.ELsmp-2.0.3-1.i686.rpmoracleasm-support-2.0.3-1.i386.rpmoracleasmlib-2.0.2-1.i386.rpm2.1.3 系统补丁的下载下载地址:/projects/compat-oracle/files/RedHat/compat-libcwait-2.1-1.i386.rpmcompat-oracle-rhel4-1.0-5.i386.rpm三系统安装配置3.1 系统参数配置3.1.1 关闭没必要的服务chkconfig --level 35 autofs offchkconfig --level 35 acpid offchkconfig –level 35 sendmail offchkconfig –level 35 cups-config-daemon offchkconfig –level 35 cpus offchkconfig –level 35 xfs offchkconfig –level 35 lm_sensors offchkconfig –level gpm offchkconfig –level openibd offchkconfig –level iiim offchkconfig –level pcmcia offchkconfig –level cpuspeed offchkconfig –level nfslock offchkconfig –level ip6tables offchkconfig –level rpcidmapd offchkconfig –level apmd offchkconfig –level sendmail offchkconfig –level arptables_jf offchkconifg –level microcode_ctl offchkconfig –level rpcgssd off3.1.2设置主机表vi /etc/hosts127.0.0.1 localhost.localdomain localhost IP rac1IP racp1IP racv1IP rac2IP racp2IP racv23.1.3 修改内核参数vi /etc/sysctl.confk ernel.shmmax = 536870912kernel.shmmni = 4096kernel.shmall = 2097152kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000net.core.rmem_default = 4194304net.core.rmem_max = 4194304net.core.wmem_default = 4194304net.core.wmem_max = 4194304kernel.panic = 603.1.4设置oracle登录使用资源数vi /etc/security/limits.conforacle soft nofile 65536oracle hard nofile 65536oracle soft nproc 16384oracle hard nproc 16384vi /etc/pam.d/login –末行加入以下session required pam_limits.so multiple open3.1.5建立hangcheck模块加载检测是否安装了hangcheck模块[root@rac1]# find /lib/modules -name "hangcheck-timer.ko"/lib/modules/2.6.9-42.ELsmp/kernel/drivers/char/hangcheck-timer.ko设置模块为自动加载su –echo "options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180" >> /etc/modprobe.conf 或者echo " /sbin/modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180" >> /etc/rc.local 检测模块是否运行su -modprobe hangcheck-timergrep Hangcheck /var/log/messages | tail -23.1.6 禁用selinuxgetseboolgetsebool: SELinux is disabledvi /etc/selinux/configSELINUX=disabled3.1.7 添加oracle用户和用户组mkdir –p /oracle/oraclegroupadd –g 502 dbagroupadd –g 501 oinstalluseradd –g 501 –G 502 –d /oracle/oracle oraclepasswd oraclechown -R oracle.oinstall /oracle/oracle3.1.8 修改主机名vi /etc/sysconfig/networkHOSTNAME=rac1# hostname rac1Rac 2 上同样执行3.2 设置oracle用户vi .bash_profileumask 022export ORACLE_BASE=/oracle/oracleexport ORACLE_HOME=$ORACLE_BASE/product/10.2.0/dbexport ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crsexport ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin #export ORACLE_SID=rac2export ORACLE_SID=rac1export NLS_LANG=AMERICAN_AMERICA.zhs16gbkexport NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/binexport PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/binexport PATH=${PATH}:$ORACLE_BASE/common/oracle/binexport ORACLE_TERM=xtermexport TNS_ADMIN=$ORACLE_HOME/network/adminexport ORA_NLS10=$ORACLE_HOME/nls/dataexport LD_LIBRARY_PATH=$ORACLE_HOME/libexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/libexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/libexport LD_ASSUME_KERNEL=2.4.19 # for RHEL AS 4export CLASSPATH=$ORACLE_HOME/JREexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlibexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlibexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlibexport THREADS_FLAG=nativeexport TEMP=/tmpexport TMPDIR=/tmpif [ $USER = "oracle" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fifi3.3 配置ASM服务3.3.1安装asm包rpm -Uvh oracleasm-2.6.9-42.ELsmp-2.0.3-1.i686.rpm oracleasmlib-2.0.2-1.i386.rpm oracleasm-support-2.0.3-1.i386.rpm安装asm包一定要和系统的内核相对应3.3.2配置asm服务cd /etc/init.d/[root@localhost init.d]# ./oracleasm configureConfiguring the Oracle ASM library driver.This will configure the on-boot properties of the Oracle ASM librarydriver. The following questions will determine whether the driver isloaded on boot and what permissions it will have. The current valueswill be shown in brackets ('[]'). Hitting <ENTER> without typing ananswer will keep that current value. Ctrl-C will abort.Default user to own the driver interface []: oracleDefault group to own the driver interface []: dbaStart Oracle ASM library driver on boot (y/n) [n]: yFix permissions of Oracle ASM disks on boot (y/n) [y]: yWriting Oracle ASM library driver configuration: [ OK ]Creating /dev/oracleasm mount point: [ OK ]Loading module "oracleasm": [ OK ]Mounting ASMlib driver filesystem: [ OK ]Scanning system for ASM disks: [ OK ]3.4 建立ssh等效性(在oracle用户操作)3.4.1 建立相关目录生成密钥和公钥su - oraclemkdir -p ~/.sshchmod 755 ~/.ssh[oracle@rac1 ~]$ /usr/bin/ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/oracle/oracle//.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /oracle/oracle//.ssh/id_rsa.Your public key has been saved in /oracle/oracle//.ssh/id_rsa.pub.The key fingerprint is:16:2b:45:27:24:ee:97:46:5e:72:43:f1:9f:df:4b:dd oracle@rac1[oracle@rac1 ~]$ /usr/bin/ssh-keygen -t dsaGenerating public/private dsa key pair.Enter file in which to save the key (/oracle/oracle//.ssh/id_dsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /oracle/oracle//.ssh/id_dsa.Your public key has been saved in /oracle/oracle//.ssh/id_dsa.pub.The key fingerprint is:0a:d5:e7:6a:a1:11:de:e4:72:74:fc:5f:b2:63:5b:6b oracle@rac1同等在RAC2上建立公钥和私钥3.4.2 建立等效密钥在第一个主机上,以oracle 用户身份登录cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keyscat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keyscp ~/.ssh/authorized_keys ~/.ssh/rac1.authorized_keys第二台主机上,以oracle用户登录cat ~/.ssh/id_ >> ~/.ssh/authorized_keyscat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keyscp ~/.ssh/authorized_keys ~/.ssh/rac2.authorized_keys相互交换公钥scp ~/.ssh/rac1.authorized_keys oracle@IP:scp ~/.ssh/rac2.authorized_keys oracle@IP:RAC2 上执行:cat rac1.authorized_keys >> ~/.ssh/authorized_keysRAC1上执行:cat rac2.authorized_keys >> ~/.ssh/authorized_keys建立等效性(每台机器都执行)ssh rac1ssh rac2ssh racp1ssh racp2exec /usr/bin/ssh-agent $SHELL/usr/bin/ssh-add四配置共享磁盘4.1 建立ISCSI的共享磁盘4.1.1 编译iscsi-target的源包mkdir –p /usr/src/iscsi-targetwget /iscsi/RPMS/iscsitarget-0.4.12-6.src.rpmrpmbuild --rebuild iscsitarget-0.4.12-6.src.rpmrpm -Uvh iscsitarget-kernel-smp-0.4.12-6_2.6.9_42.EL.i386.rpm iscsitarget-0.4.12-6.i386.rpm 4.1.2 建立分区fdisk /dev/sda生成:/dev/sda8fdisk /dev/sdb生成:/dev/sdb14.1.3 配置共享盘I SCSI服务端配置:vi /etc/ietd.conf注释掉所有的其他Target .digicola:storage.lun1IncomingUser gfs secretsecretOutgoingUserLun 0 Path=/dev/sdb1,Type=fileioAlias iDISK0#MaxConnections 6Target .digicola:storage.lun2IncomingUser gfs secretsecretOutgoingUserLun 0 Path=/dev/sda8,Type=fileioAlias iDISK1#MaxConnections 6启动服务:service iscsi-target restart加入开机启动:chkconfig –level 2345 iscsi-target onIscsi客户端配置:vi /etc/iscsi.confDiscoveryAddress=192.168.1.156OutgoingUserName=gfsOutgoingPassword=secretsecretLoginTimeout=15DiscoveryAddress=192.168.1.15启动服务:service iscis restart加入开机启动:chkconfig –level 2345 iscsi on检查:iscsi共享磁盘:[root@rac1 ~]# iscsi-ls*******************************************************************************SFNet iSCSI Driver Version ...4:0.1.11-3(02-May-2006)******************************************************************************* TARGET NAME : .digicola:storage.lun2TARGET ALIAS :HOST ID : 1BUS ID : 0TARGET ID : 0TARGET ADDRESS : 192.168.1.156:3260,1SESSION STATUS : ESTABLISHED AT Thu Oct 25 23:14:52 CST 2007SESSION ID : ISID 00023d000001 TSIH 400注:在从启系统时要注意iscsi-target服务和iscsi服务的启动顺序。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档