Vbox4.3.8+OEL6.5+Oracle 11.2.0.3安装Oracle Restart 及简单测试

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:46

[font=Tahoma,][size=26px]Vbox4.3.8+OEL6.5+Oracle 11.2.0.3安装Oracle Restart 及简单测试[font=Tahoma,]Oracle Restart是oracle从11g r2开始提供的高可用性单实例数据库,当我们安装完Oracle Restart之后,随着硬件或软件故障或者你的数据库服务器重启,Oracle各种组件也将会自动重启。组件里都包括Database instance、Oracle Net listener、Database services、ASM instance、Oracle ASM disk groups、Oracle Notification Services (ONS)等。Oracle Restart会周期检查这些组件的健康状态,如果检测到失败的组件,那oracle Restart就将这个组件关闭再重启。Oracle Restart也是借助于Grid Infrastructure(GI)的核心组件Clusterware来提供高可用特性,另外通过standalon server环境又可以使用ASM特性。那更详细得说一下startup,Oracle Restart确保Oracle组件顺序启动,比如,如果使用了ASM特性,数据文件存放在ASM磁盘组上,那么在数据库实例启动之前,Oracle Restart将确保ASM实例先启动,然后关联的磁盘组都挂载上。同样地,关闭的时候是关联的组件先都shutdown。Oracle的监听也是被自动管理对象,当数据库实例启动之后,Oracle Restart也将监听启动,这不需要人工干预。既然Oracle Restart是借助于GI的,那么想当然地也提供经典的命令SRVCTL(控制服务的工具),我们可以利用SRVCTL对Oracle的组件进行手动操作,比如关闭、启动、查看状态等等。当Oracle Restart已经投入到生产使用之后,Oracle建议使用SRVCTL手动管理各种组件。另外,在我们使用SRVCTL手动关闭组件之后,Oracle Restart不再自动特性了,比如你手动关闭了监听器,那么它也不会自动启动。等我们再使用SRVCTL启动了组件,它又恢复自动特性。Oracle Restart也整合了SQL*Plus、LSNRCTL、ASMCMD等工具,比如你通过SQL*Plus关闭实例,Oracle Restart认为这是合法的,不会尝试重启实例。类似的,ASM实例通过SQL*Plus或者ASMCMD关闭之后,也不会尝试重新启动。上面一直说了对Oracle组件的管理,那么下面就看Oracle Restart的启动和关闭。使用过RAC的人都知道管理集群件非常好用的工具 — CRSCTL。Oracle Restart也可以使用CRSCTL来激活或者禁用Oracle高可用性,而上面谈的Oracle组件的管理都是基于这个高可用特性的。如果ORACLE高可用服务被禁用,那么任何一个组件都不会被Oracle Restart管理,也就是节点重启后不会被自动起来。另外,在我们需要Apply Patch或者进行OS维护,也需要使用crsctl关闭Oracle Restart。
------------------------------------------------------------------------------------------------------------------------------------------------------以上摘自网络
安装步骤:
1、 环境:

VM:Vbox 4.3.8 OS : OracleEnterprise Linux 6.5 64bit DB : GI andDatabase 11.2.0.32、资源: OS: Oracle_Enterprise-R6-U5-Server-x86_64-dvd.iso DB: p10404530_112030_Linux-x86-64_1of7.zip p10404530_112030_Linux-x86-64_2of7.zip GI: p10404530_112030_Linux-x86-64_3of7.zip PG: oracleasm-support-2.1.7-1.el5.x86_64.rpm asm需要的包 Tool: rlwrap-0.37-1.el5.x86_64.rpm --可以使sqlplus 像bash一样支持退格,删除,上下翻动等。 Xmanager 3—图形界面工具 Putty—远程连接linux工具 3、安装操作系统: 1)虚拟机规划 虚拟机: 空间 – 20G以上 内存 – 3G以上。 因为要跑linux、grid、oracle 分区: /boot – 200M Swap – 3072M / – 剩余空间 添加三块虚拟盘,装linux时可以先不要分区。 CRS 2G DATA 6G ARCH 4G 虚拟机网络为HOST ONLY模式 Linux安装模式:minimual安装 (250个包,需要别的时候打上)IP: 192.168.1.138--manual配置完IP,勾上on reboot,不然默认不启动网卡,需要改配置文件。Vbox支持共享文件夹:需要安装:# yum isntall –y kernel*# mkdir /gd –共享文件夹# mount –t vboxsf 文件夹名称(虚拟机配置时设定的) /gd 2)配置YUM源# mkdir /oel65 –yum源文件夹 # vi/etc/yum.repos.d/oel65.repo [oel65] name=oel65 baseurl=[color=#26709a]file:///oel65/Server]file:///oel65/Server gpgcheck=0 enabled=1# mount /dev/cdrom /oel65 注:配置前将/etc/yum.repos.d下面的文件删除或者移动到别的目录下。# yum -y install –y oracle-rdbms* -oel中这个包可以帮助你自动安装需要的包,配置需要的内核参数 其他的linux版本按以下步骤配置 3)参数修改 # cat>> /etc/sysctl.conf << EOF fs.aio-max-nr = 1048576 fs.file-max= 6815744 kernel.shmall = 2097152 kernel.shmmni = 4096 kernel.sem =250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 EOF # /sbin/sysctl-p # cat >>/etc/profile <>/etc/security/limits.conf <>/etc/pam.d/login << EOF sessionrequired /lib64/security/pam_limits.so EOF4)添加组和用户 groupadd -g1000 oinstall groupadd -g1300 dba groupadd -g1301 oper groupadd -g1201 asmdba groupadd -g1200 asmadmin groupadd -g1202 asmoper useradd -m -u1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash-c "Grid Infrastructure Owner" grid passwd grid useradd -m -u1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c"Oracle Software Owner" oracle passwd oracle 这里注意grid用户必须加入到dba组里。5)创建目录、授权 mkdir -p/u01/app/grid mkdir -p/u01/app/11.2.0/grid chown -Rgrid:oinstall /u01 mkdir -p/u01/app/oracle chownoracle:oinstall /u01/app/oracle chmod -R 775/u016)环境变量 $ whoami grid $ vi.bash_profile aliasls="ll -at" ORACLE_SID=+ASM; export ORACLE_SID JAVA_HOME=/usr/local/java;export JAVA_HOME ORACLE_BASE=/u01/app/grid; export ORACLE_BASE ORACLE_HOME=/u01/app/11.2.0/grid; exportORACLE_HOME ORACLE_PATH=/u01/app/oracle/common/oracle/sql;export ORACLE_PATH ORACLE_TERM=xterm;export ORACLE_TERM NLS_DATE_FORMAT="YYYY-MM-DDHH24:MI:SS";export NLS_DATE_FORMAT TNS_ADMIN=$ORACLE_HOME/network/admin; exportTNS_ADMIN ORA_NLS11=$ORACLE_HOME/nls/data; exportORA_NLS11 PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin PATH=${PATH}:/u01/app/common/oracle/bin export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib exportLD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib exportCLASSPATH THREADS_FLAG=native; export THREADS_FLAG exportTEMP=/tmp exportTMPDIR=/tmp exportNLS_LANG=american_america.ZHS16GBK aliassqlplus="rlwrap sqlplus" umask 022 $ whoami oracle $ vi.bash_profile aliasls="ll -at" ORACLE_SID=restart; export ORACLE_SID ORACLE_UNQNAME=restart; export ORACLE_UNQNAME JAVA_HOME=/usr/local/java; export JAVA_HOME ORACLE_BASE=/u01/app/oracle; exportORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;export ORACLE_HOME ORACLE_PATH=/u01/app/common/oracle/sql; exportORACLE_PATH ORACLE_TERM=xterm; export ORACLE_TERM NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMAT TNS_ADMIN=$ORACLE_HOME/network/admin; exportTNS_ADMIN ORA_NLS11=$ORACLE_HOME/nls/data; exportORA_NLS11 PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin PATH=${PATH}:/u01/app/common/oracle/bin export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib exportLD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib exportCLASSPATH THREADS_FLAG=native; export THREADS_FLAG exportTEMP=/tmp exportTMPDIR=/tmp exportNLS_LANG=AMERICAN_AMERICA.ZHS16GBK umask 022 aliassqlplus="rlwrap sqlplus" aliasrman="rlwrap rman"7)分区# fdisk /dev/sdbDevice contains neither a valid DOS partition table,nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain inmemory only,until you decide to write them. After that, ofcourse, the previouscontent won't be recoverable.Warning: invalid flag 0×0000 of partition table 4will be corrected by w(rite)Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-1009, default 1): 10Last cylinder or +size or +sizeM or +sizeK (10-1009,default 1009):Using default value 1009Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks. 类似的,其他的磁盘也格式化 # fdisk/dev/sd[b-d]查看# fdisk -l8)创建ASM磁盘# rpm –ivh oracleasm*# /etc/init.d/oracleasm configureDefault user to own the driver interface []: gridDefault group to own the driver interface []:asmadminStart Oracle ASM library driver on boot (y/n) [n]: yScan for Oracle ASM disks on boot (y/n) [y]: y# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1 9)上传软件并解压或者 使用vbox共享文件夹 # mkdir /gd –共享文件夹# mount –t vboxsf 文件夹名称(虚拟机配置时设定的) /gd # chown -R grid.oinstall /install/# su – grid$ unzip p10404530_112030_Linux-x86-64_3of7.zip# chmod 775 /install$ chown oracle.oinstall/install/p10404530_112030_Linux-x86-64_[1,2]of7.zip# su – oracle$ unzip p10404530_112030_Linux-x86-64_1of7.zip$ unzip p10404530_112030_Linux-x86-64_2of7.zip 10)安装GI本机打开Xmanager – Passive# su – grid$ cd /install/grid/$ export DISPLAY=192.168.1.10:0.0$ ./runInstaller [root@restart install]#/u01/app/oraInventory/orainstRoot.shChanging permissions of /u01/app/oraInventory.Adding read,write permissions for group.Removing read,write,execute permissions for world.Changing groupname of /u01/app/oraInventory tooinstall.The execution of the script is complete.[root@restart install]# /u01/app/11.2.0/grid/root.shPerforming root user operation for Oracle 11gThe following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/11.2.0/gridEnter the full pathname of the local bin directory:[/usr/local/bin]: Copyingdbhome to /usr/local/bin … Copyingoraenv to /usr/local/bin … Copyingcoraenv to /usr/local/bin … Creating /etc/oratab file…Entries will be added to the /etc/oratab file asneeded byDatabase Configuration Assistant when a database iscreatedFinished running generic part of root script.Now product-specific root actions will be performed.Using configuration parameter file:/u01/app/11.2.0/grid/crs/install/crsconfig_paramsCreating trace directoryLOCAL ADD MODECreating OCR keys for user 'grid', privgrp'oinstall'..Operation successful.LOCAL ONLY MODESuccessfully accumulated necessary OCR keys.Creating OCR keys for user 'root', privgrp 'root'..Operation successful.CRS-4664: Node restart successfully pinned.Adding Clusterware entries to inittabrestart 2012/08/02 19:47:18 /u01/app/11.2.0/grid/cdata/restart/backup_20120802_194718.olrSuccessfully configured Oracle Grid Infrastructurefor a Standalone Server2)安装database software# su – oracle$ cd /install/database/$ export DISPLAY=192.168.77.97:0.0$ ./runInstaller [root@restart ~]#/u01/app/oracle/product/11.2.0/dbhome_1/root.shPerforming root user operation for Oracle 11gThe following environment variables are set as: ORACLE_OWNER=oracle ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1Enter the full pathname of the local bin directory:[/usr/local/bin]:The contents of "dbhome" have not changed.No need to overwrite.The contents of "oraenv" have not changed.No need to overwrite.The contents of "coraenv" have not changed.No need to overwrite.Entries will be added to the /etc/oratab file asneeded byDatabase Configuration Assistant when a database iscreatedFinished running generic part of root script.Now product-specific root actions will be performed.Finished product-specific root actions.3)创建ASM磁盘组# su – grid$ asmca 4)安装database# su – oracle$ dbca 5)检查# su – grid[grid@11gASM ~]$ crs_stat -t Name Type Target State Host ————————————————————ora.CRS.dg ora….up.type ONLINE ONLINE 11gASM ora….ER.lsnr ora….er.type ONLINE ONLINE 11gASM ora.asm ora.asm.type ONLINE ONLINE 11gASM ora.cssd ora.cssd.type ONLINE ONLINE 11gASM ora.diskmon ora….on.type OFFLINE OFFLINE ora.evmd ora.evm.type ONLINE ONLINE 11gASM ora.ons ora.ons.type OFFLINE OFFLINE [grid@restart ~]$ ps -ef | grep asmgrid 16058 1 0 19:56 ? 00:00:00 asm_pmon_+ASMgrid 16060 1 0 19:56 ? 00:00:00 asm_psp0_+ASMgrid 16062 1 0 19:56 ? 00:00:00 asm_vktm_+ASMgrid 16066 1 0 19:56 ? 00:00:00 asm_gen0_+ASMgrid 16068 1 0 19:56 ? 00:00:00 asm_diag_+ASMgrid 16070 1 0 19:56 ? 00:00:00 asm_dia0_+ASMgrid 16072 1 0 19:56 ? 00:00:00 asm_mman_+ASMgrid 16074 1 0 19:56 ? 00:00:00 asm_dbw0_+ASMgrid 16076 1 0 19:56 ? 00:00:00 asm_lgwr_+ASMgrid 16078 1 0 19:56 ? 00:00:00 asm_ckpt_+ASMgrid 16080 1 0 19:56 ? 00:00:00 asm_smon_+ASMgrid 16082 1 0 19:56 ? 00:00:00 asm_rbal_+ASMgrid 16084 1 0 19:56 ? 00:00:00 asm_gmon_+ASMgrid 16086 1 0 19:56 ? 00:00:00 asm_mmon_+ASMgrid 16088 1 0 19:56 ? 00:00:00 asm_mmnl_+ASMgrid 1618816152 0 19:59 pts/1 00:00:00 grep asmSQL> select name from v$datafile 2 union all 3 select name from v$controlfile 4 union all 5 select member from v$logfile;NAME--------------------------------------------------------------------------------+DATA/restart/datafile/system.256.841618007+DATA/restart/datafile/sysaux.257.841618007+DATA/restart/datafile/undotbs1.258.841618007+DATA/restart/datafile/users.259.841618007+DATA/restart/controlfile/current.260.841618161+DATA/restart/onlinelog/group_3.263.841618171+DATA/restart/onlinelog/group_2.262.841618167+DATA/restart/onlinelog/group_1.261.841618163SQL> archive log listDatabase log mode No Archive ModeAutomatic archival DisabledArchive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/archOldest online log sequence 5Current log sequence 7
开启归档模式SQL> create pfile='/u01/pfile-0308.bak' fromspfile;File created.SQL> alter system setlog_archive_dest_1='LOCATION=+ARCH';System altered.SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startup mountORACLE instance started.Total System Global Area 839282688 bytesFixed Size 2233000 bytesVariable Size 528485720 bytesDatabase Buffers 306184192 bytesRedo Buffers 2379776 bytesDatabase mounted.SQL> alter database archivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination +ARCHOldest online log sequence 36Next log sequence to archive 38Current log sequence 38 SQL> select name from v$archived_log;no rows selectedSQL> alter system switch logfile;System altered.SQL> select name from v$archived_log;NAME——————————————————————————–+ARCH/restart/archivelog/2014_03_08/thread_1_seq_7.256.841680617
以监听为例用srvctl 关闭启动测试:[grid@restart ~]$ srvctl status listenerListener LISTENER is enabledListener LISTENER is running on node(s): restart[grid@restart ~]$ srvctl stop listener[grid@restart ~]$ srvctl status listenerListener LISTENER is enabledListener LISTENER is not running[grid@restart ~]$ srvctl start listener
再测试kill监听进程,看能否自动起来。[grid@restart ~]$ ps -ef | grep lsnrgrid 28139 1 0 21:43 ? 00:00:00/u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inheritgrid 2832528251 0 21:46 pts/1 00:00:00 grep lsnr[grid@restart ~]$ kill -9 28139过几秒钟后他就起来,因为这中间有监控进程的时间段[grid@restart ~]$ ps -ef | grep lsnrgrid 28455 1 0 21:47 ? 00:00:00/u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inheritgrid 2846928251 0 21:47 pts/1 00:00:00 grep lsnr好,最后测试硬性重启之后看ORACLE能不能自动起来# reboot系统起来稍等之后:[root@restart bin]# ./crs_stat -tName Type Target State Host ————————————————————ora.CRS.dg ora….up.type ONLINE ONLINE 11gASM ora….ER.lsnr ora….er.type ONLINE ONLINE 11gASM ora.asm ora.asm.type ONLINE ONLINE 11gASM ora.cssd ora.cssd.type ONLINE ONLINE 11gASM ora.diskmon ora….on.type OFFLINE OFFLINE ora.evmd ora.evm.type ONLINE ONLINE 11gASM ora.ons ora.ons.type OFFLINE OFFLINE

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】