Вы находитесь на странице: 1из 44

OracleDatabase11gRelease2(11.2.0.3.

0)
RACOnCentos6.3UsingVirtualBox
CreatedbyMoin:PTRTECHNOLOGY

Architectureofrac

AllconfigurationshouldbedoneonbothRAC1nodeandRAC2
node(Gridinstallationanddatabasecreationshoulddoneinone
node):
============================================

A)AddNodesEntry
B)RestartNetworkServices
C)Adddisksforasminstorage
D)ConfigureOracleAutomaticStorageManagement(ASM)
E)ClusterVerificationUtility
F)GridInstallation
G)ClusterServicesVerification
H)DatabasesSoftwareInstallation(Oracle11gR2)
I)DatabaseCreation

StepsAreasfollows:
======
optional(Itsrequiredonlyatthetimeofyumfailstoinstallany
package)
======
#cd/etc/yum.repos.d
#wgethttps://publicyum.oracle.com/publicyumol6.repo
==========================
Generatekey

#wgethttp://publicyum.oracle.com/RPMGPGKEYoracleol6O
/etc/pki/rpmgpg/RPMGPGKEYoracle
=================================================
OracleInstallationPrerequisites
===========================
#yuminstalloraclerdbmsserver11gR2preinstall
#yumupdate
=======================================
Createthenewgroupsandusers
===========================
#groupaddg1000oinstall
#groupaddg1200asmadmin
#groupaddg1201asmdba
#groupaddg1202asmoper
#groupaddg1200dba
#useraddu1100goinstallGdbaoracle
#passwdoracle

=============
IfyouarenotusingDNS,the"/etc/hosts"filemustcontainthe
followinginformation
#vi/etc/hosts
127.0.0.1localhost.localdomainlocalhost
#Public
192.168.0.111ol6112rac1.localdomainol6112rac1
192.168.0.112ol6112rac2.localdomainol6112rac2
#Private
192.168.1.111ol6112rac1priv.localdomainol6112rac1priv
192.168.1.112ol6112rac2priv.localdomainol6112rac2priv
#Virtual
192.168.0.113ol6112rac1vip.localdomainol6112rac1vip
192.168.0.114ol6112rac2vip.localdomainol6112rac2vip
#SCAN
192.168.0.115ol6112scan.localdomainol6112scan
192.168.0.116ol6112scan.localdomainol6112scan
192.168.0.117ol6112scan.localdomainol6112scan

#Servicenetworkrestart
===========================
Selinuxshouldbedisabled
====
#vi/etc/selinux/config(Selinuxdisableit)
==================================
IfyouhavetheLinuxfirewallenabled,youwillneedtodisable
===================
#serviceiptablesstop(Forguimode#systemconfigfirewall&)
#chkconfigiptablesoff
===================
CreatethedirectoriesinwhichtheOraclesoftwarewillbeinstalled
===================
#mkdirp/u01/app/11.2.0.3/grid
#mkdirp/u01/app/oracle/product/11.2.0.3/db_1
#chownRoracle:oinstall/u01
#chmodR775/u01/


====================
Loginasthe"oracle"userandaddthefollowinglinesattheendof
the"/home/oracle/.bash_profile"file
=============================

ORACLE_HOSTNAME=ol6112rac1.localdomainexport
ORACLE_HOSTNAME
ORACLE_UNQNAME=RACexportORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracleexportORACLE_BASE
GRID_HOME=/u01/app/11.2.0.3/gridexportGRID_HOME
DB_HOME=$ORACLE_BASE/product/11.2.0.3/db_1export
DB_HOME
ORACLE_HOME=$DB_HOMEexportORACLE_HOME
ORACLE_SID=RAC1exportORACLE_SID
ORACLE_TERM=xtermexportORACLE_TERM
BASE_PATH=/usr/sbin:$PATHexportBASE_PATH
PATH=$ORACLE_HOME/bin:$BASE_PATHexportPATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport
LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORAC
LE_HOME/rdbms/jlibexportCLASSPATH

aliasgrid_env='./home/oracle/grid_env'
aliasdb_env='./home/oracle/db_env'

===============================================
Createafilecalled"/home/oracle/grid_env"withthefollowing
contents.
=======

