这篇文章主要讲解了“Oracle RAC启动归档时怎么设置CLUSTER_DATABASE参数”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Oracle RAC启动归档时怎么设置CLUSTER_DATABASE参数”吧!

结论:

数据库版本Release 9.0.1 to 10.1,启动归档模式需要设置CLUSTER_DATABASE参数。

数据库版本10.2 and higher version,启动归档模式不需要设置CLUSTER_DATABASE参数。

那么CLUSTER_DATABASE参数有什么作用呢?

cluster_database

当想要多个实例同时mount数据库,CLUSTER_DATABASE参数必须是TRUE;

当CLUSTER_DATABASE参数为FALSE时,同时只能有一个实例能mount数据库。

IfOracleDatabaseallowsmultipleinstancestomountthesamedatabaseconcurrently,thentheCLUSTER_DATABASEinitializationparametersettingcanmakethedatabaseavailabletomultipleinstances.Databasebehaviordependsonthesetting:IfCLUSTER_DATABASEisfalse(default)forthefirstinstancethatmountsadatabase,thenonlythisinstancecanmountthedatabase.IfCLUSTER_DATABASEistrueforthefirstinstance,thenotherinstancescanmountthedatabaseiftheirCLUSTER_DATABASEparametersettingsaresettotrue.Thenumberofinstancesthatcanmountthedatabaseissubjecttoapredeterminedmaximumspecifiedwhencreatingthedatabase.

测试启动11.2.0.4.0版本数据库归档模式

查看归档模式

SQL>archiveloglist;DatabaselogmodeNoArchiveModeAutomaticarchivalDisabledArchivedestination/u01/app/oracle/product/11.2.0/db_1/dbs/archOldestonlinelogsequence26Currentlogsequence27

创建归档目录

[grid@rac01~]$asmcmdASMCMD>lsARCH/DATA/OCR/ASMCMD>cdARCHASMCMD>lsASMCMD>mkdirarch

修改归档目录和归档格式

SQL>altersystemsetlog_archive_format='cjcdb_%t_%s_%r.arc'scope=spfilesid='*';SQL>altersystemsetlog_archive_dest_1='location=+ARCH/arch'scope=spfilesid='*';

停止数据库

[oracle@rac01~]$srvctlstopdatabase-dcjcdb[oracle@rac01~]$srvctlstatusdatabase-dcjcdbInstancecjcdb1isnotrunningonnoderac01Instancecjcdb2isnotrunningonnoderac02

挂载数据库

[oracle@rac01~]$srvctlstartdatabase-dcjcdb-omount[oracle@rac01~]$srvctlstatusdatabase-dcjcdb-vInstancecjcdb1isrunningonnoderac01.Instancestatus:Mounted(Closed).Instancecjcdb2isrunningonnoderac02.Instancestatus:Mounted(Closed).

启动归档模式

[oracle@rac01~]$sqlplus/assysdbaSQL>alterdatabasearchivelog;

重启数据库

[oracle@rac01~]$srvctlstopdatabase-dcjcdb[oracle@rac01~]$srvctlstartdatabase-dcjcdb

查看归档

[oracle@rac02~]$sqlplus/assysdbaSQL>archiveloglist;DatabaselogmodeArchiveModeAutomaticarchivalEnabledArchivedestination+ARC/archOldestonlinelogsequence1Nextlogsequencetoarchive2Currentlogsequence2

参考:Doc ID 235158.1和Doc ID 1186764.1

10.1和之前版本启动归档模式

How To Enable/Disable Archive Log Mode in Real Application Cluster Environment (Doc ID 235158.1)

APPLIESTO:OracleDatabase-EnterpriseEdition-Version9.0.1.0to10.1.0.5[Release9.0.1to10.1]Informationinthisdocumentappliestoanyplatform.1.Shutdownallinstances.2.SettheCLUSTER_DATABASEparametertofalseononeinstanceintheparameterfile.Ifusingtheserverparameterfile,makeanentryforthis:*.CLUSTER_DATABASE=FalseForModifyingserverparameterfile(SPFILE):Altersystemsetcluster_database=FALSEscope=spfilesid='*';SeeDocument137483.1HowtoModifytheContentofaSPFILEParameterFile3.SettheLOG_ARCHIVE_STARTparametertotrue.4.SettheLOG_ARCHIVE_FORMATandmakesuretheparametercontainingthe%tparameterincludesthethreadnumberinthearchivedlogfilename.5.SettheclusterdatabasewideLOG_ARCHIVE_DEST_1parameterintheparameterfileasfollows:LOG_ARCHIVE_DEST_1='LOCATION=$ORACLE_BASE/oradata/<db_name>/archive'Note:Youcanmultiplexthedestinationtouptotenlocations,referto:Document66433.1Oracle8i-MultipleArchiveDestinationsandRemoteArchivalTospecifythearchivelogdestinationsonaperinstancebasisforatwo-instanceclusterdatabase,forexample,settheparameterasfollows:<sid1>.LOG_ARCHIVE_DEST_1='LOCATION=$ORACLE_BASE/oradata/<db_name>/archive'<sid2>.LOG_ARCHIVE_DEST_1='LOCATION=$ORACLE_BASE/oradata/<db_name>/archive'6.Mountthedatabase(inexclusivemode)fortheinstanceonwhichyouhavesetCLUSTER_DATABASEtofalse.7.SetthedatabaseinARCHIVELOGmode:SQL>ALTERDATABASEARCHIVELOG;8.Shutdowntheinstance.SQL>SHUTDOWNIMMEDIATE;9.ChangethevalueoftheCLUSTER_DATABASEparameterbacktotrue.10.Startupallinstances.Todisablearchivelogging,followthesamestepsbutusetheNOARCHIVELOGclauseoftheALTERDATABASEstatement.

10.2版本开始启动归档模式

How To Enable/Disable Archive Logging In RAC Environment for 10.2 and higher version (Doc ID 1186764.1)

APPLIESTO:OracleDatabaseCloudService-VersionN/AandlaterOracleDatabase-EnterpriseEdition-Version10.2.0.1andlaterOracleDatabaseCloudSchemaService-VersionN/AandlaterOracleDatabaseExadataExpressCloudService-VersionN/AandlaterOracleDatabaseExadataCloudMachine-VersionN/AandlaterInformationinthisdocumentappliestoanyplatform.SOLUTION1.ThefollowingstepsneedtobetakentoenablearchivelogginginaRACdatabaseenvironment:--shutdownimmediatealldatabaseinstances$srvctlstopdatabase-d<db_unique_name>--startupdatabaseinmountmode$srvctlstartdatabase-d<db_unique_name>-omount--enablearchivelogging$sqlplus/assysdbasql>alterdatabasearchivelog;sql>exit;--stopdatabase$srvctlstopdatabase-d<db_unique_name>--restartalldatabaseinstances$srvctlstartdatabase-d<db_unique_name>--verifyarchivingisenabled/disabledbymeansof:sql>archiveloglist;Youmightneedtosetyourlog_archive_dest(_n)parameterstoasharedlocationineachspfile,butthelog_archive_startparameterdoesnotneedtobesetanymoreasof10g(seeNote274302.1).2.Todisablearchivelogging,followthesamestepsbutusetheNOARCHIVELOGclauseoftheALTERDATABASEstatement.

感谢各位的阅读,以上就是“Oracle RAC启动归档时怎么设置CLUSTER_DATABASE参数”的内容了,经过本文的学习后,相信大家对Oracle RAC启动归档时怎么设置CLUSTER_DATABASE参数这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!