185
Obeth, Sadock Nyaluke My own blog in IT Systems Administration: Together We Learn!!! Classic Home Oracle DB SQL Server DB Oracle 12c DB Heterogeneous Services

Audit Vault

  • Upload
    tuancoi

  • View
    31

  • Download
    4

Embed Size (px)

DESCRIPTION

Audit Vault

Citation preview

Obeth, Sadock NyalukeMy own blog in IT Systems Administration: Together We Learn!!!

Classic Home Oracle DB SQL Server DB Oracle 12c DB Heterogeneous Services My Resume1. FEB3

Using RMAN Backups to Perform Disaster Recovery Following Server or Storage Crush beyond Repair

Disaster implies the loss of the entire target database, the recovery catalog database, and all current control files, all online redo log files, and all parameter files following server or storage crush beyond repair

At minimum to successful perform a disaster recovery, you must have the followingBackups of all datafilesCorresponding archived redo logs filesAt least one control file autobackupA record of the DBID of the database

Assumption:This scenario assumes that the Linux server on which your database was running has been damaged beyond repair. Fortunately, you have necessary backups to restore your database. The scenario assumes the following:Oracle Database Software is already installed on the new hostThe new Linux host has different directory structure as the old hostYou are not using recovery catalog with the database

How to Go AboutGet DBID of the DatabaseRestoring SPFILE from AutobackupsEdit the Restored SPFILERestoring ControlFile from AutobackupsCatalog Backup FilesGet the Structure of Datafiles and Redo LogPrepare and Execute the Restoration ScriptRecover the Database InstanceOpen the Database with RESETLOGS Option

Get DBID of the DatabaseYou must set DBID prior to execute the command to restore the SPFILE and ControlFile from autobackups. It is the best practice to keep in the safe place a record of DBID of your database. Alternatively if you have autobackup of control file created with substitution variable%Fin theFORMATclause you can find the DBID of the database. The variable%Fis translated intoc-IIIIIIIIII-YYYYMMDD-QQwhereIIIIIIIIis the DBIDYYYYMMDDis a time stamp of the day the backup is generatedQQis the hex sequence that starts with 00 and has a maximum of FF

Example: The DBID in these control file autobackup is 132566208[oracle@Lugao-srv03 OraBkps]$ lsbackupsetpcbdbcf_c-132566208-20150202-07oldpcbdbcf_c-132566208-20150202-09[oracle@Lugao-srv03 OraBkps]$

Restoring SPFILE from AutobackupsTo restore the SPFILE from Autobackups, set ORACLE_SID environmental variable, start RMAN by connecting to the target database, set the DBID of the database then start the database instance in nomount state using dummy parameter file[oracle@Lugao-srv03 ~]$ export ORACLE_SID=PCBDB[oracle@Lugao-srv03 ~]$ rman target/

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Feb 2 19:38:57 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates.All rights reserved.

connected to target database (not started)

RMAN> set dbid 132566208;

executing command: SET DBID

RMAN> startup nomount;

startup failed: ORA-01078: failure in processing system parametersLRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPCBDB.ora'

starting Oracle instance without parameter file for retrieval of spfileOracle instance started

Total System Global Area159019008 bytes

Fixed Size1335192 bytesVariable Size75497576 bytesDatabase Buffers79691776 bytesRedo Buffers2494464 bytes

Set RMANCONTROLFILE AUTOBACKUP FORMATparameter to the format mode used during control file auto backup before you runRESTORE SPFILE FROM AUTOBACKUPcommand. It important you have kept these RMAN information in safe place as part of your backup and recovery strategy for the smooth disaster recover.RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/OraBkps/pcbdbcf_%F';

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

RMAN> RESTORE SPFILE FROM AUTOBACKUP;

Starting restore at 02-FEB-15using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150202channel ORA_DISK_1: AUTOBACKUP found: /u01/OraBkps/pcbdbcf_c-132566208-20150202-09channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/OraBkps/pcbdbcf_c-132566208-20150202-09channel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 02-FEB-15

Edit the Restored SPFILEAfter restoration of SPFILE from autobackup you need to edit some setting to reflect the new environment because it possible that the structure of the new server is not the same as the old server. So shutdown the nomounted database instance then export the binary SPFILE settings to text PFILE as followsRMAN> shutdown immediate;

Oracle instance shut down

RMAN>

[oracle@Lugao-srv03 OraBkps]$ export ORACLE_SID=PCBDB[oracle@Lugao-srv03 OraBkps]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 2 19:41:30 2015Copyright (c) 1982, 2009, Oracle.All rights reserved.

Connected to an idle instance.

SQL> create pfile='/home/oracle/initPDBDB.ora' from spfile;

File created.

Edit the text PFILE similar to the followingPCBDB.__db_cache_size=310378496PCBDB.__java_pool_size=4194304PCBDB.__large_pool_size=4194304PCBDB.__oracle_base='/u01/app/oracle'PCBDB.__pga_aggregate_target=297795584PCBDB.__sga_target=553648128PCBDB.__shared_io_pool_size=0PCBDB.__shared_pool_size=226492416PCBDB.__streams_pool_size=0*.audit_file_dest='/u01/app/oracle/admin/PCBDB/adump'*.audit_trail='db'*.compatible='11.2.0.0.0'*.control_files='/u01/PCBDB/log/control01.ctl','/u02/PCBDB/log/control02.ctl'*.db_block_size=8192*.db_domain=''*.db_name='PCBDB'*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'*.db_recovery_file_dest_size=4039114752*.diagnostic_dest='/u01/app/oracle'*.dispatchers='(PROTOCOL=TCP) (SERVICE=PCBDBXDB)'*.log_archive_format='%t_%s_%r.dbf'*.memory_target=848297984*.open_cursors=300*.processes=150*.remote_login_passwordfile='EXCLUSIVE'*.undo_tablespace='UNDOTBS1'