ORACLE_SID=+ASM1exportORACLE_SID
ORACLE_HOME=$GRID_HOMEexportORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_PATHexportPATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport
LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORAC
LE_HOME/rdbms/jlibexportCLASSPATH

=====================
Createafilecalled"/home/oracle/db_env"withthefollowing
contents.
========

ORACLE_SID=RAC1exportORACLE_SID
ORACLE_HOME=$DB_HOMEexportORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_PATHexportPATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport
LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORAC
LE_HOME/rdbms/jlibexportCLASSPATH

========================================================
Oncethe"/home/oracle/grid_env"hasbeenrun,youwillbeableto
switchbetweenenvironmentsasfollows
==================================

$grid_env
$echo$ORACLE_HOME
/u01/app/11.2.0.3/grid
$db_env
$echo$ORACLE_HOME
/u01/app/oracle/product/11.2.0.3/db_1
================================
We'vemadealotofchanges,soit'sworthdoingarebootoftheVM
atthispointtomakesureallthechangeshavetakeneffect.
==========
#shutdownrnow
===============
Adddisksforasminstorage

======================================================
ConfigureOracleAutomaticStorageManagement(ASM)forRedhat
6.3
==============================
#rpmqa|greporacleasm(Checkrequiredpackages)
#yuminstallkmodoracleasm2.0.6.rh12.el6.x86_64
#yuminstalloracleasmlib2.0.41.el6.x86_64
#yuminstalloracleasmsupport2.1.81.el6.x86_64
#/etc/init.d/oracleasmconfigure(Ifyougetkernelerrorthenfollow
thisstepifnotcontinue)
#oracleasmupdatedriver
#yuminstallkerneluekkerneluekdevelkerneluekheaders
kerneluekfirmware+
#/etc/init.d/oracleasmrestart

#modprobeoracleasm


Itstimetosetupthedisks.Asyousawinthepreviousscreenshot,i
havethreeadditionaldisksnamed(/dev/sdb,/dev/sdc,/dev/sdd)we
needtopartitioneachdisksinordertomakethemavailableforASM.
Wewillusefdisktopartitionthem,hereistheorderyoullhaveto
follow.
1. fdisk/dev/sdb
2. n,p,1,1,w
3. fdisk/dev/sdc
4. n,p,1,1,w
5. fdisk/dev/sdd
6. n,p,1,1,w
Hereishowitlookslike:

Letscheckagainourdisks.Youwillnoticethat3moredevices
appear,thosearethepartitionwecreated.


NextletsdisableSELinuxasfollowsvi/etc/selinux/config

CreateyourASMdisksasfollows
oracleasmcreatediskDISK1/dev/sdb1
oracleasmcreatediskDISK2/dev/sdc1
oracleasmcreatediskDISK3/dev/sdd1

======================================================
SshconnectivitybetweenRAC1andRAC2Nodes(Followsame
procedureonbothsides):
===========================================
Fororacleuser:
Permissionshouldsetonbothside(#chmod755/root#chmod775
/home#chmodR700/home/oracle)
#step1:sshkeygentrsa
#step2:sshcopyidi/home/oracle/.ssh/id_rsa.puboracle@ptrrac2
#step3:sshoracle@ptrrac2
========================================================
InstalltheGridInfrastructure:
=============================
(Torundisplayweneeddobelowstep
root@Rac1:#xhost+
#suoracle
oracle@Rac1:#xhostlocalhost)

$cd/home/linux64_grid
$./runInstaller.sh

Selectthe"InstallandConfigureOracleGridInfrastructurefora
Cluster"option,thenclickthe"Next"button.


Selectthe"TypicalInstallation"option,thenclickthe"Next"button.

Onthe"SpecifyClusterConfiguration"screen,enterthecorrect
SCANNameandclickthe"Add"button.

Enterthedetailsofthesecondnodeinthecluster,thenclickthe
"OK"button.


Clickthe"SSHConnectivity..."buttonandenterthepasswordforthe
"oracle"user.Clickthe"Setup"buttontotoconfigureSSH
connectivity,andthe"Test"buttontotestitonceitiscomplete.

Clickthe"Identifynetworkinterfaces..."buttonandcheckthepublic
andprivatenetworksarespecifiedcorrectly.Onceyouarehappy
withthem,clickthe"OK"buttonandthe"Next"buttononthe
previousscreen.

Enter"/u01/app/11.2.0.3/grid"asthesoftwarelocationand
"AutomaticStorageManager"astheclusterregistrystoragetype.
EntertheASMpassword,select"dba"asthegroupandclickthe
"Next"button.

Settheredundancyto"External",clickthe"ChangeDiscoveryPath"
buttonandsetthepathto"/dev/asm*".Returnthemainscreenand
selectall4disksandclickthe"Next"button.

Acceptthedefaultinventorydirectorybyclickingthe"Next"button.

Waitwhiletheprerequisitecheckscomplete.Ifyouhaveanyissues,
eitherfixthemorcheckthe"IgnoreAll"checkboxandclickthe
"Next"button.

Ifyouarehappywiththesummaryinformation,clickthe"Install"
button.

Waitwhilethesetuptakesplace.
1111111111111

Whenprompted,runtheconfigurationscriptsoneachnode.


Theoutputfromthe"orainstRoot.sh"fileshouldlooksomethinglike
thatlistedbelow.
#cd/u01/app/oraInventory
#./orainstRoot.sh
Changingpermissionsof/u01/app/oraInventory.
Addingread,writepermissionsforgroup.
Removingread,write,executepermissionsforworld.

Changinggroupnameof/u01/app/oraInventorytooinstall.
Theexecutionofthescriptiscomplete.
#
Theoutputoftheroot.shwillvaryalittledependingonthenodeitis
runon.Exampleoutputcanbeseenhere( Node1,

Node2
).
Oncethescriptshavecompleted,returntothe"Execute
ConfigurationScripts"screenon"rac1"andclickthe"OK"button.
===============================

FOROHASDERROR
====================================================
Hello,
Problemisindeedbecauseofupstart/initincompatibility.Hereis
theworkingway:
1)Proceedwiththeinstallationasusualuntilroot.shinvocation.
2)Beforeroot.shedit$GRID_HOME/crs/install/s_crsconfig_lib.pm,
gotoline1173(youshouldfindacodelike:if($srveq"ohasd"){#
StartOHASD).
3)InsertafollowingsnippetbeforestartingOHASDpartIadded
thecodesnippetafterthisline:

system("$INITq")

<addedcodehere>

#StartOHASD

$status=system("$CRSCTLstarthas")
}elsif($srveq"crsexcl"){
trace("StartingOracleclusterwareexclusive")
=============================================


CODEsnippet
============
my$UPSTART_OHASD_SERVICE="oracleohasd"
my$INITCTL="/sbin/initctl"

($status,@output)=system_cmd_capture("$INITCTLstart
$UPSTART_OHASD_SERVICE")
if(0!=$status)
{
error("Failedtostart$UPSTART_OHASD_SERVICE,error:$!")
return$FAILED
}
=================================================
4)Createafile/etc/init/oracleohasd.confwiththefollowing
contentinside

#OracleOHASDstartup

startonrunlevel[35]
stoponrunlevel[!35]
respawn
exec/etc/init.d/init.ohasdrun>/dev/null2>&1</dev/null

5)Invokeroot.sh
6)Finishtheinstallation.

Ifyoupreviouslyranroot.sh(notsuccessfully),simplyrollitback:
$GRID_HOME/crs/install/roothas.pldeconfigforceverbose
Makechangesaboveandcontinue.

Waitfortheconfigurationassistantstocomplete.



Weexpecttheverificationphasetofailwithanerrorrelatingtothe
SCAN,assumingyouarenotusingDNS.
INFO:CheckingSingleClientAccessName(SCAN)...
INFO:Checkingnameresolutionsetupfor"racscan.localdomain"...
INFO:ERROR:
INFO:PRVF4664:Foundinconsistentnameresolutionentriesfor
SCANname"racscan.localdomain"
INFO:ERROR:
INFO:PRVF4657:Nameresolutionsetupcheckfor
"racscan.localdomain"(IPaddress:192.168.2.201)failed
INFO:ERROR:
INFO:PRVF4664:Foundinconsistentnameresolutionentriesfor
SCANname"racscan.localdomain"
INFO:VerificationofSCANVIPandListenersetupfailed
Providedthisistheonlyerror,itissafetoignorethisandcontinue
byclickingthe"Next"button.
Clickthe"Close"buttontoexittheinstaller.

Thegridinfrastructureinstallationisnowcomplete.

InstalltheDatabase
Makesurethe"ol6112rac1"and"ol6112rac2"virtualmachinesare
started,thenloginto"ol6112rac1"astheoracleuserandstartthe
Oracleinstaller.
$cd/host/software/oracle/11gR2/11.2.0.3.0/linux64_database
$./runInstaller
Uncheckthesecurityupdatescheckboxandclickthe"Next"button
and"Yes"onthesubsequentwarningdialog.

Checkthe"Skipsoftwareupdates"checkboxandclickthe"Next"
button.

Acceptthe"Createandconfigureadatabase"optionbyclickingthe
"Next"button.

Acceptthe"ServerClass"optionbyclickingthe"Next"button.

Makesurebothnodesareselected,thenclickthe"Next"button.

Acceptthe"Typicalinstall"optionbyclickingthe"Next"button.

Enter"/u01/app/oracle/product/11.2.0.3/db_1"forthesoftware
location.Thestoragetypeshouldbesetto"AutomaticStorage
Manager".Entertheappropriatepasswordsanddatabasename,in
thiscase"RAC.localdomain".

Waitfortheprerequisitechecktocomplete.Ifthereareany
problemseitherfixthem,orcheckthe"IgnoreAll"checkboxand
clickthe"Next"button.

Ifyouarehappywiththesummaryinformation,clickthe"Install"
button.

Waitwhiletheinstallationtakesplace.

OncethesoftwareinstallationiscompletetheDatabase
ConfigurationAssistant(DBCA)willstartautomatically.


OncetheDatabaseConfigurationAssistant(DBCA)hasfinished,
clickthe"OK"button.

Whenprompted,runtheconfigurationscriptsoneachnode.When
thescriptshavebeenrunoneachnode,clickthe"OK"button.


Clickthe"Close"buttontoexittheinstaller.

=====TheRACdatabasecreationisnowcomplete.============
TheRACdatabasecreationisnowcomplete.
=================
Thesrvctlutilityshowsthecurrentconfigurationandstatusofthe
RACdatabase.
=============

$srvctlconfigdatabasedRAC
Databaseuniquename:RAC
Databasename:RAC
Oraclehome:/u01/app/oracle/product/11.2.0.3/db_1
Oracleuser:oracle
Spfile:+DATA/RAC/spfileRAC.ora
Domain:localdomain
Startoptions:open
Stopoptions:immediate
Databaserole:PRIMARY
Managementpolicy:AUTOMATIC
Serverpools:RAC
Databaseinstances:RAC2,RAC1
DiskGroups:DATA
Mountpointpaths:
Services:
Type:RAC
Databaseisadministratormanaged
$

$srvctlstatusdatabasedRAC
InstanceRAC1isrunningonnodeol6112rac1
InstanceRAC2isrunningonnodeol6112rac2
$

TheV$ACTIVE_INSTANCESviewcanalsodisplaythecurrentstatus
oftheinstances.
sqlplus/assysdba

SQL*Plus:Release11.2.0.3.0ProductiononTueSep2722:20:14
2011

Copyright(c)1982,2011,Oracle.Allrightsreserved.

Connectedto:
OracleDatabase11gEnterpriseEditionRelease11.2.0.3.064bit
Production
WiththePartitioning,RealApplicationClusters,AutomaticStorage
Management,OLAP,
DataMiningandRealApplicationTestingoptions

SQL>SELECTinst_nameFROMv$active_instances

INST_NAME

ol6112rac1.localdomain:RAC1
ol6112rac2.localdomain:RAC2

SQL>

OnthenodewhereCRSisnotgettingstarted:
crsctlstopcrsf
checknoCRSprocessesarerunning(pgrepld.bin)
crsctlstartcrs

Tocheckstatus,startwith
crsctlstatrestinit
crsctlstatrest

IfyouhaveconfiguredEnterpriseManager,itcanbeusedtoview
theconfigurationandcurrentstatusofthedatabaseusingaURLlike
"https://ol6112rac1.localdomain:1158/em".

Оценить