Create the missing file system on the new server, export back the PFILE settings to SPFILE then start the database instance in nomount state[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u01/app/oracle/admin/PCBDB/adump[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u01/PCBDB/log[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u02/PCBDB/log[oracle@Lugao-srv03 OraBkps]$ mkdir -p /u01/app/oracle/flash_recovery_area

[oracle@Lugao-srv03 OraBkps]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 2 19:41:30 2015Copyright (c) 1982, 2009, Oracle.All rights reserved.

Connected to an idle instance.

SQL> create spfile from pfile='/home/oracle/initPDBDB.ora';

File created.

SQL> startup nomountORACLE instance started.

Total System Global Area849530880 bytesFixed Size1339824 bytesVariable Size499125840 bytesDatabase Buffers343932928 bytesRedo Buffers5132288 bytes

Restoring ControlFile from AutobackupsTo restore the control file from autobackup setORACLE_SIDenvironmental variable, start the RMAN by connecting to the target, set the DBID of the database, SetCONTROLFILE AUTOBACKUP FORMATparameter to the format mode used during control file autobackup then execute RESTORE CONTROLFILE FROM AUTOBACKUP command as follows[oracle@Lugao-srv03 ~]$ export ORACLE_SID=PCBDB[oracle@Lugao-srv03 ~]$ rman target/

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Feb 2 20:02:37 2015Copyright (c) 1982, 2009, Oracle and/or its affiliates.All rights reserved.

connected to target database: PCBDB (not mounted)

RMAN> set dbid 132566208;

executing command: SET DBID

RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/OraBkps/pcbdbcf_%F';

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;

Starting restore at 02-FEB-15using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=20 device type=DISK

recovery area destination: /u01/app/oracle/flash_recovery_areadatabase name (or database unique name) used for search: PCBDBchannel ORA_DISK_1: no AUTOBACKUPS found in the recovery areachannel ORA_DISK_1: looking for AUTOBACKUP on day: 20150202channel ORA_DISK_1: AUTOBACKUP found: /u01/OraBkps/pcbdbcf_c-132566208-20150202-09channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/OraBkps/pcbdbcf_c-132566208-20150202-09channel ORA_DISK_1: control file restore from AUTOBACKUP completeoutput file name=/u01/PCBDB/log/control01.ctloutput file name=/u02/PCBDB/log/control02.ctlFinished restore at 02-FEB-15

Catalog Backup FilesIt is possible that the backup files on new server are accessible through the location not yet known to the restored control file thus you may need to catalog them. So mount the database instance then execute theCATALOGcommand as followsRMAN> alter database mount;

database mountedreleased channel: ORA_DISK_1

RMAN> catalog start with '/u01/OraBkps/backupset';

searching for all files that match the pattern /u01/OraBkps/backupset

List of Files Unknown to the Database=====================================File Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T184845_bdz72xn8_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T135041_bdyon1nd_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T140537_bdypj1mr_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T121514_bdyj1309_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T141356_bdypznr9_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T184845_bdz730t8_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T185026_bdz762gs_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T184849_bdz73240_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T114402_bdyg6lfx_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T121349_bdyhyffm_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T121347_bdyhycwx_.bkp

Do you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging done

List of Cataloged Files=======================File Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T184845_bdz72xn8_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T135041_bdyon1nd_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T140537_bdypj1mr_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T121514_bdyj1309_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T141356_bdypznr9_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T184845_bdz730t8_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T185026_bdz762gs_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T184849_bdz73240_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T114402_bdyg6lfx_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T121349_bdyhyffm_.bkpFile Name: /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T121347_bdyhycwx_.bkp

Get the Structure of Datafiles and Redo LogIt is possible that the directory structure of new server is not the same as the old server. Query the metadata of restored control file thoughV$DATAFILEview to get the structure of datafile and redo log of the old server as followsSQL> COLUMN name FORMAT A47SQL> select file#, name from v$datafile;

FILE# NAME---------- -----------------------------------------------1 /u01/app/oracle/oradata/PCBDB/system01.dbf2 /u01/app/oracle/oradata/PCBDB/sysaux01.dbf3 /u01/app/oracle/oradata/PCBDB/undotbs01.dbf4 /u02/app/oracle/oradata/PCBDB/users01.dbf5 /u02/app/oracle/oradata/PCBDB/example01.dbf6 /u01/app/oracle/oradata/PCBDB/DEV_odi_user.dbf

6 rows selected.

SQL> select member from v$logfile;

MEMBER--------------------------------------------------------------------------------/u01/app/oracle/oradata/PCBDB/redo02.log/u01/app/oracle/oradata/PCBDB/redo01.log/u01/app/oracle/oradata/PCBDB/redo03.log

Prepare and Execute the Restoration ScriptPrepare the RMAN script that include the following parameters SET NEWNAME, SQL ALTER DATABASE RENAME FILE and SWITCH DATAFILE similar to the followingRUN {SET NEWNAME FOR DATAFILE 1 TO '/u01/PCBDB/dbs/system01.dbf';SET NEWNAME FOR DATAFILE 2 TO '/u01/PCBDB/dbs/sysaux01.dbf';SET NEWNAME FOR DATAFILE 3 TO '/u01/PCBDB/dbs/undotbs01.dbf';SET NEWNAME FOR DATAFILE 4 TO '/u01/PCBDB/dbs/users01.dbf';SET NEWNAME FOR DATAFILE 5 TO '/u01/PCBDB/dbs/example01.dbf';SET NEWNAME FOR DATAFILE 6 TO '/u01/PCBDB/dbs/DEV_odi_user.dbf';SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo02.log'' TO ''/u02/PCBDB/log/redo02.log''";SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo01.log'' TO ''/u01/PCBDB/log/redo01.log''";SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo03.log'' TO ''/u02/PCBDB/log/redo03.log''";RESTORE DATABASE;SWITCH DATAFILE ALL;}

Finally execute the script as followsRMAN> @restore

RMAN> RUN {2>SET NEWNAME FOR DATAFILE 1 TO '/u01/PCBDB/dbs/system01.dbf';3>SET NEWNAME FOR DATAFILE 2 TO '/u01/PCBDB/dbs/sysaux01.dbf';4>SET NEWNAME FOR DATAFILE 3 TO '/u01/PCBDB/dbs/undotbs01.dbf';5>SET NEWNAME FOR DATAFILE 4 TO '/u01/PCBDB/dbs/users01.dbf';6>SET NEWNAME FOR DATAFILE 5 TO '/u01/PCBDB/dbs/example01.dbf';7>SET NEWNAME FOR DATAFILE 6 TO '/u01/PCBDB/dbs/DEV_odi_user.dbf';8>SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo02.log'' TO ''/u02/PCBDB/log/redo02.log''";9>SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo01.log'' TO ''/u01/PCBDB/log/redo01.log''";10>SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo03.log'' TO ''/u02/PCBDB/log/redo03.log''";11>RESTORE DATABASE;12>SWITCH DATAFILE ALL;13> }executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo02.log'' TO ''/u02/PCBDB/log/redo02.log''

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo01.log'' TO ''/u01/PCBDB/log/redo01.log''

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/PCBDB/redo03.log'' TO ''/u02/PCBDB/log/redo03.log''

Starting restore at 02-FEB-15using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_DISK_1: restoring datafile 00001 to /u01/PCBDB/dbs/system01.dbfchannel ORA_DISK_1: restoring datafile 00002 to /u01/PCBDB/dbs/sysaux01.dbfchannel ORA_DISK_1: restoring datafile 00003 to /u01/PCBDB/dbs/undotbs01.dbfchannel ORA_DISK_1: restoring datafile 00004 to /u01/PCBDB/dbs/users01.dbfchannel ORA_DISK_1: restoring datafile 00005 to /u01/PCBDB/dbs/example01.dbfchannel ORA_DISK_1: restoring datafile 00006 to /u01/PCBDB/dbs/DEV_odi_user.dbfchannel ORA_DISK_1: reading from backup piece /u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T184849_bdz73240_.bkpchannel ORA_DISK_1: piece handle=/u01/OraBkps/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T184849_bdz73240_.bkp tag=TAG20150202T184849channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:01:25Finished restore at 02-FEB-15

datafile 1 switched to datafile copyinput datafile copy RECID=7 STAMP=870648471 file name=/u01/PCBDB/dbs/system01.dbfdatafile 2 switched to datafile copyinput datafile copy RECID=8 STAMP=870648471 file name=/u01/PCBDB/dbs/sysaux01.dbfdatafile 3 switched to datafile copyinput datafile copy RECID=9 STAMP=870648471 file name=/u01/PCBDB/dbs/undotbs01.dbfdatafile 4 switched to datafile copyinput datafile copy RECID=10 STAMP=870648471 file name=/u01/PCBDB/dbs/users01.dbfdatafile 5 switched to datafile copyinput datafile copy RECID=11 STAMP=870648471 file name=/u01/PCBDB/dbs/example01.dbfdatafile 6 switched to datafile copyinput datafile copy RECID=12 STAMP=870648471 file name=/u01/PCBDB/dbs/DEV_odi_user.dbfRMAN> **end-of-file**

Recover the Database InstanceAfter successful restoration of all data files recover your database instance. It may fail at some point but dont panic it is likely that following the server or storage crush you may not have all archive logsRMAN> RECOVER DATABASE;

Starting recover at 02-FEB-15using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destinationchannel ORA_DISK_1: restoring archived logarchived log thread=1 sequence=2channel ORA_DISK_1: reading from backup piece /u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T185026_bdz762gs_.bkpchannel ORA_DISK_1: piece handle=/u01/OraBkps/backupset/2015_02_02/o1_mf_annnn_TAG20150202T185026_bdz762gs_.bkp tag=TAG20150202T185026channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01archived log file name=/u01/app/oracle/flash_recovery_area/PCBDB/archivelog/2015_02_02/o1_mf_1_2_bdzoc629_.arc thread=1 sequence=2channel default: deleting archived log(s)archived log file name=/u01/app/oracle/flash_recovery_area/PCBDB/archivelog/2015_02_02/o1_mf_1_2_bdzoc629_.arc RECID=56 STAMP=870648726unable to find archived logarchived log thread=1 sequence=3RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of recover command at 02/02/2015 22:52:07RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3 and starting SCN of 1605785

Open the Database with RESETLOGS OptionAfter recovering your database instance, you can open it. You must specify RESETLOGS because the new control file represents a different instantiation of the databaseRMAN> ALTER DATABASE OPEN RESETLOGS;

database opened

ReferencesOracle Database Backup and Recovery User's Guide11g Release 2 (11.2)Posted3rd FebruarybySadock Obeth0Add a comment2. FEB2

Using RMAN ControlFile Autobackup Feature to Recover from Loss of All Control files and/or SPFILE

Having recent backups of your Control file and Server Parameter File (SPFILE) is extremely valuable in many recovery situations. However to increase the possibility that you will have such backups, Oracle database supports control file and server parameter file autobackups.

RMAN will automatically backs up the control file and the SPFILE at the end of any successfulBACKUPcommand only when theCONFIGURE CONTROLFILE AUTOBACKUPis set toON, and if the database runs inARCHIVELOGmode, RMAN makes control file autobackups when a structural change to the database affects the contents of the control file

To check the current control file autobackups setting execute the following commandRMAN> SHOW CONTROLFILE AUTOBACKUP;

RMAN configuration parameters for database with db_unique_name PCBDB are:CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

To enable the control file autobackups feature execute the following commandRMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters:CONFIGURE CONTROLFILE AUTOBACKUP ON;new RMAN configuration parameters are successfully stored

RMAN> SHOW CONTROLFILE AUTOBACKUP;

RMAN configuration parameters for database with db_unique_name PCBDB are:CONFIGURE CONTROLFILE AUTOBACKUP ON;

Configuring the Control File Autobackup FormatBy default, the format of the autobackup file for all configured devices is the substitution variable%Fin theFORMATclauseRMAN> SHOW CONTROLFILE AUTOBACKUP FORMAT;

RMAN configuration parameters for database with db_unique_name PCBDB are:CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

To change the default format execute the following command and confirm the setting as follows:RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/Backups/cf_%F';

new RMAN configuration parameters:CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/Backups/cf_%F';new RMAN configuration parameters are successfully stored

RMAN> SHOW CONTROLFILE AUTOBACKUP FORMAT;

RMAN configuration parameters for database with db_unique_name PCBDB are:CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/Backups/cf_%F';

Control file and SPFIL AutobackupThe following example shows how RMAN perform autobackup of control file and SPFILE at the end of any successful BACKUP command. The command backup only data file number 1 for simplicity. Notice the location of autobackupRMAN> backup datafile 1;

Starting backup at 02-FEB-15allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=35 device type=DISKchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00001 name=/u01/app/oracle/oradata/PCBDB/system01.dbfchannel ORA_DISK_1: starting piece 1 at 02-FEB-15channel ORA_DISK_1: finished piece 1 at 02-FEB-15piece handle=/u01/app/oracle/flash_recovery_area/PCBDB/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T135041_bdyon1nd_.bkp tag=TAG20150202T135041 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:36Finished backup at 02-FEB-15

Starting Control File and SPFILE Autobackup at 02-FEB-15piece handle=/u01/app/oracle/Backups/cf_c-132566208-20150202-05 comment=NONEFinished Control File and SPFILE Autobackup at 02-FEB-15

Overriding the Configured Control File Autobackup FormatTheSET CONTROLFILE AUTOBACKUP FORMATcommand, specified either within aRUNcommand or at theRMANprompt, overrides the configured autobackup format in the current session however all autobackup formats must include the%Fvariable. The order of precedence is as follows:SET CONTROLFILE AUTOBACKUP FORMAT(within a RUN block)SET CONTROLFILE AUTOBACKUP FORMAT(at RMAN prompt)CONFIGURE CONTROLFILE AUTOBACKUP FORMAT

The following example shows how RMAN perform autobackup of control file and SPFILE at the end of any successful BACKUP command whenSET CONTROLFILE AUTOBACKUP FORMATcommand is used at RMAN promptRMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/Backups/pcbdbcf_%F';

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

RMAN> backup datafile 2;

Starting backup at 02-FEB-15using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00002 name=/u01/app/oracle/oradata/PCBDB/sysaux01.dbfchannel ORA_DISK_1: starting piece 1 at 02-FEB-15channel ORA_DISK_1: finished piece 1 at 02-FEB-15piece handle=/u01/app/oracle/flash_recovery_area/PCBDB/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T140537_bdypj1mr_.bkp tag=TAG20150202T140537 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:35Finished backup at 02-FEB-15

Starting Control File and SPFILE Autobackup at 02-FEB-15piece handle=/u02/Backups/pcbdbcf_c-132566208-20150202-06 comment=NONEFinished Control File and SPFILE Autobackup at 02-FEB-15

The following example shows how RMAN perform autobackup of control file and SPFILE at the end of any successful BACKUP command whenSET CONTROLFILE AUTOBACKUP FORMATcommand is used within a RUN blockRMAN> run{2> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/Backups/pcbdbcf_%F';3> BACKUP DATAFILE 3;4> }

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting backup at 02-FEB-15using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=29 device type=DISKchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00003 name=/u01/app/oracle/oradata/PCBDB/undotbs01.dbfchannel ORA_DISK_1: starting piece 1 at 02-FEB-15channel ORA_DISK_1: finished piece 1 at 02-FEB-15piece handle=/u01/app/oracle/flash_recovery_area/PCBDB/backupset/2015_02_02/o1_mf_nnndf_TAG20150202T141356_bdypznr9_.bkp tag=TAG20150202T141356 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03Finished backup at 02-FEB-15

Starting Control File and SPFILE Autobackup at 02-FEB-15piece handle=/home/oracle/Backups/pcbdbcf_c-132566208-20150202-07 comment=NONEFinished Control File and SPFILE Autobackup at 02-FEB-15

Restoring SPFILE from AutobackupIf the SPFILE is lost, you can restore it from the autobackup. However you must to set the DBID for your database before you issueRESTORE SPFILE FROM AUTOBACKUPcommand otherwise it will fail. The challenge with DBID (database identifier) is that, it is not something that would be available until the database is at least mounted

The best practice it is recommended to record the DBID in a safe place or otherwise you can find it on control file autobackup output file when substitution variable%Fin theFORMATclause is used as demonstrated above. This variable format translates intoc-IIIIIIIIII-YYYYMMDD-QQ, with the placeholders defined as follows:IIIIIIIIIIstands for the DBIDYYYYMMDDis a time stamp of the day the backup is generatedQQis the hex sequence that starts with 00 and has a maximum of FF

Example:Starting Control File and SPFILE Autobackup at 02-FEB-15piece handle=/home/oracle/Backups/pcbdbcf_c-132566208-20150202-07comment=NONEFinished Control File and SPFILE Autobackup at 02-FEB-15

The following example simulate the loss of SPFILE on disk by renaming the file and attempt to restart the database instance[oracle@Lugao-odisrv dbs]$ mv spfilePCBDB.ora spfilePCBDB.ora.old[oracle@Lugao-odisrv dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 2 14:31:07 2015Copyright (c) 1982, 2009, Oracle.All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup forceORA-01078: failure in processing system parametersLRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPCBDB.ora'SQL>

The following example shows how to use RMAN to restore the lost SPFILE from autobackup[oracle@Lugao-odisrv ~]$ export ORACLE_SID=PCBDB[oracle@Lugao-odisrv ~]$ rman target/

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Feb 2 15:17:08 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates.All rights reserved.

connected to target database (not started)

RMAN> set dbid 132566208;

executing command: SET DBID

RMAN> startup force nomount;

startup failed: ORA-01078: failure in processing system parametersLRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPCBDB.ora'

starting Oracle instance without parameter file for retrieval of spfileOracle instance started

Total System Global Area159019008 bytes

Fixed Size1335192 bytesVariable Size75497576 bytesDatabase Buffers79691776 bytesRedo Buffers2494464 bytes

RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/Backups/pcbdbcf_%F';

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

RMAN> RESTORE SPFILE FROM AUTOBACKUP;

Starting restore at 02-FEB-15using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150202channel ORA_DISK_1: AUTOBACKUP found: /home/oracle/Backups/pcbdbcf_c-132566208-20150202-07channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/Backups/pcbdbcf_c-132566208-20150202-07channel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 02-FEB-15

Restart the database instanceRMAN> startup force

Oracle instance startedDatabase mountedDatabase opened

Total System Global Area849530880 bytes

Fixed Size1339824 bytesVariable Size532680272 bytesDatabase Buffers310378496 bytesRedo Buffers5132288 bytes

Restoring Control file from AutobackupThe procedure to restore control file from autobackup is similar to restoring the SPFILE from autobackup except that you should successful start the database instance to nomount state using your SPFILE or PFILE.

The following example simulate the loss of all control files by deleting all control files on file system and attempt to restart the database instanceSQL> select name from v$controlfile;

NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/PCBDB/control01.ctl/u01/app/oracle/flash_recovery_area/PCBDB/control02.ctl

[oracle@Lugao-odisrv ~]$ rm /u01/app/oracle/oradata/PCBDB/control01.ctl[oracle@Lugao-odisrv ~]$ rm /u01/app/oracle/flash_recovery_area/PCBDB/control02.ctl[oracle@Lugao-odisrv ~]$

SQL> startup forceORACLE instance started.

Total System Global Area849530880 bytesFixed Size1339824 bytesVariable Size532680272 bytesDatabase Buffers310378496 bytesRedo Buffers5132288 bytesORA-00205: error in identifying control file, check alert log for moreinfo

The following example shows how to use RMAN to restore the lost control files from autobackup[oracle@Lugao-odisrv ~]$ export ORACLE_SID=PCBDB[oracle@Lugao-odisrv ~]$ rman target/

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Feb 2 16:35:21 2015Copyright (c) 1982, 2009, Oracle and/or its affiliates.All rights reserved.

connected to target database: PCBDB (not mounted)

RMAN> set dbid 132566208;

executing command: SET DBID

RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/Backups/pcbdbcf_%F';

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;

Starting restore at 02-FEB-15using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=20 device type=DISK

recovery area destination: /u01/app/oracle/flash_recovery_areadatabase name (or database unique name) used for search: PCBDBchannel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/flash_recovery_area/PCBDB/autobackup/2015_02_02/o1_mf_s_870610516_bdyj157p_.bkp found in the recovery areachannel ORA_DISK_1: looking for AUTOBACKUP on day: 20150202channel ORA_DISK_1: AUTOBACKUP found: /home/oracle/Backups/pcbdbcf_c-132566208-20150202-07channel ORA_DISK_1: restoring control file from AUTOBACKUP /home/oracle/Backups/pcbdbcf_c-132566208-20150202-07channel ORA_DISK_1: control file restore from AUTOBACKUP completeoutput file name=/u01/app/oracle/oradata/PCBDB/control01.ctloutput file name=/u01/app/oracle/flash_recovery_area/PCBDB/control02.ctlFinished restore at 02-FEB-15

Mount the database instance then perform recovery because you now have a backup control file that contains information about an older version of the databaseRMAN> ALTER DATABASE MOUNT;

database mountedreleased channel: ORA_DISK_1

RMAN> RECOVER DATABASE;

Starting recover at 02-FEB-15Starting implicit crosscheck backup at 02-FEB-15allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=21 device type=DISKCrosschecked 12 objectsFinished implicit crosscheck backup at 02-FEB-15

Starting implicit crosscheck copy at 02-FEB-15using channel ORA_DISK_1Finished implicit crosscheck copy at 02-FEB-15

searching for all files in the recovery areacataloging files...cataloging done

List of Cataloged Files=======================File Name: /u01/app/oracle/flash_recovery_area/PCBDB/archivelog/2015_02_02/o1_mf_1_8_bdywxmws_.arc

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 8 is already on disk as file /u01/app/oracle/flash_recovery_area/PCBDB/archivelog/2015_02_02/o1_mf_1_8_bdywxmws_.arcarchived log for thread 1 with sequence 9 is already on disk as file /u01/app/oracle/oradata/PCBDB/redo03.logarchived log file name=/u01/app/oracle/flash_recovery_area/PCBDB/archivelog/2015_02_02/o1_mf_1_8_bdywxmws_.arc thread=1 sequence=8archived log file name=/u01/app/oracle/oradata/PCBDB/redo03.log thread=1 sequence=9media recovery complete, elapsed time: 00:00:01Finished recover at 02-FEB-15

After recovering the database, you can open it. You must specify RESETLOGS because the new control file represents a different instantiation of the databaseRMAN> ALTER DATABASE OPEN RESETLOGS;

database opened

Following RESETLOGS command you need immediate to full back up your database because among other RESETLOGS option invalidate the old backups

ReferencesOracle Database Backup and Recovery User's Guide11g Release 2 (11.2)Posted2nd FebruarybySadock Obeth0Add a comment3. JAN8

Using Virtual Disks as Shared Storage to Install and Configure Oracle Database 11gR2 Real Application Cluster (RAC)

One of the major challenge to configure Oracle Real Application Cluster (RAC) for just testing and training purpose is the requirement of dedicated shared storage such as SAN (expensive). However you can use a least cost way to simulate testing and learning environment by using Virtual Machine software such Oracle Virtualbox to create virtual disks and attach/share to all nodes (virtual machines) wants to participate in cluster to simulate shared storage requirement of RAC

Steps to Go AboutNetwork SetupCreate, Attach and Share Virtual DisksCreate Disks PartitionsOracle Software Pre-Installation TasksInstall and Configure Oracle ASM PackagesInstall and Configure Oracle ClusterwareInstall Oracle Real Application (RAC) SoftwareCreate ASM Diskgroups Using ASMCACreate RAC Database Using DBCAVerification

Assumption:Two nodes partipating in this RAC installation are virtual machines with 2GB RAM each running Red hat Enterprise Linux 5.8 64 bits on Window 7 host machine

Network SetupOne of the essential part prior to the installation and configuration of RAC is network setup in all nodes participating in RAC. Oracle 11gR2 RAC needs four network names and associated IP Addresses configurations to work:

Public Host Name(for each node) is the primary name of the host as displayed by commandhostnameand should be associated to any public network interface card IP AddressPrivate Host Name(for each node) associated to the private network interface card IP Address and should not be accessible by any device not participating in RAC private network should be on dedicated switchVirtual Public Host Name(for each node) not assigned to any network interface card, is used to reroute client requests sent to the node if the node is downSCAN DNS namenot assigned to any network interface card and is resolved by DNS to at least three IP Addresses using round robin algorithm

SCAN DSN provide a single name for client to access Oracle database in a cluster independent of which server in the cluster the database is active and shouldnot appear in/etc/hosts file.Public Host Name, Virtual Host Name and SCAN DNS name must be on the same subnet that is accessible on public network by other devices (e.g. clients)Private Host Name need not to be on DNS and should be entered in the /etc/hosts file

Sample IP Address SetupHostPublic IPPrivate IPVIPSCAN:Lugaorac-scan

Lugao-srv01.lusam.tz192.168.56.40172.16.9.11192.168.56.50IP1: 192.168.56.60IP2:192.168.56.61IP3:192.168.56.62

Lugao-srv02.lusam.tz192.168.56.41172.16.9.12192.168.56.51

Interface --->ethoeth1

Sample Entries on DNS Server

Regardless of using a DNS server it is recommended to add lines to the/etc/hostsfile on each node, for Public IP, VIP and Private IP addresses similar to the following:#Public192.168.56.40Lugao-srv01.lusam.tzLugao-srv01192.168.56.41Lugao-srv02.lusam.tzLugao-srv02

#Private172.16.9.11Lgracnode1-priv.lusam.tzLgracnode1-priv172.16.9.11Lgracnode2-priv.lusam.tzLgracnode2-priv

#Virtual IP address192.168.56.50Lgracnode1-vip.lusam.tzLgracnode1-vip192.168.56.51Lgracnode2-vip.lusam.tzLgracnode2-vip

On all nodes change the name resolution search order in/etc/nsswitch.conffile by telling the host to start looking the DNS server then methods follows. Search the following lines#hosts:db files nisplus nis dnshosts:files dnsThen change to:#hosts:db files nisplus nis dnshosts:dnsfiles

After modifying the/etc/nsswitch.conffile, restart thenscddaemon on each node as follows[root@Lugao-srv01 ~]# /sbin/service nscd restartStopping nscd:[FAILED]Starting nscd:[OK][root@Lugao-srv01 ~]# /sbin/service nscd restartStopping nscd:[OK]Starting nscd:[OK][root@Lugao-srv01 ~]#

Confirm SCAN configurations on DNS server is using round-robin name resolution algorithms by usingnslookupcommand. Run the nslookup command at least twice, the result should return a set of 3 IPs in a different order in each run as follows[root@Lugao-srv01 ~]# nslookup Lugaorac-scanServer:192.168.56.30Address:192.168.56.30#53

Name:Lugaorac-scan.lusam.tzAddress: 192.168.56.60Name:Lugaorac-scan.lusam.tzAddress: 192.168.56.61Name:Lugaorac-scan.lusam.tzAddress: 192.168.56.62

[root@Lugao-srv01 ~]#[root@Lugao-srv01 ~]# nslookup Lugaorac-scanServer:192.168.56.30Address:192.168.56.30#53

Name:Lugaorac-scan.lusam.tzAddress: 192.168.56.61Name:Lugaorac-scan.lusam.tzAddress: 192.168.56.62Name:Lugaorac-scan.lusam.tzAddress: 192.168.56.60

Deconfigure NTPMake sure NTP it is not configured so that Oracle Cluster Time Synchronization Service (ctssd) can synchronize the times of the RAC nodes as follows[root@Lugao-srv01 ~]# service ntpd statusntpd is stopped[root@Lugao-srv01 ~]# ls -lr /etc/ntp.conf-rw-r--r-- 1 root root 1833 Oct 252011 /etc/ntp.conf[root@Lugao-srv01 ~]#[root@Lugao-srv01 ~]# mv /etc/ntp.conf /etc/ntp.conf.bkp

Create, Attach and Share Virtual DisksThe following RAC installation is done on virtual machines that access the shared virtual storage on the host machine. Shut down all guest machines then execute the following commands from host machine command prompt to create seven the shared diskVBoxManage createhd --filename "D:\VMDSK\ASM\OCR_VOTE01.vdi" --size 1024 --format VDI --variant FixedVBoxManage createhd --filename "D:\VMDSK\ASM\OCR_VOTE02.vdi" --size 1024 --format VDI --variant FixedVBoxManage createhd --filename "D:\VMDSK\ASM\OCR_VOTE03.vdi" --size 1024 --format VDI --variant Fixed

VBoxManage createhd --filename "D:\VMDSK\ASM\ASM_DATA01.vdi" --size 5120 --format VDI --variant FixedVBoxManage createhd --filename "D:\VMDSK\ASM\ASM_DATA02.vdi --size 5120 --format VDI --variant FixedVBoxManage createhd --filename "D:\VMDSK\ASM\ASM_FRA01.vdi" --size 5120 --format VDI --variant FixedVBoxManage createhd --filename "D:\VMDSK\ASM\ASM_FRA02.vdi" --size 5120 --format VDI --variant Fixed

Attach the created disks to the Virtual Machine:VBoxManage storageattach RHEL5.8x86_64-SRV02 --storagectl "SATA" --port 1 --device 0 --type hdd --medium "D:\VMDSK\ASM\OCR_VOTE01.vdi" --mtype shareableVBoxManage storageattach RHEL5.8x86_64-SRV02 --storagectl "SATA" --port 2 --device 0 --type hdd --medium "D:\VMDSK\ASM\OCR_VOTE02.vdi" --mtype shareableVBoxManage storageattach RHEL5.8x86_64-SRV02 --storagectl "SATA" --port 3 --device 0 --type hdd --medium "D:\VMDSK\ASM\OCR_VOTE03.vdi" --mtype shareable

VBoxManage storageattach RHEL5.8x86_64-SRV02 --storagectl "SATA" --port 4 --device 0 --type hdd --medium "D:\VMDSK\ASM\ASM_DATA01.vdi" --mtype shareableVBoxManage storageattach RHEL5.8x86_64-SRV02 --storagectl "SATA" --port 5 --device 0 --type hdd --medium "D:\VMDSK\ASM\ASM_DATA02.vdi" --mtype shareable

VBoxManage storageattach RHEL5.8x86_64-SRV02 --storagectl "SATA" --port 6 --device 0 --type hdd --medium "D:\VMDSK\ASM\ASM_FRA01.vdi" --mtype shareableVBoxManage storageattach RHEL5.8x86_64-SRV02 --storagectl "SATA" --port 7 --device 0 --type hdd --medium "D:\VMDSK\ASM\ASM_FRA02.vdi" --mtype shareable

Make the disks sharable:VBoxManage modifyhd "D:\VMDSK\ASM\OCR_VOTE01.vdi" --type shareableVBoxManage modifyhd "D:\VMDSK\ASM\OCR_VOTE02.vdi" --type shareableVBoxManage modifyhd "D:\VMDSK\ASM\OCR_VOTE03.vdi" --type shareable

VBoxManage modifyhd "D:\VMDSK\ASM\ASM_DATA01.vdi" --type shareableVBoxManage modifyhd "D:\VMDSK\ASM\ASM_DATA02.vdi" --type shareable

VBoxManage modifyhd "D:\VMDSK\ASM\ASM_FRA01.vdi" --type shareableVBoxManage modifyhd "D:\VMDSK\ASM\ASM_FRA01.vdi" --type shareable

Repeat the procedure to attach the disks on the second virtual machine then power on all virtual machines to start the process of portioning the attached disks

Create Disks PartitionsAs the userroot, determine the partitions discovered usingcat /proc/partitionscommand as follows:[root@Lugao-srv01 ~]# cat /proc/partitionsmajor minor#blocksname

3036700160 hda31104391 hda1324192965 hda23332395072 hda3801048576 sda8161048576 sdb8321048576 sdc8485242880 sdd8645242880 sde8805242880 sdf8965242880 sdg253032374784 dm-0

From one node only runfdiskagainst each disk not partitioned to createa single whole-disk partition andthe sequence of answers is "n", "p", "1", "Return", "Return", "p" and "w" as follows[root@Lugao-srv01 ~]# fdisk /dev/sdaDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite)

Command (m for help): nCommand actioneextendedpprimary partition (1-4)pPartition number (1-4): 1First cylinder (1-130, default 1):Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):Using default value 130

Command (m for help): wThe partition table has been altered!

Calling ioctl() to re-read partition table.Syncing disks.[root@Lugao-srv01 ~]#

Repeat the same for the remaining disks[root@Lugao-srv01 ~]# fdisk /dev/sdb[root@Lugao-srv01 ~]# fdisk /dev/sdd[root@Lugao-srv01 ~]# fdisk /dev/sde[root@Lugao-srv01 ~]# fdisk /dev/sdf[root@Lugao-srv01 ~]# fdisk /dev/sdg

Use againcat /proc/partitionscommand to confirm partitions created on all nodes partipating in cluster[root@Lugao-srv01 ~]# cat /proc/partitionsmajor minor#blocksname3036700160 hda31104391 hda1324192965 hda23332395072 hda3801048576 sda811044193 sda18161048576 sdb8171044193 sdb18321048576 sdc8331044193 sdc18485242880 sdd8495237158 sdd18645242880 sde8655237158 sde18805242880 sdf8815237158 sdf18965242880 sdg8975237158 sdg1253032374784 dm-0[root@Lugao-srv01 ~]#

[root@Lugao-srv02 ~]# cat /proc/partitionsmajor minor#blocksname3052428800 hda31104391 hda13252323705 hda2801048576 sda811044193 sda18161048576 sdb8171044193 sdb18321048576 sdc8331044193 sdc18485242880 sdd8495237158 sdd18645242880 sde8655237158 sde18805242880 sdf8815237158 sdf18965242880 sdg8975237158 sdg1253046301184 dm-025315996544 dm-1[root@Lugao-srv02 ~]#

Oracle Software Pre-Installation TasksSoftware RequirementsOn all nodes Use rpm command to install the following packages from Linux installation mediarpm -Uvh binutils-2.17.50.0.6*rpm -Uvh compat-libstdc++-33*rpm -Uvh elfutils-libelf-0*rpm -Uvh elfutils-libelf-devel-*rpm -Uvh gcc-4*rpm -Uvh gcc-c++-4*rpm -Uvh glibc-2*rpm -Uvh glibc-common-2*rpm -Uvh glibc-devel-2.*rpm -Uvh glibc-headers*rpm -Uvh ksh*rpm -Uvh libaio-0*rpm -Uvh libaio-devel-0*rpm -Uvh libgcc-4*rpm -Uvh libgomp*rpm -Uvh libstdc++-4*rpm -Uvh libstdc++-devel 4.*rpm -Uvh make-3.*rpm -Uvh numactl-devel-0.*rpm -Uvh nutils-2.*rpm -Uvh sysstat-7.*rpm -Uvh unixODBC-2.*rpm -Uvh unixODBC-devel-2.*

On all nodes use text editor of your choice, add the following lines in"/etc/sysctl.conf" file. Include only the lines that have values greater than existing values in filefs.suid_dumpable = 1fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096# semaphores: semmsl, semmns, semopm, semmnikernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default=4194304net.core.rmem_max=4194304net.core.wmem_default=262144net.core.wmem_max=1048586

On all nodes Open shell prompt then run/sbin/sysctl pcommand to change the current kernel parameters[root@avsrv ~]# /sbin/sysctl -pnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 68719476736kernel.shmall = 4294967296fs.suid_dumpable = 1fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 4194304net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586[root@avsrv ~]#

On all nodes use editor of your choice to add the following lines in"/etc/security/limits.conf" fileoraclesoftnproc2047oraclehardnproc16384oraclesoftnofile4096oraclehardnofile65536oraclesoftstack10240gridsoftnproc2047gridhardnproc16384gridsoftnofile4096gridhardnofile65536gridsoftstack10240

On all nodes Use editor of your choice add the following line"/etc/pam.d/login"filesessionrequired/lib/security/pam_limits.sosessionrequiredpam_limits.so

Creating Operating System Groups and UsersOracle recommend to use Job Role Separation privileges configuration with operating system groups and users that divide administrative access privileges to the Oracle grid infrastructure installation from other administrative privileges users and groups associated with other Oracle installations (e.g. the Oracle Database software).

Administrative privileges access is granted by membership in separate operating system groups, and installation privileges are granted by using different installation owners for each Oracle installation typically"grid"for the Oracle grid infrastructure and"oracle"for the Database software. However both Oracle software owners must have the Oracle Inventory group (oinstall) as their primary group, so that each Oracle software installation owner can write to the central inventory (oraInventory)

The following operating system groups and users needs to be created on all nodes that will participating in Oracle RAC configurations:DescriptionOS GroupMembersOracle PrivilegeOracle Group

Oracle Inventory and Software Owneroinstallgrid, oracle

Oracle ASM GroupasmadmingridSYSASMOSASM

ASM Database Administrator Groupasmdbagrid, oracleSYSDBA for ASMOSDBA for ASM

ASM Operator GroupasmopergridSYSOPER for ASMOSOPER for ASM

Database AdministratordbaoracleSYSDBAOSDBA

Database OperatoroperoracleSYSOPEROSOPER

Note:Ensure that the operating system groups and user IDs are identical (the same) on all Oracle RAC nodes in the cluster otherwise installation checks will fail. As root user run as follows on all nodes[root@Lugao-srv01 ~]# groupadd -g 512 oinstall[root@Lugao-srv01 ~]# groupadd -g 513 dba[root@Lugao-srv01 ~]# groupadd -g 514 oper[root@Lugao-srv01 ~]# groupadd -g 515 asmadmin[root@Lugao-srv01 ~]# groupadd -g 516 asmdba[root@Lugao-srv01 ~]# groupadd -g 517 asmoper

[root@Lugao-srv01 ~]# useradd -u 501 -g oinstall -G dba,oper,asmdba oracle[root@Lugao-srv01 ~]#[root@Lugao-srv01 ~]# useradd -u 502 -g oinstall -G asmadmin,asmdba,asmoper grid[root@Lugao-srv01 ~]#

[root@Lugao-srv01 ~]# passwd oracleChanging password for user oracle.New UNIX password:Retype new UNIX password:passwd: all authentication tokens updated successfully.[root@Lugao-srv01 ~]#[root@Lugao-srv01 ~]# passwd gridChanging password for user grid.New UNIX password:Retype new UNIX password:passwd: all authentication tokens updated successfully.

Creating Software DirectoriesOn all node participating in RAC as root run commands as follows[root@Lugao-srv01 ~]# mkdir -p /u01/app/grid[root@Lugao-srv01 ~]# mkdir -p /u01/app/11.2.0/grid[root@Lugao-srv01 ~]# chown -R grid:oinstall /u01[root@Lugao-srv01 ~]#[root@Lugao-srv01 ~]# mkdir -p /u01/app/oracle[root@Lugao-srv01 ~]# chown -R oracle:oinstall /u01/app/oracle[root@Lugao-srv01 ~]#[root@Lugao-srv01 ~]# chmod -R 775 /u01

Note:The Grid Infrastructure home (/u01/app/11.2.0/grid)needs to be separate from other Oracle base directories because grid infrastructure installation will change the ownership of this home directory to root and inaccessible to unauthorized user

Create Login Script for the grid User AccountOn both Oracle RAC nodes edit/home/grid/.bash_profilefile by adding the following line (When setting the Oracle environment variables for each node replaceORACLE_HOSTNAMEandORACLE_SIDvariables with appropriate unique values)TMP=/tmp; export TMPTMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=lugao-srv01; export ORACLE_HOSTNAMEORACLE_SID=+ASM2; export ORACLE_SIDORACLE_BASE=/u01/app/grid; export ORACLE_BASEORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOMEPATH=/usr/sbin:$PATH; export PATHPATH=$ORACLE_HOME/bin:$PATH; export PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = "grid" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fiumask 022fi

Create Login Script for the oracle User AccountOn both Oracle RAC nodes edit/home/oracle/.bash_profilefile by adding the following lines (When setting the Oracle environment variables for each node replaceORACLE_HOSTNAMEandORACLE_SIDvariables with appropriate unique values)TMP=/tmp; export TMPTMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=lugao-srv01; export ORACLE_HOSTNAMEORACLE_UNQNAME=PCBRAC; export ORACLE_UNQNAMEORACLE_SID=PCBRAC1; export ORACLE_SIDORACLE_BASE=/u01/app/oracle; export ORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOMEPATH=/usr/sbin:$PATH; export PATHPATH=$ORACLE_HOME/bin:$PATH; export PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = "oracle" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fiumask 022fi

Install and Configure Oracle ASM PackagesOracle provides ASMLib 2.0 which is a support library for the Automatic Storage Management (ASM) feature of the Oracle Database atOTNpage. ASM is highly recommended as the shared file system and volume manager for Oracle Clusterware files (OCR and voting disk), Oracle Database files (data, online redo logs, control files, archived redo logs), and the Fast Recovery Area

NOTE:The ASMLib kernel driver MUST match the kernel version number, the kernel version number can be identified by running the "uname -r" command. Also, be sure to download the set of RPMs which pertain to your platform architecture[root@Lugao-srv01 ~]# uname -ri2.6.18-308.el5 x86_64[root@Lugao-srv01 ~]#

In our case, install the following packages on all RAC nodes as follows as root userrpm -Uvh oracleasm-support-2.1.8-1.el5.x86_64.rpmrpm -Uvh oracleasm-2.6.18-308.el5-debuginfo-2.0.5-1.el5.x86_64.rpmrpm -Uvh oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpmrpm -Uvh oracleasmlib-2.0.4-1.el5.x86_64.rpm

Configure ASMLib by running the following as the root user on all RAC nodes[root@Lugao-srv01 ASMLib]# /etc/init.d/oracleasm configure -iConfiguring 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 without typing ananswer will keep that current value.Ctrl-C will abort.

Default 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]: yWriting Oracle ASM library driver configuration: doneInitializing the Oracle ASMLib driver:[OK]Scanning the system for Oracle ASMLib disks:[OK][root@Lugao-srv01 ASMLib]#

Use theoracleasm creatediskcommand to create the ASM disk label on one node only[root@Lugao-srv01 ASMLib]# oracleasm createdisk OCR_VOTE01 /dev/sda1Writing disk header: doneInstantiating disk: done[root@Lugao-srv01 ASMLib]# oracleasm createdisk OCR_VOTE02 /dev/sdb1Writing disk header: doneInstantiating disk: done[root@Lugao-srv01 ASMLib]# oracleasm createdisk OCR_VOTE03 /dev/sdc1Writing disk header: doneInstantiating disk: done[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_DATA01 /dev/sdd1Writing disk header: doneInstantiating disk: done[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_DATA02 /dev/sde1Writing disk header: doneInstantiating disk: done[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_FRA01 /dev/sdf1Writing disk header: doneInstantiating disk: done[root@Lugao-srv01 ASMLib]# oracleasm createdisk ASM_FRA02 /dev/sdg1Writing disk header: doneInstantiating disk: done[root@Lugao-srv01 ASMLib]#

Check the disks are mounted in the oracleasm file system

[root@Lugao-srv01 ASMLib]# ls -l /dev/oracleasm/diskstotal 0brw-rw---- 1 grid asmadmin 8, 49 Dec 20 16:18 ASM_DATA01brw-rw---- 1 grid asmadmin 8, 65 Dec 20 16:19 ASM_DATA02brw-rw---- 1 grid asmadmin 8, 81 Dec 20 16:25 ASM_FRA01brw-rw---- 1 grid asmadmin 8, 97 Dec 20 16:20 ASM_FRA02brw-rw---- 1 grid asmadmin 8,1 Dec 20 16:17 OCR_VOTE01brw-rw---- 1 grid asmadmin 8, 17 Dec 20 16:17 OCR_VOTE02brw-rw---- 1 grid asmadmin 8, 33 Dec 20 16:17 OCR_VOTE03[root@Lugao-srv01 ASMLib]#

On all the other nodes in the cluster, use the scandisks command as the root user to pick-up the newly created ASM disks. You do not need to create the ASM disks on each node, only on one node in the cluster[root@Lugao-srv02 ASMLib]# oracleasm scandisksReloading disk partitions: doneCleaning any stale ASM disks...Scanning system for ASM disks...Instantiating disk "OCR_VOTE01"Instantiating disk "OCR_VOTE02"Instantiating disk "OCR_VOTE03"Instantiating disk "ASM_DATA01"Instantiating disk "ASM_DATA02"Instantiating disk "ASM_FRA01"Instantiating disk "ASM_FRA02"[root@Lugao-srv02 ASMLib]#

[root@Lugao-srv02 ASMLib]# ls -l /dev/oracleasm/diskstotal 0brw-rw---- 1 grid asmadmin 8, 49 Dec 20 16:26 ASM_DATA01brw-rw---- 1 grid asmadmin 8, 65 Dec 20 16:26 ASM_DATA02brw-rw---- 1 grid asmadmin 8, 81 Dec 20 16:26 ASM_FRA01brw-rw---- 1 grid asmadmin 8, 97 Dec 20 16:26 ASM_FRA02brw-rw---- 1 grid asmadmin 8,1 Dec 20 16:26 OCR_VOTE01brw-rw---- 1 grid asmadmin 8, 17 Dec 20 16:26 OCR_VOTE02brw-rw---- 1 grid asmadmin 8, 33 Dec 20 16:26 OCR_VOTE03[root@Lugao-srv02 ASMLib]#

Install and Configure Oracle ClusterwareIn Oracle Database 11gR2, Oracle Clusterware software is available as part of Oracle Grid Infrastructure products. Grid infrastructure provide also provide Automatic Storage Management (ASM) software for Oracle Database. Therefor to get Oracle clusterware and ASM you need to install and configure Oracle Grid infrastructure

Connect to one of RAC node as usergrid, launch universal installer to install grid infrastructure as follows[grid@Lugao-srv01 grid]$ ./runInstallerStarting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.Actual 22828 MBPassedChecking swap space: must be greater than 150 MB.Actual 4094 MBPassedChecking monitor: must be configured to display at least 256 colors.Actual 16777216PassedPreparing to launch Oracle Universal Installer from /tmp/OraInstall2014-12-20_04-55-35PM. Please wait...

Node 1[grid@Lugao-srv01 ~]$ su - rootPassword:[root@Lugao-srv01 ~]# /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 to oinstall.The execution of the script is complete.[root@Lugao-srv01 ~]#

Node 2:[grid@Lugao-srv01 ~]$ su - rootPassword:[root@Lugao-srv02 ~]# /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 to oinstall.The execution of the script is complete.[root@Lugao-srv02 ~]#

Node 1:[root@Lugao-srv01 ~]# /u01/app/11.2.0/grid/root.shRunning Oracle 11g root.sh script...

The following environment variables are set as:ORACLE_OWNER= gridORACLE_HOME=/u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:Copying dbhome to /usr/local/bin ...Copying oraenv to /usr/local/bin ...Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.2014-12-23 14:38:02: Parsing the host name2014-12-23 14:38:02: Checking for super user privileges2014-12-23 14:38:02: User has super user privilegesUsing configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_paramsCreating trace directory/home/grid/.bash_profile: line 15: racle: command not foundLOCAL ADD MODECreating OCR keys for user 'root', privgrp 'root'..Operation successful.root walletroot wallet certroot cert exportpeer walletprofile reader walletpa walletpeer wallet keyspa wallet keyspeer cert requestpa cert requestpeer certpa certpeer root cert TPprofile reader root cert TPpa root cert TPpeer pa cert TPpa peer cert TPprofile reader pa cert TPprofile reader peer cert TPpeer user certpa user certAdding daemon to inittabCRS-4123: Oracle High Availability Services has been started.ohasd is startingCRS-2672: Attempting to start 'ora.gipcd' on 'lugao-srv01'CRS-2672: Attempting to start 'ora.mdnsd' on 'lugao-srv01'CRS-2676: Start of 'ora.mdnsd' on 'lugao-srv01' succeededCRS-2676: Start of 'ora.gipcd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.gpnpd' on 'lugao-srv01'CRS-2676: Start of 'ora.gpnpd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.cssdmonitor' on 'lugao-srv01'CRS-2676: Start of 'ora.cssdmonitor' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.cssd' on 'lugao-srv01'CRS-2672: Attempting to start 'ora.diskmon' on 'lugao-srv01'CRS-2676: Start of 'ora.diskmon' on 'lugao-srv01' succeededCRS-2676: Start of 'ora.cssd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.ctssd' on 'lugao-srv01'CRS-2676: Start of 'ora.ctssd' on 'lugao-srv01' succeeded

ASM created and started successfully.

DiskGroup OCR_VOTE created successfully.

clscfg: -install mode specifiedSuccessfully accumulated necessary OCR keys.Creating OCR keys for user 'root', privgrp 'root'..Operation successful.CRS-2672: Attempting to start 'ora.crsd' on 'lugao-srv01'CRS-2676: Start of 'ora.crsd' on 'lugao-srv01' succeededCRS-4256: Updating the profileSuccessful addition of voting disk 9f1d71bfa1bc4f18bfcd9c4b36653fff.Successful addition of voting disk 39dbb90bc47a4feebf189d8448a6cd41.Successful addition of voting disk 078e6848f19c4f10bfb344e34bccc0a5.Successfully replaced voting disk group with +OCR_VOTE.CRS-4256: Updating the profileCRS-4266: Voting file(s) successfully replaced##STATEFile Universal IdFile Name Disk group--------------------------------- ---------1. ONLINE9f1d71bfa1bc4f18bfcd9c4b36653fff (ORCL:OCR_VOTE01) [OCR_VOTE]2. ONLINE39dbb90bc47a4feebf189d8448a6cd41 (ORCL:OCR_VOTE02) [OCR_VOTE]3. ONLINE078e6848f19c4f10bfb344e34bccc0a5 (ORCL:OCR_VOTE03) [OCR_VOTE]Located 3 voting disk(s).

CRS-2673: Attempting to stop 'ora.crsd' on 'lugao-srv01'CRS-2677: Stop of 'ora.crsd' on 'lugao-srv01' succeededCRS-2673: Attempting to stop 'ora.asm' on 'lugao-srv01'CRS-2677: Stop of 'ora.asm' on 'lugao-srv01' succeededCRS-2673: Attempting to stop 'ora.ctssd' on 'lugao-srv01'CRS-2677: Stop of 'ora.ctssd' on 'lugao-srv01' succeededCRS-2673: Attempting to stop 'ora.cssdmonitor' on 'lugao-srv01'CRS-2677: Stop of 'ora.cssdmonitor' on 'lugao-srv01' succeededCRS-2673: Attempting to stop 'ora.cssd' on 'lugao-srv01'CRS-2677: Stop of 'ora.cssd' on 'lugao-srv01' succeededCRS-2673: Attempting to stop 'ora.gpnpd' on 'lugao-srv01'CRS-2677: Stop of 'ora.gpnpd' on 'lugao-srv01' succeededCRS-2673: Attempting to stop 'ora.gipcd' on 'lugao-srv01'CRS-2677: Stop of 'ora.gipcd' on 'lugao-srv01' succeededCRS-2673: Attempting to stop 'ora.mdnsd' on 'lugao-srv01'CRS-2677: Stop of 'ora.mdnsd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.mdnsd' on 'lugao-srv01'CRS-2676: Start of 'ora.mdnsd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.gipcd' on 'lugao-srv01'CRS-2676: Start of 'ora.gipcd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.gpnpd' on 'lugao-srv01'CRS-2676: Start of 'ora.gpnpd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.cssdmonitor' on 'lugao-srv01'CRS-2676: Start of 'ora.cssdmonitor' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.cssd' on 'lugao-srv01'CRS-2672: Attempting to start 'ora.diskmon' on 'lugao-srv01'CRS-2676: Start of 'ora.diskmon' on 'lugao-srv01' succeededCRS-2676: Start of 'ora.cssd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.ctssd' on 'lugao-srv01'CRS-2676: Start of 'ora.ctssd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.asm' on 'lugao-srv01'CRS-2676: Start of 'ora.asm' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.crsd' on 'lugao-srv01'CRS-2676: Start of 'ora.crsd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.evmd' on 'lugao-srv01'CRS-2676: Start of 'ora.evmd' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.asm' on 'lugao-srv01'CRS-2676: Start of 'ora.asm' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.OCR_VOTE.dg' on 'lugao-srv01'CRS-2676: Start of 'ora.OCR_VOTE.dg' on 'lugao-srv01' succeededCRS-2672: Attempting to start 'ora.registry.acfs' on 'lugao-srv01'CRS-2676: Start of 'ora.registry.acfs' on 'lugao-srv01' succeeded

lugao-srv012014/12/23 14:59:25/u01/app/11.2.0/grid/cdata/lugao-srv01/backup_20141223_145925.olrPreparing packages for installation...cvuqdisk-1.0.7-1Configure Oracle Grid Infrastructure for a Cluster ... succeededUpdating inventory properties for clusterwareStarting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.Actual 4094 MBPassedThe inventory pointer is located at /etc/oraInst.locThe inventory is located at /u01/app/oraInventory'UpdateNodeList' was successful.[root@Lugao-srv01 ~]#

Node 2:[root@Lugao-srv02 ~]# /u01/app/11.2.0/grid/root.shRunning Oracle 11g root.sh script...

The following environment variables are set as:ORACLE_OWNER= gridORACLE_HOME=/u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:Copying dbhome to /usr/local/bin ...Copying oraenv to /usr/local/bin ...Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.2014-12-23 15:01:01: Parsing the host name2014-12-23 15:01:01: Checking for super user privileges2014-12-23 15:01:01: User has super user privilegesUsing configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_paramsCreating trace directory/home/grid/.bash_profile: line 14: racle: command not foundLOCAL ADD MODECreating OCR keys for user 'root', privgrp 'root'..Operation successful.Adding daemon to inittabCRS-4123: Oracle High Availability Services has been started.ohasd is startingCRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node lugao-srv01, number 1, and is terminatingAn active cluster was found during exclusive startup, restarting to join the clusterCRS-2672: Attempting to start 'ora.mdnsd' on 'lugao-srv02'CRS-2676: Start of 'ora.mdnsd' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.gipcd' on 'lugao-srv02'CRS-2676: Start of 'ora.gipcd' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.gpnpd' on 'lugao-srv02'CRS-2676: Start of 'ora.gpnpd' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.cssdmonitor' on 'lugao-srv02'CRS-2676: Start of 'ora.cssdmonitor' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.cssd' on 'lugao-srv02'CRS-2672: Attempting to start 'ora.diskmon' on 'lugao-srv02'CRS-2676: Start of 'ora.diskmon' on 'lugao-srv02' succeededCRS-2676: Start of 'ora.cssd' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.ctssd' on 'lugao-srv02'CRS-2676: Start of 'ora.ctssd' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.drivers.acfs' on 'lugao-srv02'CRS-2676: Start of 'ora.drivers.acfs' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.asm' on 'lugao-srv02'CRS-2676: Start of 'ora.asm' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.crsd' on 'lugao-srv02'CRS-2676: Start of 'ora.crsd' on 'lugao-srv02' succeededCRS-2672: Attempting to start 'ora.evmd' on 'lugao-srv02'CRS-2676: Start of 'ora.evmd' on 'lugao-srv02' succeeded

lugao-srv022014/12/23 15:06:22/u01/app/11.2.0/grid/cdata/lugao-srv02/backup_20141223_150622.olrPreparing packages for installation...cvuqdisk-1.0.7-1Configure Oracle Grid Infrastructure for a Cluster ... succeededUpdating inventory properties for clusterwareStarting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.Actual 5855 MBPassedThe inventory pointer is located at /etc/oraInst.locThe inventory is located at /u01/app/oraInventory'UpdateNodeList' was successful.[root@Lugao-srv02 ~]#

Install Oracle Real Application (RAC) SoftwareConnect to one of RAC node as useroracle, launch Oracle universal installer to install Oracle RAC Software on servers as follows[oracle@Lugao-srv01 oracle]$ ./runInstallerStarting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.Actual 22828 MBPassedChecking swap space: must be greater than 150 MB.Actual 4094 MBPassedChecking monitor: must be configured to display at least 256 colors.Actual 16777216PassedPreparing to launch Oracle Universal Installer from /tmp/OraInstall2014-12-20_04-55-35PM. Please wait...

Node 1:[oracle@Lugao-srv01 ~]$ su - rootPassword:[root@Lugao-srv01 ~]#[root@Lugao-srv01 ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.shRunning Oracle 11g root.sh script...

The following environment variables are set as:ORACLE_OWNER= oracleORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:The file "dbhome" already exists in /usr/local/bin.Overwrite it? (y/n)[n]:The file "oraenv" already exists in /usr/local/bin.Overwrite it? (y/n)[n]:The file "coraenv" already exists in /usr/local/bin.Overwrite it? (y/n)[n]:

Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.Finished product-specific root actions.[root@Lugao-srv01 ~]#

Node 2:[oracle@Lugao-srv01 ~]$ su - rootPassword:[root@Lugao-srv02 app]# /u01/app/oracle/product/11.2.0/dbhome_1/root.shRunning Oracle 11g root.sh script...

The following environment variables are set as:ORACLE_OWNER= oracleORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:The file "dbhome" already exists in /usr/local/bin.Overwrite it? (y/n)[n]:The file "oraenv" already exists in /usr/local/bin.Overwrite it? (y/n)[n]:The file "coraenv" already exists in /usr/local/bin.Overwrite it? (y/n)[n]:

Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.Finished product-specific root actions.You have new mail in /var/spool/mail/root[root@Lugao-srv02 app]#

Using Oracle ASMCA Utility to Create ASM DiskgroupsConnect to one of RAC node as usergrid, start theasmcautility to create ASM disk group for Oracle database as follows[oracle@Lugao-srv01 grid]$ asmca

Using Oracle DBCA Utility to Create RAC DatabaseConnect to one of RAC node as useroracle, start thedbcautility to create database as follows[oracle@Lugao-srv01 grid]$ dbca

VERIFICATIONFinally the installation of Oracle Database Real Application Cluster on two nodes using virtual disk as shared storage is over.

Use several commands to verify working of RAC on all cluster nodes as follows[oracle@Lugao-srv01 bin]$ srvctl status database -d PCBRACInstance PCBRAC1 is running on node lugao-srv01Instance PCBRAC2 is running on node lugao-srv02[oracle@Lugao-srv01 bin]$

[grid@Lugao-srv02 ~]$ srvctl status database -d PCBRACInstance PCBRAC1 is running on node lugao-srv01Instance PCBRAC2 is running on node lugao-srv02[grid@Lugao-srv02 ~]$

[oracle@Lugao-srv02 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 24 16:27:29 2014

Copyright (c) 1982, 2009, Oracle.All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing options

SQL> select * from v$active_instances;

INST_NUMBER INST_NAME----------- ------------------------------------------------------------1 Lugao-srv01:PCBRAC12 Lugao-srv02:PCBRAC2SQL>

Verify working of SCAN NameSCAN DSN name provide a single name for clients to access Oracle database in a cluster independent of which server in the cluster.

From the machine separate from nodes forming cluster use Oracle Easy Connect method that involve SCAN Name to connect to the RAC database as followsC:\Users\Administrator>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 24 05:29:28 2014

Copyright (c) 1982, 2010, Oracle.All rights reserved.

SQL>connect system/[email protected]:1521/PCBRAC.LUSAM.TZConnected.SQL>SQL> col instance_name format a15SQL> col hostnames format a25SQL> select instance_name, host_name, status from v$instance;

INSTANCE_NAMEHOST_NAMESTATUS--------------- ------------------------- ------------PCBRAC2Lugao-srv02OPEN

Now, switch off the node shown on the above query (e.g.Lugao-srv02)then from any client use Oracle Easy connect method that involve SCAN Name to connect to the RAC database.Verify that you can connect to another active instanceC:\Users\Administrator>C:\Users\Administrator>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 24 05:32:24 2014

Copyright (c) 1982, 2010, Oracle.All rights reserved.

SQL>connect system/[email protected]:1521/PCBRAC.LUSAM.TZConnected.SQL>SQL> col instance_name format a15SQL> col host_name format a25SQL> select instance_name, host_name, status from v$instance;

INSTANCE_NAMEHOST_NAMESTATUS--------------- ------------------------- ------------PCBRAC1Lugao-srv01OPEN

Posted8th JanuarybySadock ObethLabels:RACReal Application Cluter0Add a comment4. JAN7

Moving Oracle Database Datafiles to Other Directory

Sometimes you may have requirement to move Oracle Datafiles to other locations due to several reasons such as the datafiles locations was not planned properly during database creation, you want to spread datafiles to different disks to improve I/O performance, the disk where datafiles reside is full and you want to give some free space, etc.

In Oracle database, the control file act like a map that show locations of all datafiles in the server. Thus for Oracle to identify the new locations of datafiles, controlfile needs to be edited. However the controlfile is binary file which cannot be edited direct by text editors. Oracle provide command to export the binary controlfile to a text file version where it can be edited

This capability can be utilized as one way to move Oracle Database datafile to other location. In fact this capability can be used also as a backup strategy for controlfile. It easy to recover from loss of all multiplexed binary versions of the control file due to a catastrophic failure from a trace file than most of the other methods. Thus Oracle recommend to backup to trace (create text file version of controlfile) controlfile at least each time the structure of database is changed e.g. adding or deleting datafiles on the tablespace

Steps to Go AboutDetermine Existing Locations of DatafilesCreate Editable Text Version of ControfileShutdown the InstanceMove the Datafiles to New LocationsEdit the Text ControlfileCreate New Binary Controlfiles From Text File VersionVerification

Determine Existing Locations of All DatafilesUse SQL*Plus to queryV$DATAFILEdata dictionary view to determine the location of all database datafiles in the server as followsSQL> select name from v$datafile;NAME---------------------------------------------------------------------------/prod1/app/oracle/oradata/PCBDB/system01.dbf/prod1/app/oracle/oradata/PCBDB/sysaux01.dbf/prod1/app/oracle/oradata/PCBDB/undotbs01.dbf/prod1/app/oracle/oradata/PCBDB/users01.dbf/prod1/app/oracle/oradata/PCBDB/example01.dbf/prod1/app/oracle/oradata/PCBDB/DEV_odi_user.dbf6 rows selected.

Create Editable Text Version of ControlfileOracle database has commandALTER DATABASE BACKUP CONTROLFILE TO TRACEto create a text version of controlfile from the binary file. Use the command as followsSQL> alter database backup controlfile to trace as '/home/oracle/pcbdbcontrolfile.sql';Database altered.

Shutdown the InstanceMake a clean shutdown of the database instance as followsSQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.

Move the Datafiles to New LocationsUse operating system utilizes such mv to move the desired datafile to new locations. For example the following command move the database datafilesusers01.dbfandexample01.dbfforUSERSandEXAMPLEStablespaces respectively from mount point/prod1to/prod2[oracle@Lugao-srv01~]$ mv /prod1/app/oracle/oradata/PCBDB/users01.dbf /prod2/app/oracle/oradata/PCBDB/users01.dbf[oracle@Lugao-srv01~]$[oracle@Lugao-srv01~]$ mv /prod1/app/oracle/oradata/PCBDB/example01.dbf /prod2/app/oracle/oradata/PCBDB/example01.dbf

Edit the Text Version of ControlfileThe text version of controlfile has two sets of scripts:#1. NORESETLOGS caseand#2. RESETLOGScase. For this case remove all other entries except the entries on the first script set to reflect the new locations of datafiles similar to the following entries--Set #1. NORESETLOGS caseSTARTUP NOMOUNTCREATE CONTROLFILE REUSE DATABASE "PCBDB" NORESETLOGSARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292LOGFILEGROUP 1 '/prod1/app/oracle/oradata/PCBDB/redo01.log'SIZE 50M BLOCKSIZE 512,GROUP 2 '/prod1/app/oracle/oradata/PCBDB/redo02.log'SIZE 50M BLOCKSIZE 512,GROUP 3 '/prod1/app/oracle/oradata/PCBDB/redo03.log'SIZE 50M BLOCKSIZE 512DATAFILE'/prod1/app/oracle/oradata/PCBDB/system01.dbf','/prod1/app/oracle/oradata/PCBDB/sysaux01.dbf','/prod1/app/oracle/oradata/PCBDB/undotbs01.dbf','/prod2/app/oracle/oradata/PCBDB/users01.dbf','/prod2/app/oracle/oradata/PCBDB/example01.dbf','/prod1/app/oracle/oradata/PCBDB/DEV_odi_user.dbf'CHARACTER SET AL32UTF8;RECOVER DATABASEALTER SYSTEM ARCHIVE LOG ALL;ALTER DATABASE OPEN;ALTER TABLESPACE TEMP ADD TEMPFILE '/prod1/app/oracle/oradata/PCBDB/temp01.dbf'SIZE 30408704REUSE AUTOEXTEND ON NEXT 655360MAXSIZE 32767M;ALTER TABLESPACE DEV_ODI_TEMP ADD TEMPFILE '/prod1/app/oracle/oradata/PCBDB/DEV_odi_temp.dbf'SIZE 104857600REUSE AUTOEXTEND ON NEXT 52428800MAXSIZE 1048576000;

Create New Binary Controlfiles from Text File VersionFinally create new binary version of controlfile from edited text file version buy executing the script file from SQL*Plus. TheREUSEoption on the script instruct Oracle to overwrite any existing controfiles with new filesSQL> @/home/oracle/pcbdbcontrolfile.sql;ORACLE instance started.

Total System Global Area849530880 bytesFixed Size1339824 bytesVariable Size532680272 bytesDatabase Buffers310378496 bytesRedo Buffers5132288 bytes

Control file created.

ORA-00283: recovery session canceled due to errorsORA-00264: no recovery required

System altered.Database altered.Tablespace altered.Tablespace altered.

Note:Ignore any error thrown that indicates the Oracle was attempting to recover the instance as no any recovery was required, the database was brought down clean

VerificationRun few commands as follows to very new locations of datafilesSQL> select instance_name, status from v$instance;

INSTANCE_NAMESTATUS---------------- ------------PCBDBOPEN

SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------/prod1/app/oracle/oradata/PCBDB/system01.dbf/prod1/app/oracle/oradata/PCBDB/sysaux01.dbf/prod1/app/oracle/oradata/PCBDB/undotbs01.dbf/prod2/app/oracle/oradata/PCBDB/users01.dbf/prod2/app/oracle/oradata/PCBDB/example01.dbf/prod1/app/oracle/oradata/PCBDB/DEV_odi_user.dbf6 rows selected.

Posted7th JanuarybySadock Obeth1View comments5. DEC12

Using RMAN Incremental Backup to Recover Standby Database in Oracle Data Guard

It may happen in Oracle data guard environment that the standby database is behind the primary database and some archivelogs to recover the standby database have been deleted at primary server before being shipped to the standby server. In this case the alert log will have entries with complain about Oracle failed to resolve the gap sequence automatically similar to the following

Thu Dec 11 15:19:26 2014FAL[client]: Failed to request gap sequenceGAP - thread 1 sequence 11498-11519DBID 1691272038 branch 632153977FAL[client]: All defined FAL servers have been attempted.-------------------------------------------------------------Check that the CONTROL_FILE_RECORD_KEEP_TIME initializationparameter is defined to a value that is sufficiently largeenough to maintain adequate log switch information to resolvearchivelog gaps.-------------------------------------------------------------

Here the archivelogs from 11498-11519 not found at primary database. In this case you have many options to solve the problem, one is to recreate the standby database that may require movement of the whole database to standby server if you have time to do so. However the least cost option is to take the missing gaps only from primary database though incremental backup

The Steps to Go AboutGet the Current SCN at Standby DatabaseCreate RMAN Incremental BackupCreate Standby Controlfile at Primary DatabaseMove the Backup files to the Standby ServerShutdown the Standby DatabaseCopy the Standby Controlfile to all LocationsMount the Standby DatabaseUse RMAN to Recover the DatabaseStart Managed Recovery ProcessVerification

Assumption:Standby database is running fine, only some archive log not applied at standby database but deleted/lost at primary database and not available to any server

Get the Current SCN at Standby Database[Standby Database] Query the standby database to get the current SCN, it will be used as demarcation point to start incremental backup at primary databaseSQL> select to_char(current_scn) from v$database;

TO_CHAR(CURRENT_SCN)----------------------------------------5993380642292

SQL>

Create RMAN Incremental Backup[Primary Database] Create RMAN incremental backup at primary database. Use the SCN from above step to mark demarcation point to start backupFDIDB-/home/oracle> export ORACLE_SID=FDIDBFDIDB-/home/oracle> rman target /Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 12 12:41:45 2014Copyright (c) 1982, 2009, Oracle and/or its affiliates.All rights reserved.

connected to target database: FDIDB (DBID=1691272038)

RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN5993380642292DATABASE FORMAT '/prod2/backup/fdidb/incr_for_stdby_%U';

Starting backup at 12-DEC-14

using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=43 device type=DISKallocated channel: ORA_DISK_2channel ORA_DISK_2: SID=53 device type=DISKbackup will be obsolete on date 19-DEC-14archived logs will not be kept or backed upRMAN-06755: WARNING: datafile 10: incremental-start SCN is too recent; using checkpoint SCN 5979602355940 insteadchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00004 name=/prod1/fdidb/dbs/users01.dbfinput datafile file number=00011 name=/prod1/fdidb/dbs/users03.dbfinput datafile file number=00003 name=/prod1/fdidb/dbs/sysaux01.dbfinput datafile file number=00005 name=/prod2/fdidb/dbs/cwmlite01.dbfinput datafile file number=00006 name=/prod2/fdidb/dbs/drsys01.dbfinput datafile file number=00008 name=/prod2/fdidb/dbs/tools01.dbfinput datafile file number=00013 name=/prod1/fdidb/dbs/sysaux02.dbfchannel ORA_DISK_1: starting piece 1 at 12-DEC-14channel ORA_DISK_2: starting full datafile backup setchannel ORA_DISK_2: specifying datafile(s) in backup setinput datafile file number=00010 name=/prod1/fdidb/dbs/users02.dbfskipping datafile 00010 because it has not changedinput datafile file number=00001 name=/prod1/fdidb/dbs/system01.dbfinput datafile file number=00014 name=/prod1/fdidb/dbs/system03.dbfinput datafile file number=00012 name=/prod1/fdidb/dbs/system02.dbfinput datafile file number=00002 name=/prod1/fdidb/dbs/undotbs01.dbfinput datafile file number=00009 name=/prod2/fdidb/dbs/xdb01.dbfinput datafile file number=00007 name=/prod2/fdidb/dbs/indx01.dbfchannel ORA_DISK_2: starting piece 1 at 12-DEC-14channel ORA_DISK_2: finished piece 1 at 12-DEC-14piece handle=/prod2/backup/fdidb/incr_for_stdby_3ippvroh_1_1 tag=TAG20141212T124352 comment=NONEchannel ORA_DISK_2: backup set complete, elapsed time: 00:01:15channel ORA_DISK_1: finished piece 1 at 12-DEC-14piece handle=/prod2/backup/fdidb/incr_for_stdby_3hppvrof_1_1 tag=TAG20141212T124352 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:37

using channel ORA_DISK_1using channel ORA_DISK_2backup will be obsolete on date 19-DEC-14archived logs will not be kept or backed upchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setincluding current control file in backup setchannel ORA_DISK_1: starting piece 1 at 12-DEC-14channel ORA_DISK_1: finished piece 1 at 12-DEC-14piece handle=/prod2/backup/fdidb/incr_for_stdby_3jppvrri_1_1 tag=TAG20141212T124352 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01Finished backup at 12-DEC-14

Create Standby Controlfile at Primary Database[Primary Database] Use SQL*Plus to create standby database at primary. It is better to create the standby controlfile after incremental backup operation this will avoid the necessity to catalog backup files when moved to standby serverFDIDB-/home/oracle> sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 12 12:51:21 2014Copyright (c) 1982, 2009, Oracle.All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database create standby controlfile as '/prod2/backup/fdidb/fdidb_standby.ctl';

Database altered.

Move the Backup files to the Standby Server[Primary Database] Use any utility to move the backup files to the standby server ready for recovery as follows. Use the same file structure as in primary server otherwise you will have to catalog the backup file at standby database (which is not bad actually)FDIDB-/prod2/backup/fdidb> ls -litotal 716080568983 -rw-rw----1 oracleoinstall10731520 Dec 12 12:51 fdidb_standby.ctl568826 -rw-rw----1 oracleoinstall250331136 Dec 12 12:45 incr_for_stdby_3hppvrof_1_1568829 -rw-rw----1 oracleoinstall94765056 Dec 12 12:45 incr_for_stdby_3ippvroh_1_1568834 -rw-rw----1 oracleoinstall10780672 Dec 12 12:45 incr_for_stdby_3jppvrri_1_1FDIDB-/prod2/backup/fdidb>FDIDB-/prod2/backup/fdidb> scp * [email protected]:/prod2/backup/fdidbPassword:fdidb_standby.ctl100%10MB5.1MB/s2.5MB/s00:02Max throughput:7.7MB/s

incr_for_stdby_3hppvrof_1_1100%239MB5.3MB/s1.4MB/s00:45Max throughput:8.8MB/s

incr_for_stdby_3ippvroh_1_1100%90MB5.7MB/s1.8MB/s00:16Max throughput:10.0MB/s

incr_for_stdby_3jppvrri_1_1100%10MB5.1MB/s3.3MB/s00:02Max throughput:10.0MB/s

FDIDB-/prod2/backup/fdidb>

Shutdown the Standby Database[Standby Database] However before shutting down the standby database, query the data dictionary to get the locations of all controlfilesSQL> select name from v$controlfile;

NAME-----------------------------------------/prod1/fdidb/log/control01.ctl/prod2/fdidb/log/control02.ctl/prod3/fdidb/log/control03.ctl

SQL> shutdown immediateORA-01109: database not openDatabase dismounted.ORACLE instance shut down.

Copy the Standby Controlfile to all Locations[Standby Database] Copy the standby controlfile moved from primary database to all location specified by above query tov$controlfileview as followsFDIDB-/prod2/backup/fdidb> ls -litotal 716064769 -rw-r-----1 oracleusers10731520 Dec 12 11:31 fdidb_standby.ctl873 -rw-r-----1 oracleusers250331136 Dec 12 11:32 incr_for_stdby_3hppvrof_1_1874 -rw-r-----1 oracleusers94765056 Dec 12 11:32 incr_for_stdby_3ippvroh_1_1875 -rw-r-----1 oracleusers10780672 Dec 12 11:32 incr_for_stdby_3jppvrri_1_1FDIDB-/prod2/backup/fdidb>FDIDB-/prod2/backup/fdidb>FDIDB-/prod2/backup/fdidb> cp -f fdidb_standby.ctl /prod1/fdidb/log/control01.ctlFDIDB-/prod2/backup/fdidb> cp -f fdidb_standby.ctl /prod2/fdidb/log/control02.ctlFDIDB-/prod2/backup/fdidb> cp -f fdidb_standby.ctl /prod3/fdidb/log/control03.ctl

Mount the Standby Database[Standby Database] Mount the Standby Database ready for recoverySQL> startup nomountORACLE instance started.Total System Global Area217157632 bytesFixed Size2168376 bytesVariable Size159386056 bytesDatabase Buffers50331648 bytesRedo Buffers5271552 bytesSQL>SQL> alter database mount standby database;Database altered.

Use RMAN to Recover the Database[Standby Database] Finally use the command"recover database noredo"to apply the incremental backups only created from primary database. Ifnoredooption is omitted, RMAN will attempt to continue recovery using archivelogs, where at some point it will fail when it attempt to apply archived log not yet generated. Thus to be safe usenoredooption as follows

FDIDB-/home/oracle/product/11.2.0/dbhome_1> rman target/Recovery Manager: Release 11.2.0.1.0 - Production on Fri Dec 12 11:40:54 2014Copyright (c) 1982, 2009, Oracle and/or its affiliates.All rights reserved.

connected to target database: FDIDB (DBID=1451242038, not open)

RMAN> recover database noredo;

Starting recover at 12-DEC-14using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=14 device type=DISKallocated channel: ORA_DISK_2channel ORA_DISK_2: SID=100 device type=DISKchannel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00001: /prod3/fdidb/dbs/system01.dbfdestination for restore of datafile 00002: /prod3/fdidb/dbs/undotbs01.dbfdestination for restore of datafile 00007: /prod3/fdidb/dbs/indx01.dbfdestination for restore of datafile 00009: /prod3/fdidb/dbs/xdb01.dbfdestination for restore of datafile 00012: /prod3/fdidb/dbs/system02.dbfdestination for restore of datafile 00014: /prod3/fdidb/dbs/system03.dbfchannel ORA_DISK_1: reading from backup piece /prod2/backup/fdidb/incr_for_stdby_3ippvroh_1_1channel ORA_DISK_2: starting incremental datafile backup set restorechannel ORA_DISK_2: specifying datafile(s) to restore from backup setdestination for restore of datafile 00003: /prod3/fdidb/dbs/sysaux01.dbfdestination for restore of datafile 00004: /prod3/fdidb/dbs/users01.dbfdestination for restore of datafile 00005: /prod3/fdidb/dbs/cwmlite01.dbfdestination for restore of datafile 00006: /prod3/fdidb/dbs/drsys01.dbfdestination for restore of datafile 00008: /prod3/fdidb/dbs/tools01.dbfdestination for restore of datafile 00011: /prod3/fdidb/dbs/users03.dbfdestination for restore of datafile 00013: /prod3/fdidb/dbs/sysaux02.dbfchannel ORA_DISK_2: reading from backup piece /prod2/backup/fdidb/incr_for_stdby_3hppvrof_1_1channel ORA_DISK_1: piece handle=/prod2/backup/fdidb/incr_for_stdby_3ippvroh_1_1 tag=TAG20141212T124352channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete,