172
http://oracleinstance.blogspot.in/2010/03/oracle-10g-installation-in-linux-5.html http://samadhandba.wordpress.com/category/administration/page/2/ BA!"# A%& '()*('+ ,(%A' ), omplete 'eco ery ith ' A% Bac up. pre ious post i ha e posted a complete reco ery with user-managed bac up here we are going to see the complete reco ery using rman bac up. you can per orm complete reco ery in the ollowing 5 situations. ' A% 'eco ery ,cenarios o complete reco ery. 1. omplete losed &atabase 'eco ery. ,ystem data ile is missing 2. omplete )pen &atabase 'eco ery. %on system data ile is missing 3. omplete )pen &atabase 'eco ery 4when the database is initially closed . %on system data ile is missing 6. 'eco ery o a &ata ile that has no bac ups. 5. 'estore and 'eco ery o a &ata ile to a di erent location. 1.omplete losed &atabase 'eco ery. ,ystem &ata ile is missing n this case complete reco ery is per ormed only the system data ile is missing so the database can be opened without reseting the redologs. 1. rman target / 2. startup mount7 3. restore database or data ile ile87 6. reco er database or data ile ile87 5. alter database open7 wor shop1: iew plainprint9 , ;< create user sweety identi ied by sweety7 "ser created. , ;< grant dba to sweety7 =rant succeeded.

Backup and Recovery Scenarios Complete Recovery With Rman Backup

Embed Size (px)

DESCRIPTION

Backup and Reco

Citation preview

http://oracleinstance.blogspot.in/2010/03/oracle-10g-installation-in-linux-5.htmlhttp://samadhandba.wordpress.com/category/administration/page/2/BACKUP AND RECOVERY SCENARIOS Complete Recovery With RMAN Backup. previous post i have posted a complete recovery with user-managed backup, here we are going to see the complete recovery using rman backup.you can perform complete recovery in the following 5 situations. RMAN Recovery Scenarios of complete recovery. 1. Complete Closed Database Recovery. System datafile is missing 2. Complete Open Database Recovery. Non system datafile is missing 3. Complete Open Database Recovery (when the database is initially closed). Non system datafile is missing 4. Recovery of a Datafile that has no backups. 5. Restore and Recovery of a Datafile to a different location.1.Complete Closed Database Recovery. System Datafile is missing In this case complete recovery is performed, only the system datafile is missing, so the database can be opened without reseting the redologs. 1. rman target / 2. startup mount; 3. restore database or datafile file#; 4. recover database or datafile file#; 5. alter database open;workshop1:view plainprint?SQL> create user sweety identified by sweety; User created. SQL> grant dba to sweety; Grant succeeded. SQL> shu immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> host rm -rf /u01/app/oracle/oradata/testdb/system01.dbf SQL> startup ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 130024128 bytes Database Buffers 310378496 bytes Redo Buffers 2973696 bytes Database mounted. ORA-01157: cannot identify/lock data file 1 - see DBWR trace file ORA-01110: data file 1: '/u01/app/oracle/oradata/testdb/system01.dbf' SQL> shutdown immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL> [oracle@cdbs1 ~]$ rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Fri May 7 23:53:51 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database (not started) RMAN> startup mount Oracle instance started database mounted Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 130024128 bytes Database Buffers 310378496 bytes Redo Buffers 2973696 bytes RMAN> RESTORE DATABASE; Starting restore at 07-MAY-10 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=DISK channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u01/app/oracle/oradata/testdb/system01.dbf restoring datafile 00002 to /u01/app/oracle/oradata/testdb/undotbs01.dbf restoring datafile 00003 to /u01/app/oracle/oradata/testdb/sysaux01.dbf restoring datafile 00004 to /u01/app/oracle/oradata/testdb/users01.dbf restoring datafile 00005 to /u03/oradata/test01.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/TESTDB/backupset/2010_05_07/o1_mf_nnndf_TAG20100507T232259_5y8nvxt2_.bkp channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/flash_recovery_area/TESTDB/backupset/2010_05_07/o1_mf_nnndf_TAG20100507T232259_5y8nvxt2_.bkp tag=TAG20100507T232259 channel ORA_DISK_1: restore complete, elapsed time: 00:02:52 Finished restore at 07-MAY-10 RMAN> RECOVER DATABASE; Starting recover at 07-MAY-10 using channel ORA_DISK_1 starting media recovery RMAN> sql 'alter database open'; sql statement: alter database open RMAN> SQL> conn sys/oracle as sysdba; Connected. SQL> col name format a45 SQL> select name , status from v$datafile; NAME STATUS --------------------------------------------- ------- /u01/app/oracle/oradata/testdb/system01.dbf SYSTEM /u01/app/oracle/oradata/testdb/undotbs01.dbf ONLINE /u01/app/oracle/oradata/testdb/sysaux01.dbf ONLINE /u01/app/oracle/oradata/testdb/users01.dbf ONLINE /u03/oradata/test01.dbf ONLINE SQL> select username from dba_users 2 where username='SWEETY'; USERNAME ------------------------------ SWEETY 2.Complete Open Database Recovery. Non system datafile is missing,database is up1. rman target / 2. sql 'alter tablespace offline immediate'; or sql 'alter database datafile file# offline; 3. restore datafile 3; 4. recover datafile 3; 5. sql 'alter tablespace online'; or sql 'alter database datafile file# online;workshop2:

view plainprint?SQL> conn sweety/sweety; Connected. SQL> create table demo(id number); Table created. SQL> insert into demo values(123); 1 row created. SQL> commit; Commit complete. SQL> conn sys/oracle as sysdba; Connected. SQL> select username,default_tablespace from dba_users 2 where username='SWEETY'; USERNAME DEFAULT_TABLESPACE ------------------------------ ------------------------------ SWEETY USERS SQL> host rm -rf /u01/app/oracle/oradata/testdb/users01.dbf SQL> conn sweety/sweety Connected. SQL> alter system flush buffer_cache; System altered. SQL> select * from demo; select * from demo * ERROR at line 1: ORA-01116: error in opening database file 4 ORA-01110: data file 4: '/u01/app/oracle/oradata/testdb/users01.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 [oracle@cdbs1 ~]$ rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Sat May 8 01:35:09 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: TESTDB (DBID=2501713962) RMAN> sql 'alter database datafile 4 offline'; using target database control file instead of recovery catalog sql statement: alter database datafile 4 offline RMAN> restore datafile 4; Starting restore at 08-MAY-10 using channel ORA_DISK_1 ... channel ORA_DISK_1: restore complete, elapsed time: 00:00:09 Finished restore at 08-MAY-10 RMAN> recover datafile 4; Starting recover at 08-MAY-10 using channel ORA_DISK_1 starting media recovery ...... media recovery complete, elapsed time: 00:00:05 Finished recover at 08-MAY-10 RMAN> sql 'alter database datafile 4 online'; sql statement: alter database datafile 4 online RMAN>exit SQL> conn sweety/sweety; Connected. SQL> select * from demo; ID ---------- 123 SQL>

3.Complete Open Database Recovery (when the database is initially closed).Non system datafile is missingA user datafile is reported missing when trying to startup the database. The datafile can be turned offline and the database started up. Restore and recovery are performed using Rman. After recovery is performed the datafile can be turned online again. 1. sqlplus /nolog 2. connect / as sysdba 3. startup mount 4. alter database datafile '' offline; 5. alter database open; 6. exit; 7. rman target / 8. restore datafile ''; 9. recover datafile ''; 10. sql 'alter tablespace online';

workshop3:

view plainprint?SQL> conn sweety/sweety; Connected. SQL> create table test ( testid number); Table created. SQL> insert into test values(54321); 1 row created. SQL> commit; Commit complete. SQL> conn sys/oracle as sysdba; Connected. SQL>shu immediate SQL> host rm -rf /u01/app/oracle/oradata/testdb/users01.dbf SQL> startup ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 138412736 bytes Database Buffers 301989888 bytes Redo Buffers 2973696 bytes Database mounted. ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/testdb/users01.dbf' SQL> alter database datafile 4 offline; Database altered. SQL> alter database open; Database altered. [oracle@cdbs1 ~]$ rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Sat May 8 01:51:45 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: TESTDB (DBID=2501713962) RMAN> restore datafile 4; Starting restore at 08-MAY-10 using target database control file instead of recovery catalog ..... channel ORA_DISK_1: restore complete, elapsed time: 00:00:04 Finished restore at 08-MAY-10 RMAN> recover datafile 4; Starting recover at 08-MAY-10 using channel ORA_DISK_1 starting media recovery ..... media recovery complete, elapsed time: 00:00:08 Finished recover at 08-MAY-10 RMAN> exit SQL> alter database datafile 4 online; Database altered. SQL> conn sweety/sweety; Connected. SQL> select * from test; TESTID ---------- 54321 4.Recovery of a Datafile that has no backups (database is up).If a non system datafile that was not backed up since the last backup is missing, recovery can be performed if all archived logs since the creation of the missing datafile exist. Since the database is up you can check the tablespace name and put it offline. The option offline immediate is used to avoid that the update of the datafile header. Pre requisites: All relevant archived logs. 1. sqlplus '/ as sysdba' 2. alter tablespace offline immediate; 3. alter database create datafile '/user/oradata/u01/dbtst/newdata01.dbf; 4. exit 5. rman target / 6. recover tablespace ; 7. sql 'alter tablespace online'; If the create datafile command needs to be executed to place the datafile on a location different than the original use: alter database create datafile '/user/oradata/u01/dbtst/newdata01.dbf' as '/user/oradata/u02/dbtst/newdata01.dbf'restriction: controlfile creation time must be prior than datafile creation time.for more reference refer previous blog post.(user-managed complete recovery).workshop4: view plainprint?SQL> create user john identified by john 2 default tablespace testing; User created. SQL> grant dba to john; Grant succeeded. SQL> conn john/john; Connected. SQL> create table test_tb( testid number); Table created. SQL> insert into test_tb values(1001); 1 row created. SQL> commit; Commit complete. SQL> select * from test_tb; TESTID ---------- 1001 SQL> conn sys/oracle as sysdba; Connected. SQL> host rm -rf /u03/oradata/test01.dbf SQL> alter system flush buffer_cache; System altered. SQL> conn john/john; Connected. SQL> select * from test_tb; select * from test_tb * ERROR at line 1: ORA-01116: error in opening database file 5 ORA-01110: data file 5: '/u03/oradata/test01.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 SQL> conn sys/oracle as sysdba; Connected. SQL> alter tablespace testing offline immediate; Tablespace altered. ---if you want to create datafile in same location SQL> alter database create datafile '/u03/oradata/test01.dbf'; Database altered. ---if you want to create a datafile in different location(disk). SQL> alter database create datafile '/u03/oradata/test01.dbf' as '/u01/app/oracle/oradata/testdb/test01.dbf'; Database altered. [oracle@cdbs1 ~]$ rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Sat May 8 02:15:28 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: TESTDB (DBID=2501713962) RMAN> recover tablespace testing; Starting recover at 08-MAY-10 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=145 devtype=DISK starting media recovery SQL> alter tablespace testing online; Tablespace altered. SQL> conn john/john; Connected. SQL> select * from test_tb; TESTID ---------- 1001 5.Restore and Recovery of a Datafile to a different location. Database is up.If a non system datafile is missing and its original location not available, restore can be made to a different location and recovery performed. Pre requisites: All relevant archived logs, complete cold or hot backup. 1. Use OS commands to restore the missing or corrupted datafile to the new location, ie: cp -p /user/backup/uman/user01.dbf /user/oradata/u02/dbtst/user01.dbf 2. alter tablespace offline immediate; 3. alter tablespace rename datafile '/user/oradata/u01/dbtst/user01.dbf' to '/user/oradata/u02/dbtst/user01.dbf'; 4. rman target / 5. recover tablespace ; 6. sql 'alter tablespace online';workshop5:

follow the same example workshop4 for workshop 5 except creating new datafile, here you have to copy the recent backup file to the new disk location and perform recovery. thats it , rest of the procedures are same.BACKUP AND RECOVERY SCENARIOSComplete Recovery With User-managed Backup. you can perform complete recovery in the below 5 situations.

User Managed Recovery Scenarios of complete recovery. 1. Complete Closed Database Recovery. System datafile is missing(with recent backups) 2. Complete Open Database Recovery. Non system datafile is missing(with backups). 3. Complete Open Database Recovery (when the database is initially closed). Non system datafile is missing(with backups) 4. Recovery of a Missing Datafile that has no backups.(Disk corrupted and no backups available) restriction: datafile should be created after controlfile creation.(i.e,controlfile creation time is prior than datafile creation time).you cannot recover or create datafile without backup in the following situation: view plainprint?SQL> select CONTROLFILE_CREATED from v$database; CONTROLFILE_CREATED -------------------- 07-MAY-2010 01:23:43 view plainprint?SQL> select creation_time,name from v$datafile; CREATION_TIME NAME -------------------- --------------------------------------------- 30-JUN-2005 19:10:11 /u01/app/oracle/oradata/testdb/system01.dbf 30-JUN-2005 19:55:01 /u01/app/oracle/oradata/testdb/undotbs01.dbf 30-JUN-2005 19:10:27 /u01/app/oracle/oradata/testdb/sysaux01.dbf 30-JUN-2005 19:10:40 /u01/app/oracle/oradata/testdb/users01.dbf

5. Restore and Recovery of a Datafile to a different location.(Disk corrupted having recent backup and recover the datafile in new Disk location).

User Managed Recovery Scenarios User managed recovery scenarios do require that the database is in archive log mode, and that backups of all datafiles and control files are made with the tablespaces set to begin backup, if the database is open while the copy is made. At the end of the copy of each tablespace it is necessaire to take it out of backup mode. Alternatively complete backups can be made with the database shutdown. Online redologs can be optionally backed up. Files to be copied: select name from v$datafile; select member from v$logfile; # optional select name from v$controlfile;1.Complete Closed Database Recovery. System tablespace is missing If the system tablespace is missing or corrupted the database cannot be started up so a complete closed database recovery must be performed. Pre requisites: A closed or open database backup and archived logs. 1. Use OS commands to restore the missing or corrupted system datafile to its original location from recent backup, ie: cp -p /user/backup/uman/system01.dbf /user/oradata/u01/dbtst/system01.dbf 2. startup mount; 3. recover datafile 1; 4. alter database open;workshop1: system datafile recovery with recent backup

view plainprint?SQL> create user rajesh identified by rajesh; User created. SQL> grant dba to rajesh; Grant succeeded. SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. i manually deleted the datafile system01.dbf for testing purpose only SQL> startup ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 138412736 bytes Database Buffers 301989888 bytes Redo Buffers 2973696 bytes Database mounted. ORA-01157: cannot identify/lock data file 1 - see DBWR trace file ORA-01110: data file 1: '/u01/app/oracle/oradata/testdb/system01.dbf' SQL> shutdown immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL> host cp /u01/app/oracle/oradata/backup/system01.dbf /u01/app/oracle/oradata/testdb/system01.dbf system datafile restored from recent backup SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 7 12:51:16 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Enter user-name: sys as sysdba Enter password: Connected to an idle instance. SQL> startup mount ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 138412736 bytes Database Buffers 301989888 bytes Redo Buffers 2973696 bytes Database mounted. SQL> recover datafile 1; ORA-00279: change 454383 generated at 05/07/2010 01:40:11 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_%u_.arc ORA-00280: change 454383 for thread 1 is in sequence #7 Specify log: {=suggested | filename | AUTO | CANCEL} auto ORA-00279: change 456007 generated at 05/07/2010 12:46:10 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_8_%u_.arc ORA-00280: change 456007 for thread 1 is in sequence #8 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_5y7hkty0_.arc' no longer needed for this recovery . . . ORA-00279: change 456039 generated at 05/07/2010 12:46:22 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_11_%u_.arc ORA-00280: change 456039 for thread 1 is in sequence #11 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_10_5y7hl7dr_.arc' no longer needed for this recovery Log applied. Media recovery complete. SQL> alter database open; Database altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 12 Next log sequence to archive 14 Current log sequence 14 SQL> select username from dba_users 2 where username='RAJESH'; USERNAME ------------------------------ RAJESH

2.Complete Open Database Recovery. Non system tablespace is missing If a non system tablespace is missing or corrupted while the database is open, recovery can be performed while the database remain open. Pre requisites: A closed or open database backup and archived logs. 1. Use OS commands to restore the missing or corrupted datafile to its original location, ie: cp -p /user/backup/uman/user01.dbf /user/oradata/u01/dbtst/user01.dbf

2. alter tablespace offline immediate; 3. recover tablespace ; 4. alter tablespace online;

workshop2: Non-system datafile recovery from recent backup when database is open view plainprint?SQL> ALTER USER rajesh DEFAULT TABLESPACE users; User altered. SQL> conn rajesh/rajesh; Connected. SQL> create table demo(id number); Table created. SQL> insert into demo values(123); 1 row created. SQL> commit; Commit complete. SQL> select * from demo; ID ---------- 123 SQL> conn sys/oracle as sysdba; Connected. SQL> alter system switch logfile; System altered. SQL> / System altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 14 Next log sequence to archive 16 Current log sequence 16 i manually deleted the datafile users01.dbf for testing purpose only SQL> conn rajesh/rajesh; Connected. SQL> alter system flush buffer_cache; System altered. SQL> select * from demo; select * from demo * ERROR at line 1: ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '/u01/app/oracle/oradata/testdb/users01.dbf' SQL> conn sys/oracle as sysdba; Connected. SQL> host cp -p /u01/app/oracle/oradata/backup/users01.dbf /u01/app/oracle/oradata/testdb/users01.dbf restore the users01.dbf datafile from recent backup to the testdb folder SQL> alter tablespace users offline immediate; Tablespace altered. SQL> recover tablespace users; ORA-00279: change 454383 generated at 05/07/2010 01:40:11 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_%u_.arc ORA-00280: change 454383 for thread 1 is in sequence #7 Specify log: {=suggested | filename | AUTO | CANCEL} auto ORA-00279: change 456007 generated at 05/07/2010 12:46:10 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_8_%u_.arc ORA-00280: change 456007 for thread 1 is in sequence #8 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_5y7hkty0_.arc' no longer needed for this recovery ..... ...... ORA-00279: change 456044 generated at 05/07/2010 12:46:28 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_13_%u_.arc ORA-00280: change 456044 for thread 1 is in sequence #13 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_12_5y7hldl2_.arc' no longer needed for this recovery Log applied. Media recovery complete. SQL> alter tablespace users online; Tablespace altered. SQL> conn rajesh/rajesh; Connected. SQL> select * from demo; ID ---------- 123 3.Complete Open Database Recovery (when the database is initially closed).Non system datafile is missing If a non system tablespace is missing or corrupted and the database crashed, recovery can be performed after the database is open. Pre requisites: A closed or open database backup and archived logs. 1. startup; (you will get ora-1157 ora-1110 and the name of the missing datafile, the database will remain mounted) 2. alter database datafile3 offline; (tablespace cannot be used because the database is not open) 3. alter database open; 4. Use OS commands to restore the missing or corrupted datafile to its original location, ie: cp -p /user/backup/uman/user01.dbf /user/oradata/u01/dbtst/user01.dbf 5. recover datafile 3; 6. alter tablespace online;workshop 3:Non system datafile is missing

view plainprint?SQL> conn sys/oracle as sysdba; Connected. SQL> alter system switch logfile; System altered. SQL> select username,default_tablespace from dba_users 2 where username='RAJESH'; USERNAME DEFAULT_TABLESPACE ------------------------------ ------------------------------ RAJESH USERS SQL> conn rajesh/rajesh; Connected. SQL> create table testtbl (id number); Table created. SQL> insert into testtbl values(786); 1 row created. SQL> commit; Commit complete. SQL> select * from testtbl; ID ---------- 786 SQL> conn sys/oracle as sysdba; Connected. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> --manually deleting the users01.dbf datafile from testdb folder warning:for testing purpose only SQL> host rm -rf /u01/app/oracle/oradata/testdb/users01.dbf SQL> startup ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 142607040 bytes Database Buffers 297795584 bytes Redo Buffers 2973696 bytes Database mounted. ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/testdb/users01.dbf' SQL> alter database datafile 4 offline; Database altered. SQL> alter database open; Database altered. SQL> host cp -p /u01/app/oracle/oradata/backup/users01.dbf /u01/app/oracle/oradata/testdb/users01.dbf copying user01.dbf from the recent backup to the testdb folder SQL> recover datafile 4; ORA-00279: change 454383 generated at 05/07/2010 01:40:11 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_%u_.arc ORA-00280: change 454383 for thread 1 is in sequence #7 Specify log: { =suggested | filename | AUTO | CANCEL} auto ORA-00279: change 456007 generated at 05/07/2010 12:46:10 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_8_%u_.arc ORA-00280: change 456007 for thread 1 is in sequence #8 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_5y7hkty0_.arc' no longer needed for this recovery ...... ......... ORA-00279: change 456046 generated at 05/07/2010 12:46:29 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_14_%u_.arc ORA-00280: change 456046 for thread 1 is in sequence #14 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_13_5y7hlfbc_.arc' no longer needed for this recovery Log applied. Media recovery complete. SQL> alter database datafile 4 online; Database altered. SQL> conn rajesh/rajesh; Connected. SQL> select * from testtbl; ID ---------- 786 4.Recovery of a Missing Datafile that has no backups (database is open). If a non system datafile that was not backed up since the last backup is missing,

recovery can be performed if all archived logs since the creation of the missing datafile exist. Pre requisites: All relevant archived logs. 1. alter tablespace offline immediate; 2. alter database create datafile '/user/oradata/u01/dbtst/newdata01.dbf'; 3. recover tablespace ; 4. alter tablespace online;

If the create datafile command needs to be executed to place the datafile on a location different than the original use: alter database create datafile '/user/oradata/u01/dbtst/newdata01.dbf' as '/user/oradata/u02/dbtst/newdata01.dbf'

restriction: datafile should be created after controlfile creation.(i.e,controlfile creation time is prior than datafile creation time).workshop 4: Missing Non-system Datafile having no backups view plainprint?SQL> alter session set nls_date_format='DD-MON-YYYY hh24:mi:ss'; Session altered. SQL> select controlfile_created from v$database; CONTROLFILE_CREATED -------------------- 07-MAY-2010 16:27:22 SQL> col name format a45 SQL> select creation_time,name from v$datafile; CREATION_TIME NAME -------------------- --------------------------------------------- 30-JUN-2005 19:10:11 /u01/app/oracle/oradata/testdb/system01.dbf 30-JUN-2005 19:55:01 /u01/app/oracle/oradata/testdb/undotbs01.dbf 30-JUN-2005 19:10:27 /u01/app/oracle/oradata/testdb/sysaux01.dbf 30-JUN-2005 19:10:40 /u01/app/oracle/oradata/testdb/users01.dbf you cannot re-create the any one of the listed above datafile , without backup. SQL> create tablespace testing datafile 2 '/u01/app/oracle/oradata/testdb/test01.dbf' size 2m; Tablespace created. SQL> select creation_time,name from v$datafile; CREATION_TIME NAME -------------------- --------------------------------------------- 30-JUN-2005 19:10:11 /u01/app/oracle/oradata/testdb/system01.dbf 30-JUN-2005 19:55:01 /u01/app/oracle/oradata/testdb/undotbs01.dbf 30-JUN-2005 19:10:27 /u01/app/oracle/oradata/testdb/sysaux01.dbf 30-JUN-2005 19:10:40 /u01/app/oracle/oradata/testdb/users01.dbf 07-MAY-2010 16:32:07 /u01/app/oracle/oradata/testdb/test01.dbf we can re-create test01.dbf file without backup. SQL> select controlfile_created from v$database; CONTROLFILE_CREATED -------------------- 07-MAY-2010 16:27:22 ---we can recover the datafile test01.dbf without backup using view plainprint?create datafile command in recovery ---in this example i am going to create a table in testing tablespace view plainprint?and deleted the test01.dbf datafile and recover it without backup and view plainprint?create datafile recovery command. SQL> create user jay identified by jay 2 default tablespace testing; User created. SQL> grant dba to jay; Grant succeeded. SQL> select username,default_tablespace from dba_users 2 where username='JAY'; USERNAME DEFAULT_TABLESPACE ------------------------------ ------------------------------ JAY TESTING SQL> conn jay/jay; Connected. SQL> create table demo (id number); Table created. SQL> insert into demo values(321); 1 row created. SQL> commit; Commit complete. SQL> select * from demo; ID ---------- 321 SQL> conn sys/oracle as sysdba; Connected. SQL> host rm -rf /u01/app/oracle/oradata/testdb/test01.dbf ---manually deleting datafile test01.dbf for testing purpose SQL> conn jay/jay; Connected. SQL> select * from demo; ID ---------- 321 SQL> alter system flush buffer_cache; System altered. SQL> select * from demo; select * from demo * ERROR at line 1: ORA-01116: error in opening database file 5 ORA-01110: data file 5: '/u01/app/oracle/oradata/testdb/test01.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 SQL> alter database datafile 5 offline; Database altered. ----TO CREATE A NEW RECOVERED DATAFILE IN SAME LOCATION. SQL> alter database create datafile '/u01/app/oracle/oradata/testdb/test01.dbf'; Database altered. ----TO CREATE A NEW RECOVERED DATAFILE IN DIFFERENT LOCATION. SQL> alter database create datafile '/u01/app/oracle/oradata/testdb/test01.dbf' as '/u03/oradata/test01.dbf'; Database altered. SQL> recover datafile 5; ORA-00279: change 454443 generated at 05/07/2010 16:32:07 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_8_%u_.arc ORA-00280: change 454443 for thread 1 is in sequence #8 Specify log: {=suggested | filename | AUTO | CANCEL} auto ORA-00279: change 454869 generated at 05/07/2010 16:41:38 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_9_%u_.arc ORA-00280: change 454869 for thread 1 is in sequence #9 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_8_5y7xcbrm_.arc' no longer needed for this recovery ..... ....... ORA-00279: change 454874 generated at 05/07/2010 16:41:45 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_11_%u_.arc ORA-00280: change 454874 for thread 1 is in sequence #11 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_10_5y7xck8j_.arc' no longer needed for this recovery Log applied. Media recovery complete. SQL> alter database datafile 5 online; Database altered. SQL> conn jay/jay; Connected. SQL> select * from demo; ID ---------- 321 SQL>

5.Restore and Recovery of a Datafile to a different location.If a non system datafile is missing and its original location not available, restore can be made to a different location and recovery performed. Pre requisites: All relevant archived logs.

1. Use OS commands to restore the missing or corrupted datafile to the new location, ie: cp -p /user/backup/uman/user01.dbf /user/oradata/u02/dbtst/user01.dbf 2. alter tablespace offline immediate; 3. alter tablespace rename datafile '/user/oradata/u01/dbtst/user01.dbf' to '/user/oradata/u02/dbtst/user01.dbf'; 4. recover tablespace ; 5. alter tablespace online; workshop 5:view plainprint?SQL> create user lachu identified by lachu 2 default tablespace users; User created. SQL> grant dba to lachu; Grant succeeded. SQL> conn lachu/lachu; Connected. SQL> create table test_tb(id number); Table created. SQL> insert into test_tb values(123); 1 row created. SQL> commit; Commit complete. SQL> conn sys/oracle as sysdba; Connected. SQL> ---manually deleting users01.dbf datafile for testing purpose SQL> host rm -rf '/u01/app/oracle/oradata/testdb/users01.dbf' SQL> conn lachu/lachu; Connected. SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- TEST_TB TABLE SQL> select * from test_tb; select * from test_tb * ERROR at line 1: ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '/u01/app/oracle/oradata/testdb/users01.dbf' SQL> conn sys/oracle as sysdba; Connected. SQL> alter database datafile 4 offline; Database altered. SQL> host cp -p /u01/app/oracle/oradata/backup/users01.dbf /u03/oradata/users01.dbf --restore datafile user01.dbf to new disk from the recent backup of the database. SQL> alter tablespace users rename datafile 2 '/u01/app/oracle/oradata/testdb/users01.dbf' to '/u03/oradata/users01.dbf'; Tablespace altered. SQL> recover datafile 4; ORA-00279: change 454383 generated at 05/07/2010 01:40:11 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_%u_.arc ORA-00280: change 454383 for thread 1 is in sequence #7 Specify log: {=suggested | filename | AUTO | CANCEL} auto ORA-00279: change 456007 generated at 05/07/2010 12:46:10 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_8_%u_.arc ORA-00280: change 456007 for thread 1 is in sequence #8 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_7_5y7hkty0_.arc' no longer needed for this recovery .... ...... ORA-00279: change 457480 generated at 05/07/2010 13:09:30 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_15_%u_.arc ORA-00280: change 457480 for thread 1 is in sequence #15 ORA-00278: log file '/u01/app/oracle/flash_recovery_area/TESTDB/archivelog/2010_05_07/o1_mf_1_14_5y7jxlvg_.arc' no longer needed for this recovery Log applied. Media recovery complete. SQL> alter database datafile 4 online; Database altered. SQL> select name from v$datafile; NAME --------------------------------------------- /u01/app/oracle/oradata/testdb/system01.dbf /u01/app/oracle/oradata/testdb/undotbs01.dbf /u01/app/oracle/oradata/testdb/sysaux01.dbf /u03/oradata/users01.dbf ----------restored in new location (disk) SQL> conn lachu/lachu; Connected. SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- TEST_TB TABLE SQL> select * from test_tb; ID ---------- 123 Block media recovery recovers an individual corrupt datablock or set of datablocks within a datafile. In cases when a small number of blocks require media recovery, you can selectively restore and recover damaged blocks rather than whole datafiles.More theoretical information read

Its possible to perform Block Media Recovery with having only OS based hot backups and having NO RMAN backups. Look at the following demonstration. Here: 1. Create a new user antony and a table corrupt_test in that schema. 2. Take OS backup (hot backup) of the users01.dbf where the table resides 3. Corrupt the data in that table and get block corruption error. 4. Connect with RMAN and try to use BLOCKRECOVER command. As we havent any backup, we get an error. 5. Catalog the hot backup to the RMAN repository. 6. Use BLOCKRECOVER command and recover the corrupted data block using cataloged hot backup of the datafile. 7. Query the table and get the data back! Here is the scenarioview plainprint?SQL> CREATE USER antony IDENTIFIED BY antony; User created. SQL> GRANT DBA TO antony; Grant succeeded. SQL> CONN antony/antony; Connected. SQL> CREATE TABLE corrupt_test (id NUMBER); Table created. SQL> INSERT INTO corrupt_test VALUES(123); 1 row created. SQL> COMMIT; Commit complete. SQL> COLUMN segment_name format a15 SQL> SELECT segment_name, tablespace_name from dba_segments 2 WHERE segment_name='CORRUPT_TEST'; SEGMENT_NAME TABLESPACE_NAME --------------- ------------------------------ CORRUPT_TEST USERS SQL> COLUMN tablespace_name format a15 SQL> COLUMN name FORMAT a43 SQL> SELECT segment_name, a.tablespace_name, b.name 2 FROM dba_segments a, v$datafile b 3 WHERE a.header_file=b.file# 4 AND a.segment_name='CORRUPT_TEST'; SEGMENT_NAME TABLESPACE_NAME NAME --------------- --------------- ------------------------------------------- CORRUPT_TEST USERS /u01/app/oracle/oradata/orcl/users01.dbf SQL> ALTER TABLESPACE USERS BEGIN BACKUP; Tablespace altered. SQL> host cp /u01/app/oracle/oradata/orcl/users01.dbf /u01/app/oracle/oradata/backup/users01_backup.dbf SQL> ALTER TABLESPACE USERS END BACKUP; Tablespace altered. SQL> SELECT header_block FROM dba_segments WHERE segment_name='CORRUPT_TEST'; HEADER_BLOCK ------------ 67 SQL> [oracle@cdbs1 ~]$ dd of=/u01/app/oracle/oradata/orcl/users01.dbf bs=8192 conv=notrunc seek=68 rajeshkumar testing block corruption > EOF 0+1 records in 0+1 records out [oracle@cdbs1 ~]$ SQL> Conn antony/antony Connected. SQL> ALTER SYSTEM FLUSH BUFFER_CACHE; System altered. SQL> select * from corrupt_test; select * from corrupt_test * ERROR at line 1: ORA-01578: ORACLE data block corrupted (file # 4, block # 67) ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl/users01.dbf' SQL> EXIT [oracle@cdbs1 ~]$ rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 6 01:41:46 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: ORCL (DBID=1245940166) RMAN> BLOCKRECOVER DATAFILE 4 BLOCK 68; Starting blockrecover at 06-MAY-10 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=143 devtype=DISK RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of blockrecover command at 05/06/2010 01:42:25 RMAN-06026: some targets not found - aborting restore RMAN-06023: no backup or copy of datafile 4 found to restore RMAN> RMAN> CATALOG DATAFILECOPY '/u01/app/oracle/oradata/backup/users01_backup.dbf'; cataloged datafile copy datafile copy filename=/u01/app/oracle/oradata/backup/users01_backup.dbf recid=1 stamp=718249432 RMAN> BLOCKRECOVER DATAFILE 4 BLOCK 68; Starting blockrecover at 06-MAY-10 using channel ORA_DISK_1 channel ORA_DISK_1: restoring block(s) from datafile copy /u01/app/oracle/oradata/backup/users01_backup.dbf starting media recovery media recovery complete, elapsed time: 00:00:02 Finished blockrecover at 06-MAY-10 RMAN> EXIT Recovery Manager complete. [oracle@cdbs1 ~]$sqlplus SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 6 01:45:04 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Enter user-name: sys as sysdba Enter password: Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> conn antony/antony Connected. SQL> select * from CORRUPT_TEST; ID ---------- 123 Command Line History and Editing in SQL*Plus and RMAN on Linuxrlwrap (readline wrapper) utility provides a command history and editing of keyboard input for any other command.

This article explains how to install rlwrap and set it up for SQL*Plus and RMAN.

Download the latest rlwrap software from the following URL.http://utopia.knoware.nl/~hlub/uck/rlwrap/ Unzip and install the software using the following commands. gunzip rlwrap*.gztar -xvf rlwrap*.tarcd rlwrap*./configuremakemake checkmake installRun the following commands, or better still append then to the ".bashrc" of the oracle software owner.alias rlsqlplus='rlwrap sqlplus'alias rlrman='rlwrap rman'You can now start SQL*Plus or RMAN using "rlsqlplus" and "rlrman" respectively, and you will have a basic command history and the current line will be editable using the arrow and delete keys.

[oracle@cdbs1 ~]$ rlrmanRecovery Manager: Release 10.2.0.1.0 - Production on Wed May 5 17:14:57 2010

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

RMAN> exit

Recovery Manager complete.

Instead of rlrman and rlsqlplus, you can use your own alias name for rman and sqlplus. More than that now you can use up and down arrow for previous past queries. [oracle@cdbs1 ~]$ alias rajesh='rlwrap rman'[oracle@cdbs1 ~]$ rajesh Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 5 17:15:27 2010

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

RMAN>

[oracle@cdbs1 ~]$ alias lakshmi='rlwrap sqlplus' [oracle@cdbs1 ~]$ lakshmi SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 5 17:21:38 2010

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

Enter user-name: sys as sysdba Enter password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options

SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 5 Next log sequence to archive 7 Current log sequence 7 SQL> select name from v$database;

NAME --------- ORCL

SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 5 Next log sequence to archive 7 Current log sequence 7 SQL> select name from v$database;

NAME --------- ORCLSQL>

Automated Storage Management (ASM) Pocket Reference Guide Automated Storage Management (ASM) Pocket Reference Guide by charles kim

ASM DiskgroupsCreate DiskgroupCREATE DISKGROUP disk_group_1 NORMALREDUNDANCYFAILGROUP failure_group_1 DISK'/devices/diska1' NAME diska1,'/devices/diska2' NAME diska2,FAILGROUP failure_group_2 DISK'/devices/diskb1' NAME diskb1,'/devices/diskb2' NAME diskb2;

Drop disk groupsDROP DISKGROUP DATA INCLUDING CONTENTS;

Add disksALTER DISKGROUP DATA ADD DISK '/dev/sda3';

Drop a diskALTER DISKGROUP DATA DROP DISK DATA_0001;

Resize all disks in a disk groupALTER DISKGROUP DATA RESIZE ALL SIZE 100G;

UNDROP DISKS clause of the ALTER DISKGROUPALTER DISKGROUP DATA UNDROP DISKS;

Rebalance diskgroupALTER DISKGROUP DATA REBALANCE POWER 5;

Check DiskgroupALTER DISKGROUP DATA CHECK;ALTER DISKGROUP DATA CHECK NOREPAIR;

Diskgroup Metadata Backupmd_backup -b asm_backup.mdb.txt -g data,fra

ASM Specific Init.ora Parameters*.cluster_database=true*.asm_diskstring='/dev/sd*1'*.instance_type=asm*.shared_pool_size=100M*.large_pool_size=80M*.db_cache_size=60M*.asm_diskgroups='DATA','FRA'

Initialize ASM for non-RAC./localconfig add

Manually start CSSD (non-RAC)/etc/init.d/init.cssd start

Manually stop CSSD ( non-RAC)/etc/init.d/init.cssd stop

Resetting CSS to new Oracle Homelocalconfig reset /apps/oracle/product/11.1.0/ASM

ASM Dictionary Viewsv$asm_alias ---list all aliases in all currently mounted diskgroupsv$asm_client ---list all the databases currently accessing the diskgroupsv$asm_disk ----lists all the disks discovered by the ASM instance.v$asm_diskgroup ---Lists all the diskgroups discovered by the ASM instance.v$asm_file ---Lists all files that belong to diskgroups mounted by the ASM instance.v$asm_operation ---Reports information about current active operations. Rebalance activity is reported in this view.v$asm_template ---Lists all the templates currently mounted by the ASM instance.v$asm_diskgroup_stat ---same as v$asm_diskgroup but does discover new disgroups. Use this view instead of v$asm_diskgroup.v$asm_disk_stat ---same as v$asm_disk but does not discover new disks. Use this view instead of v$asm_disk.

srvctl commandsADDsrvctl add asm -n rac3 -i +ASM3 -o /opt/oracle/app/product/10.2.0/asm

ENABLEsrvctl enable asm -n rac3 -i +ASM3

DISABLEsrvctl disable asm -n rac3 -i +ASM3

STARTsrvctl start asm -n rac3

STOPsrvctl stop asm -n rac3

CONFIGsrvctl config asm -n rac1

REMOVEsrvctl remove asm -n rac1STATUSsrvctl status asmsrvctl status asm -n rac1

MODIFYsrvctl modify asm -o -n rac1

ASMLIB commands ( as root)/etc/init.d/oracleasm start/etc/init.d/oracleasm stop/etc/init.d/oracleasm restart/etc/init.d/oracleasm configure/etc/init.d/oracleasm status/etc/init.d/oracleasm enable/etc/init.d/oracleasm disable/etc/init.d/oracleasm listdisks/etc/init.d/oracleasm deletedisk/etc/init.d/oracleasm scandisks/etc/init.d/oracleasm querydisk /dev/sdb1/etc/init.d/oracleasm createdisk /dev/sdb1 VOL1/etc/init.d/oracleasm renamedisk /dev/sdb1 VOL1

asmcmd Commandscd -----changes the current directory to the specified directorydu -----Displays the total disk space occupied by ASM files in the specified ASM directory and all its subdirectories, recursively.find -----Lists the paths of all occurrences of the specified name ( with wildcards) under the specified directory.ls +data/testdb ----Lists the contents of an ASM director, the attributes of the specified file, or the names and attributes of all disk groups.lsct -----Lists information about current ASM clients.lsdg ----Lists all disk groups and their attributesmkalias ----Creates an alias for a system generated filename.mkdir -----Creates ASM directories.pwd --------Displays the path of the current ASM directory.rm -------Deletes the specified ASM Files or directories.rm -f rmalias ---------Deletes the specified alias, retaining the file that the alias points tolsdsk ----------Lists disks visible to ASM.md_backup ------Creates a backup of all of the mounted disk groups.md_restore ------Restores disk groups from a backup.remap ----repairs a range of physical blocks on a disk.cp ------copies files into and out of ASM. **ASM diskgroup to OS file system. **OS file system to ASM diskgroup. **ASM diskgroup to another ASM diskgroup on the same server. **ASM disk group to ASM diskgroup on a remote server.

SYSASM Role (Starting in Oracle Database 11g)SQL> Grant sysasm to sys; ---sysdba deprecated sqlplus / as sysasm

ASM Rolling Upgrades STARTalter system start rolling migration to 11.2.0.2;

DISABLEalter system stop rolling migration;

Database INIT parameters for ASM.*.control_files='+DATA/orcl/controlfile/control1.ctl','+FRA/orcl/controlfile/control2.ctl'*.db_create_file_dest='+DATA'*.db_create_online_log_dest_1='+DATA'*.db_recovery_file_dest='+DATA'*.log_archive_dest_1='LOCATION=+DATA'*.log_file_name_convert='+DATA/VISKDR','+DATA/VISK' ##added for DG

MIGRATE to ASM using RMANrun{backup as copy database format '+DATA';switch database to copy;#For each logfilesql "alter database rename '/data/oracle/VISK/redo1a.rdo' to '+DATA' ";alter database open resetlogs;#For each tempfilesql "alter tablespace TEMP add tempfile" ;}

Restore Database to ASM using SET NEWNAME run{allocate channel d1 type disk;#For each datafileset newname for datafile 1 to '+DATA';restore database;switch datafile all;release channel d1;}Error: ORA-16825: Fast-Start Failover and other errors or warnings detected for the databaseORA-16795:database resource guard detects that database re-creation is requiredORA-16825:Fast-Start Failover and other errors or warnings detected for the database ORA-16817:unsynchronized Fast-Start Failover configuration

solution:

DGMGRL> show database rajesh

Database Name: rajesh Role: PRIMARY Enabled: YES Intended State: ONLINE Instance(s): rajesh

Current status for "rajesh":Error: ORA-16825: Fast-Start Failover and other errors or warnings detected for the database

DGMGRL> show database jeyanthi

Database Name: jeyanthi Role: PHYSICAL STANDBY Enabled: NO Intended State: ONLINE Instance(s): jeyanthi

Current status for "jeyanthi":Error: ORA-16661: the standby database needs to be reinstated

DGMGRL> reinstate database jeyanthi; Reinstating database "jeyanthi", please wait... Operation requires shutdown of instance "jeyanthi" on database "jeyanthi" Shutting down instance "jeyanthi"... ORA-01109: database not open

Database dismounted. ORACLE instance shut down. Operation requires startup of instance "jeyanthi" on database "jeyanthi" Starting instance "jeyanthi"... ORACLE instance started. Database mounted. Continuing to reinstate database "jeyanthi" ... Reinstatement of database "jeyanthi" succeeded DGMGRL> show configuration verbose;

Configuration Name: jeyanthi Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: ENABLED Databases: jeyanthi - Physical standby database - Fast-Start Failover target rajesh - Primary database

Fast-Start Failover Threshold: 30 seconds Observer: rac3

Current status for "jeyanthi": Warning: ORA-16607: one or more databases have failed

then,stop and start the observer.(start from another machine) DGMGRL> stop observer Done. DGMGRL> connect sys/oracle@jeyanthi Connected. DGMGRL> start observer Observer started

DGMGRL> show configuration verbose

Configuration Name: jeyanthi Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: ENABLED Databases: jeyanthi - Physical standby database - Fast-Start Failover target rajesh - Primary database

Fast-Start Failover Threshold: 30 seconds Observer: rac2

Current status for "jeyanthi": SUCCESSConfiguration of 10g Data Guard Broker and Observer for Switchover Configuring Data Guard Broker for Switchover, General Review.

On a previous document, 10g Data Guard, Physical Standby Creation, step by step I did describe how to implement a Data Guard configuration; on this document I'm adding how to configure the broker and observer, setup the database to Maximum Availability and managing switchover from Data Guard Manager, DGMGRL. Data Guard Broker permit to manage a Data Guard Configuration, from both the Enterprise Manager Grid Control console, or from a terminal in command line mode. In this document I will explore command line mode. Pre requisites include the use of 10g Oracle server, using spfile on both the primary and standby and a third server for the Observer, and configure the listeners to include a service for the Data Guard Broker.

The Enviroment 2 Linux servers, Oracle Distribution 2.6.9-55 EL i686 i386 GNU/Linux, the Primary and Standby databases are located on these servers. 1 Linux server, RH Linux 2.6.9-42.ELsmp x86_64 GNU/Linux, The Data Guard Broker Observer is located on this server Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 ssh is configured for user oracle on both nodes Oracle Home is on identical path on both nodes Primary database ANTONY Standby database JOHN

Step by Step Implementation of Data Guard BrokerEnable Data Guard Broker Start on the Primary and Standby databases SQL> ALTER SYSTEM SET DG_BROKER_START=TRUE SCOPE=BOTH; System altered. Setup the Local_Listener parameter on both the Primary and Standby databases SQL> ALTER SYSTEM SET LOCAL_LISTENER='LISTENER_VMRACTEST' SCOPE=BOTH; System altered. Setup the tnsnames to enable communication with both the Primary and Standby databases The listener.ora should include a service named global_db_nameDGMGRL to enable the broker to start the databases on the event of switchover. This configuration needs to be included on both servers.Listener.ora on Node 1 LISTENER_VMRACTEST = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.localdomain)(PORT = 1521)(IP = FIRST)) ) ) SID_LIST_LISTENER_VMRACTEST = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = antony) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1 ) (SID_NAME = antony) ) (SID_DESC = (SID_NAME= antony) (GLOBAL_DBNAME = antony_DGMGRL) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1 ) ) )Listener.ora on Node 2 LISTENER_VMRACTEST = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.localdomain)(PORT = 1521)(IP = FIRST)) ) ) SID_LIST_LISTENER_VMRACTEST = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = john) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1 ) (SID_NAME = john) ) (SID_DESC = (SID_NAME= john) (GLOBAL_DBNAME = john_DGMGRL) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1 ) ) )Tnsnames.ora on Node 1, 2 and the observer node ANTONY = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = antony_DGMGRL) ) ) JOHN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = john_DGMGRL) ) )Setup the Broker configuration files The broker configuration files are automatically created when the broker is started using ALTER SYSTEM SET DG_BROKER_START=TRUE. The default destination can be modified using the parameters DG_BROKER_CONFIG_FILE1 and DG_BROKER_CONFIG_FILE2On Primary: SQL>SHOW PARAMETERS DG_BROKER_CONFIG

NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ dg_broker_config_file1 string /u01/app/oracle/product/10.2.0 /db_1/dbs/dr1antony.dat dg_broker_config_file2 string /u01/app/oracle/product/10.2.0 /db_1/dbs/dr2antony.dat

On standby: SQL> SHOW PARAMETERS DG_BROKER_CONFIG

NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ dg_broker_config_file1 string /u01/app/oracle/product/10.2.0 /db_1/dbs/dr1john.dat dg_broker_config_file2 string /u01/app/oracle/product/10.2.0 /db_1/dbs/dr2john.dat

Next create from within the DGMGRL the configuration [oracle@rac1 ~]$ dgmgrl DGMGRL for Linux: Version 10.2.0.1.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information. DGMGRL> connect sys/oracle@antony Connected. DGMGRL> create configuration ANTONY AS> PRIMARY DATABASE IS antony> CONNECT IDENTIFIER IS antony;

Configuration "antony" created with primary database "antony"

Add the standby to the configuration and check it

DGMGRL> ADD DATABASE john AS> CONNECT IDENTIFIER IS john> MAINTAINED AS PHYSICAL;Database "john" added

DGMGRL> SHOW CONFIGURATION;

Configuration Name: antony Enabled: NO Protection Mode: MaxPerformance Fast-Start Failover: DISABLED Databases: antony - Primary database john - Physical standby database

Current status for "antony": DISABLED

DGMGRL> SHOW DATABASE VERBOSE john;

Database Name: john Role: PHYSICAL STANDBY Enabled: NO Intended State: OFFLINE Instance(s): john

Properties: InitialConnectIdentifier = 'john' LogXptMode = 'ARCH' Dependency = '' DelayMins = '0' Binding = 'OPTIONAL' MaxFailure = '0' MaxConnections = '1' ReopenSecs = '300' NetTimeout = '180' LogShipping = 'ON' PreferredApplyInstance = '' ApplyInstanceTimeout = '0' ApplyParallel = 'AUTO' StandbyFileManagement = 'auto' ArchiveLagTarget = '0' LogArchiveMaxProcesses = '30' LogArchiveMinSucceedDest = '1' DbFileNameConvert = '/u01/app/oracle/oradata/antony/, /u01/app /oracle/oradata/john/' LogFileNameConvert = '/u01/app/oracle/oradata/antony/, /u01/app /oracle/oradata/john/' FastStartFailoverTarget = '' StatusReport = '(monitor)' InconsistentProperties = '(monitor)' InconsistentLogXptProps = '(monitor)' SendQEntries = '(monitor)' LogXptStatus = '(monitor)' RecvQEntries = '(monitor)' HostName = 'rac2' SidName = 'john' LocalListenerAddress = '(ADDRESS=(PROTOCOL=TCP)(HOST=rac2.localdo main)(PORT=1521))' StandbyArchiveLocation = '/u01/app/oracle/oradata/john/arch/' AlternateLocation = '' LogArchiveTrace = '0' LogArchiveFormat = '%t_%s_%r.arc' LatestLog = '(monitor)' TopWaitEvents = '(monitor)'

Current status for "john": DISABLED

DGMGRL> show database verbose antony;

Database Name: antony Role: PRIMARY Enabled: NO Intended State: OFFLINE Instance(s): antony

Properties: InitialConnectIdentifier = 'antony' LogXptMode = 'ASYNC' Dependency = '' DelayMins = '0' Binding = 'OPTIONAL' MaxFailure = '0' MaxConnections = '1' ReopenSecs = '300' NetTimeout = '180' LogShipping = 'ON' PreferredApplyInstance = '' ApplyInstanceTimeout = '0' ApplyParallel = 'AUTO' StandbyFileManagement = 'auto' ArchiveLagTarget = '0' LogArchiveMaxProcesses = '30' LogArchiveMinSucceedDest = '1' DbFileNameConvert = '/u01/app/oracle/oradata/john/, /u01/app/o racle/oradata/antony/' LogFileNameConvert = '/u01/app/oracle/oradata/john/, /u01/app/o racle/oradata/antony/' FastStartFailoverTarget = '' StatusReport = '(monitor)' InconsistentProperties = '(monitor)' InconsistentLogXptProps = '(monitor)' SendQEntries = '(monitor)' LogXptStatus = '(monitor)' RecvQEntries = '(monitor)' HostName = 'rac1' SidName = 'antony' LocalListenerAddress = '(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.localdo main)(PORT=1521))' StandbyArchiveLocation = '/u01/app/oracle/oradata/antony/arch/' AlternateLocation = '' LogArchiveTrace = '0' LogArchiveFormat = '%t_%s_%r.arc' LatestLog = '(monitor)' TopWaitEvents = '(monitor)'

Current status for "antony": DISABLED

DGMGRL> enable configuration; Enabled. DGMGRL> show configuration;

Configuration Name: antony Enabled: YES Protection Mode: MaxPerformance Fast-Start Failover: DISABLED Databases: antony - Primary database john - Physical standby database

Current status for "antony": SUCCESS

DGMGRL> enable database john; Enabled. DGMGRL> SHOW DATABASE VERBOSE john;

Database Name: john Role: PHYSICAL STANDBY Enabled: YES Intended State: ONLINE Instance(s): john

Properties: InitialConnectIdentifier = 'john' LogXptMode = 'ARCH' Dependency = '' DelayMins = '0' Binding = 'OPTIONAL' MaxFailure = '0' MaxConnections = '1' ReopenSecs = '300' NetTimeout = '180' LogShipping = 'ON' PreferredApplyInstance = '' ApplyInstanceTimeout = '0' ApplyParallel = 'AUTO' StandbyFileManagement = 'auto' ArchiveLagTarget = '0' LogArchiveMaxProcesses = '30' LogArchiveMinSucceedDest = '1' DbFileNameConvert = '/u01/app/oracle/oradata/antony/, /u01/app/oracle/oradata/john/' LogFileNameConvert = '/u01/app/oracle/oradata/antony/, /u01/app/oracle/oradata/john/' FastStartFailoverTarget = '' StatusReport = '(monitor)' InconsistentProperties = '(monitor)' InconsistentLogXptProps = '(monitor)' SendQEntries = '(monitor)' LogXptStatus = '(monitor)' RecvQEntries = '(monitor)' HostName = 'rac2' SidName = 'john' LocalListenerAddress = '(ADDRESS=(PROTOCOL=TCP)(HOST=rac2.localdomain)(PORT=1521))' StandbyArchiveLocation = '/u01/app/oracle/oradata/john/arch/' AlternateLocation = '' LogArchiveTrace = '0' LogArchiveFormat = '%t_%s_%r.arc' LatestLog = '(monitor)' TopWaitEvents = '(monitor)'

Current status for "john": SUCCESS

Enabling the configuration and databases DGMGRL> enable configuration; Enabled. DGMGRL> show configuration;

Configuration Name: antony Enabled: YES Protection Mode: MaxPerformance Fast-Start Failover: DISABLED Databases: antony - Primary database john - Physical standby database

Current status for "antony": SUCCESS

DGMGRL> enable database john; Enabled. DGMGRL> SHOW DATABASE VERBOSE john;

Database Name: john Role: PHYSICAL STANDBY Enabled: YES Intended State: ONLINE Instance(s): john

Properties: InitialConnectIdentifier = 'john' LogXptMode = 'ARCH' Dependency = '' DelayMins = '0' Binding = 'OPTIONAL' MaxFailure = '0' MaxConnections = '1' ReopenSecs = '300' NetTimeout = '180' LogShipping = 'ON' PreferredApplyInstance = '' ApplyInstanceTimeout = '0' ApplyParallel = 'AUTO' StandbyFileManagement = 'auto' ArchiveLagTarget = '0' LogArchiveMaxProcesses = '30' LogArchiveMinSucceedDest = '1' DbFileNameConvert = '/u01/app/oracle/oradata/antony/, /u01/app/oracle/oradata/john/' LogFileNameConvert = '/u01/app/oracle/oradata/antony/, /u01/app/oracle/oradata/john/' FastStartFailoverTarget = '' StatusReport = '(monitor)' InconsistentProperties = '(monitor)' InconsistentLogXptProps = '(monitor)' SendQEntries = '(monitor)' LogXptStatus = '(monitor)' RecvQEntries = '(monitor)' HostName = 'rac2' SidName = 'john' LocalListenerAddress = '(ADDRESS=(PROTOCOL=TCP)(HOST=rac2.localdomain)(PORT=1521))' StandbyArchiveLocation = '/u01/app/oracle/oradata/john/arch/' AlternateLocation = '' LogArchiveTrace = '0' LogArchiveFormat = '%t_%s_%r.arc' LatestLog = '(monitor)' TopWaitEvents = '(monitor)'

Current status for "john": SUCCESS

Enabling Fast Start Failover and the Observer

These are the steps required to enable and check Fast Start Failover and the Observer:1. Ensure standby redologs are configured on all databases.on primary:SQL> SELECT TYPE,MEMBER FROM V$LOGFILE;

TYPE MEMBER ------- -------------------------------------------------- ONLINE /u01/app/oracle/oradata/antony/redo03.log ONLINE /u01/app/oracle/oradata/antony/redo02.log ONLINE /u01/app/oracle/oradata/antony/redo01.logSTANDBY /u01/app/oracle/oradata/antony/redoby04.logSTANDBY /u01/app/oracle/oradata/antony/redoby05.logSTANDBY /u01/app/oracle/oradata/antony/redoby06.log

On standby:

SQL> SELECT TYPE,MEMBER FROM V$LOGFILE;

TYPE MEMBER ---------- -------------------------------------------------- ONLINE /u01/app/oracle/oradata/john/redo03.log ONLINE /u01/app/oracle/oradata/john/redo02.log ONLINE /u01/app/oracle/oradata/john/redo01.logSTANDBY /u01/app/oracle/oradata/john/redoby04.logSTANDBY /u01/app/oracle/oradata/john/redoby05.logSTANDBY /u01/app/oracle/oradata/john/redoby06.log

2. Ensure the LogXptMode Property is set to SYNC.Note: These commands will succeed only if database is configured with standby redo logs. DGMGRL> EDIT DATABASE antony SET PROPERTY 'LogXptMode'='SYNC'; Property "LogXptMode" updated DGMGRL> EDIT DATABASE john SET PROPERTY 'LogXptMode'='SYNC'; Property "LogXptMode" updated

3.Specify the FastStartFailoverTarget property

DGMGRL> EDIT DATABASE antony SET PROPERTY FastStartFailoverTarget='john'; Property "faststartfailovertarget" updated DGMGRL> EDIT DATABASE john SET PROPERTY FastStartFailoverTarget='antony'; Property "faststartfailovertarget" updated

4.Upgrade the protection mode to MAXAVAILABILITY, if necessary.

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY; Operation requires shutdown of instance "antony" on database "antony" Shutting down instance "antony"... Database closed. Database dismounted. ORACLE instance shut down. Operation requires startup of instance "antony" on database "antony" Starting instance "antony"... ORACLE instance started. Database mounted.

note: if ORA-12514: TNS:listener does not currently know of service requested in connect descriptor Failed. You are no longer connected to ORACLE Please connect again.you must start instance (primary database) manuallySQL> conn / as sysdbaSQL> startup mount;

5. Enable Flashback Database on the Primary and Standby Databases. On Both databases To enter the standby into Flashback mode you must shutdown the both databases, then while the primary is down execute the following commands on the standby: SQL> ALTER SYSTEM SET UNDO_RETENTION=3600 SCOPE=SPFILE; System altered. SQL> ALTER SYSTEM SET UNDO_MANAGEMENT='AUTO' SCOPE=SPFILE; System altered. SQL> startup mount;

SQL> ALTER DATABASE FLASHBACK ON;

Enable fast start failover

[oracle@rac1 ~]$ dgmgrl DGMGRL for Linux: Version 10.2.0.1.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information. DGMGRL> connect sys/oracle@antony; Connected. DGMGRL> show configuration verbose;

Configuration Name: antony Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: DISABLED Databases: antony - Primary database john - Physical standby database

Current status for "antony": SUCCESS

DGMGRL> show database john;

Database Name: john Role: PHYSICAL STANDBY Enabled: YES Intended State: ONLINE Instance(s): john

Current status for "john": SUCCESS

DGMGRL> ENABLE FAST_START FAILOVER; Enabled.start the observerStart the observer from a third server on background. You may use a script like this:---------------- script start on next line -------------------- #!/bin/ksh # startobserver export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 export BASE_PATH=/u01/app/oracle/oracle/scripts/general:/opt/CTEact/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/bin:/etc:/usr/local/maint/oracle:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:. export PATH=$ORACLE_HOME/bin:$BASE_PATH dgmgrl alter system set db_recovery_file_dest_size=200m sid='*';

System altered.

SQL> alter system set db_recovery_file_dest='+DATA' sid='*';

System altered.

SQL> archive log list;Database log mode No Archive ModeAutomatic archival DisabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 12Current log sequence 14SQL>

step 2:

set the LOG_ARCHIVE_DEST_1 parameter. since these parameters will be identical for all nodes, we will use sid='*'. However, you may need to modify this for your situation if the directories are different on each node.

SQL> alter system set log_archive_dest_1='LOCATION=USE-DB_RECOVERY_FILE_DEST';

System altered.

step 3:

set LOG_ARCHIVE_START to TRUE for all instances to enable automatic archiving.

SQL> alter system set log_archive_start=true scope=spfile sid='*';

System altered. Note that we illustrate the command for backward compatibility purposes, but in oracle database 10g onwards, the parameter is actually deprecated. Automatic archiving will be enabled by default whenever an oracle database is placed in archivelog mode.

step 4:

Set CLUSTER_DATABASE to FALSE for the local instance, which you will then mount to put the database into archivelog mode. By having CLUSTER_DATABASE=FALSE, the subsequent shutdown and startup mount will actually do a Mount Exclusive by default, which is necessary to put the database in archivelog mode, and also to enable the flashback database feature:

SQL> alter system set cluster_database=false scope=spfile sid='test1';

System altered.

step 5;Shut down all instances. Ensure that all instances are shut down cleanly:

SQL> shutdown immediate

step 6:Mount the database from instance test1 (where CLUSTER_DATABASE was set to FALSE) and then put the database into archivelog mode.

SQL> startup mountORA-32004: obsolete and/or deprecated parameter(s) specifiedORACLE instance started.Database mounted.

SQL> alter database archivelog;

Database altered.

NOTE:If you did not shut down all instances cleanly in step 5,putting the database in archivelog mode will failwith an ORA-265 Error.

SQL> alter database archivelog;*ERROR at line 1:ORA-00265: instance recovery required, cannot set ARCHIVELOG mode

step 7:Confirm that the database is in archivelog mode, with the appropriate parameters, by issuing the ARCHIVE LOG LIST command:

SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination USE-DB_RECOVERY_FILE_DESTOldest online log sequence 13Next log sequence to archive 15Current log sequence 15

step 8Confirm the location of the RECOVERY_FILE_DEST via a SHOW PARAMETER.

SQL> show parameter recovery_file

NAME TYPE VALUE------------------------------------ ----------- ------------------------------db_recovery_file_dest string +DATAdb_recovery_file_dest_size big integer 200M

Step 9:Once the database is in archivelog mode, you can enable flashback while the database is still mounted in Exclusive mode (CLUSTER_DATABASE=FALSE).

SQL> alter database flashback on;

Database altered.

Step 10:Confirm that Flashback is enabled and verify the retention target:

SQL> select flashback_on,current_scn from v$database;

FLASHBACK_ON CURRENT_SCN------------------ -----------YES 0

SQL> show parameter flash

NAME TYPE VALUE------------------------------------ ----------- ------------------------------db_flashback_retention_target integer 1440

step 11:Reset the CLUSTER_DATABASE parameter back to TRUE for all instances:

SQL> alter system set cluster_database=true scope=spfile sid=' * ';

System altered.

step 12:shutdown the instance and then restart all cluster database instances.All instances will now be archiving their redo threads.

SQL> shu immediateORA-01109: database not open

Database dismounted.ORACLE instance shut down.

start the database, using srvctl command or normal startup

[root@rac1 bin]# ./srvctl status database -d testInstance test1 is not running on node rac1Instance test2 is not running on node rac2

[root@rac1 bin]# ./srvctl start database -d test

[root@rac1 bin]# ./srvctl status database -d testInstance test1 is running on node rac1Instance test2 is running on node rac2[root@rac1 bin]#

on test1 instance:

SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination USE-DB_RECOVERY_FILE_DESTOldest online log sequence 14Next log sequence to archive 16Current log sequence 16SQL>

on test2 instance:

SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination USE-DB_RECOVERY_FILE_DESTOldest online log sequence 3Next log sequence to archive 5Current log sequence 5SQL>

wow, both are in archive log modeConvert single instance to RAC instance Database converting a single instance database to rac instance database:

Oracle provides following methods to convert a single instance database to RAC:

Grid Control DBCA Manual RCONFIG(from 10gR2)

here is an example of converting a single instance asm file database to rac instance database using rconfig, for converting a normal database file system single instance to rac instance, before following the steps for converting the non-asm files to asm files using the steps as shown in the link

http://oracleinstance.blogspot.com/2009/12/migrate-from-database-file-system-to.html

after converting a non-asm files to asm files system,

go the $ORACLE_HOME/assistants/rconfig/sampleXMLs there u can find ConvertToRAC.xml file

recommended you to copy the file to any location for example

cp $ORACLE_HOME/assistants/rconfig/sampleXMLs/ConvertToRAC.xml /u01/convertdb.xml

Following illustrate how to convert single instance database to RAC using the RCONFIG tool:

The Convert verify option in the ConvertToRAC.xml file has three options:Convert verify="YES": rconfig performs checks to ensure that the prerequisites for single-instance to RAC conversion have been met before it starts conversionConvert verify="NO": rconfig does not perform prerequisite checks, and starts conversionConvert verify="ONLY" : rconfig only performs prerequisite checks; it does not start conversion after completing prerequisite checks

modify the convertdb.xml file according to your environment. Following is the example:

sample ConvertToRAC.xml file edit as follows

here my database name to convert is "test" -------------------------------------------------------------------------------------------------------------------------------

xml version="1.0" encoding="UTF-8"? --n:RConfig xmlns:n="http://www.oracle.com/rconfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/rconfig"-- --n:ConvertToRAC-- --!-- Verify does a precheck to ensure all pre-requisites are met, before the conversion is attempted. Allowable values are: YES|NO|ONLY ---- --n:Convert verify="YES"-- --!--Specify current OracleHome of non-rac database for SourceDBHome ---- --n:SourceDBHome--/u01/app/oracle/product/10g/db_1--/n:SourceDBHome-----your source database home --!--Specify OracleHome where the rac database should be configured. It can be same as SourceDBHome ---- --n:TargetDBHome--/u01/app/oracle/product/10g/db_1--/n:TargetDBHome-- ---your target database home --!--Specify SID of non-rac database and credential. User with sysdba role is required to perform conversion ---- --n:SourceDBInfo SID="test"---------------your database name --n:Credentials-- --n:User--sys--/n:User-- --n:Password--oracle--/n:Password-- --n:Role--sysdba--/n:Role-- --/n:Credentials-- --/n:SourceDBInfo-- --!--ASMInfo element is required only if the current non-rac database uses ASM Storage ---- --n:ASMInfo SID="+ASM1"---------------------your ASM Instance name --n:Credentials-- --n:User--sys--/n:User-- --n:Password--oracle--/n:Password-- ----your ASM instance password --n:Role--sysdba--/n:Role-- --/n:Credentials-- --/n:ASMInfo-- --!--Specify the list of nodes that should have rac instances running. LocalNode should be the first node in this nodelist. ---- --n:NodeList-- --n:Node name="rac1"/-------your rac1 hostname --n:Node name="rac2"/------your rac2 hostname --/n:NodeList-- --!--Specify prefix for rac instances. It can be same as the instance name for non-rac database or different. The instance number will be attached to this prefix. ---- --n:InstancePrefix--test--/n:InstancePrefix-----your database name --!--Specify port for the listener to be configured for rac database.If port="", alistener existing on localhost will be used for rac database.The listener will be extended to all nodes in the nodelist ---- --n:Listener port="1551"/-----listener port number --!--Specify the type of storage to be used by rac database. Allowable values are CFS|ASM. The non-rac database should have same storage type. ---- --n:SharedStorage type="ASM"------your storage type --!--Specify Database Area Location to be configured for rac database.If this field is left empty, current storage will be used for rac database. For CFS, this field will have directory path. ---- --n:TargetDatabaseArea-- --/n:TargetDatabaseArea------leave blank --!--Specify Flash Recovery Area to be configured for rac database. If this field is left empty, current recovery area of non-rac database will be configured for rac database. If current database is not using recovery Area, the resulting rac database will not have a recovery area. ---- --n:TargetFlashRecoveryArea-- --/n:TargetFlashRecoveryArea---leave blank --/n:SharedStorage-- --/n:Convert-- --/n:ConvertToRAC-- --/n:RConfig-- ----------------------------------------------------------------------------------------------------------------------------------------

Once you modify the convert.xml file according to your environment, use the following command to run the tool:

go to $ORACLE_HOME/bin and run./ rconfig /u01/convertdb.xml

finally, change sid in /etc/oratab as test1 in rac1 machine and test2 in rac2 machine thats it. then check srvctl config database -d test srvctl status database -d test crs_stat -t

hope it will help you.RAC FILE SYSTEM OPTIONS ( BASIC CONCEPT BEFORE LEARNING RAC)its important to know the rac filesystem options ,RAC Filesystem Options Submitted by Natalka Roshak on orafaq website.

DBAs wanting to create a 10g Real Applications Cluster face many configuration decisions. One of the more potentially confusing decisions involves the choice of filesystems. Gone are the days when DBAs simply had to choose between "raw" and "cooked". DBAs setting up a 10g RAC can still choose raw devices, but they also have several filesystem options, and these options vary considerably from platform to platform. Further, some storage options cannot be used for all the files in the RAC setup. This article gives an overview of the RAC storage options available. RAC Review

Let's begin by reviewing the structure of a Real Applications Cluster. Physically, a RAC consists of several nodes (servers), connected to each other by a private interconnect. The database files are kept on a shared storage subsystem, where they're accessible to all nodes. And each node has a public network connection.

In terms of software and configuration, the RAC has three basic components: cluster software and/or Cluster Ready Services, database software, and a method of managing the shared storage subsystem. The cluster software can be vendor-supplied or Oracle-supplied, depending on platform. Cluster Ready Services, or CRS, is a new feature in 10g. Where vendor clusterware is used, CRS interacts with the vendor clusterware to coordinate cluster membership information; without vendor clusterware, CRS, which is also known as Oracle OSD Clusterware, provides complete cluster management. The database software is Oracle 10g with the RAC option, of course. Finally, the shared storage subsystem can be managed by one of the following options: raw devices; Automatic Storage Management (ASM); Vendor-supplied cluster file system (CFS), Oracle Cluster File System (OCFS), or vendor-supplied logical volume manager (LVM); or Networked File System (NFS) on a certified Network Attached Storage (NAS) device.Storage Options

Let me clarify the foregoing alphabet soup with a table: Table 1. Storage options for the shared storage subsystem.Storage----------- Option RawRaw devices, no filesystemASMAutomatic Storage ManagementCFSCluster File SystemOCFSOracle Cluster File SystemLVMLogical Volume ManagerNFSNetwork File System (must be on certified NAS device)

Before I delve into each of these storage options, a word about file types. A regular single-instance database has three basic types of files: database software and dump files; datafiles, spfile, control files and log files, often referred to as "database files"; and it may have recovery files, if using RMAN. A RAC database has an additional type of file referred to as "CRS files". These consist of the Oracle Cluster Registry (OCR) and the voting disk.

Not all of these files have to be on the shared storage subsystem. The database files and CRS files must be accessible to all instances, so must be on the shared storage subsystem. The database software can be on the shared subsystem and shared between nodes; or each node can have its own ORACLE_HOME. The flash recovery area must be shared by all instances, if used.

Some storage options can't handle all of these file types. To take an obvious example, the database software and dump files can't be stored on raw devices. This isn't important for the dump files, but it does mean that choosing raw devices precludes having a shared ORACLE_HOME on the shared storage device.

And to further complicate the picture, no OS platform is certified for all of the shared storage options. For example, only Linux and SPARC Solaris are supported with NFS, and the NFS must be on a certified NAS device. The following table spells out which platforms and file types can use each storage option. Table 2.Platforms and file types able to use each storage optionStorage option--- Platforms--------------------File types supported---File types not supported RawAll platformsDatabase, CRSSoftware/Dump files, RecoveryASMAll platformsDatabase, RecoveryCRS, Software/DumpCertified Vendor CFSAIX, HP Tru64 UNIX, SPARC SolarisAllNoneLVMHP-UX, HP Tru64 UNIX, SPARC SolarisAllNoneOCFSWindows, LinuxDatabase, CRS, RecoverySoftware/Dump filesNFSLinux, SPARC SolarisAllNone

(Note: Mike Ault and Madhu Tumma have summarized the storage choices by platform in more detail in this excerpt from their recent book, Oracle 10g Grid Computing with RAC, which I used as one source for this table.)

Now that we have an idea of where we can use these storage options, let's examine each option in a little more detail. We'll tackle them in order of Oracle's recommendation, starting with Oracle's least preferred, raw devices, and finishing up with Oracle's top recommendation, ASM. Raw devices

Raw devices need little explanation. As with single-instance Oracle, each tablespace requires a partition. You will also need to store your software and dump files elsewhere.

Pros: You won't need to install any vendor or Oracle-supplied clusterware or additional drivers.Cons: You won't be able to have a shared oracle home, and if you want to configure a flash recovery area, you'll need to choose another option for it. Manageablility is an issue. Further, raw devices are a terrible choice if you expect to resize or add tablespaces frequently, as this involves resizing or adding a partition. NFS

NFS also requires little explanation. It must be used with a certified NAS device; Oracle has certified a number of NAS filers with its products, including products from EMC, HP, NetApp and others. NFS on NAS can be a cost-effective alternative to a SAN for Linux and Solaris, especially if no SAN hardware is already installed.

Pros: Ease of use and relatively low cost.Cons: Not suitable for all deployments. Analysts recommend SANs over NAS for large-scale transaction-intensive applications, although there's disagreement on how big is too big for NAS. Vendor CFS and LVMs

If you're considering a vendor CFS or LVM, you'll need to check the 10g Real Application Clusters Installation Guide for your platform and the Certify pages on MetaLink. A discussion of all the certified cluster file systems is beyond the scope of this article. Pros and cons depend on the specific solution, but some general observations can be made:

Pros: You can store all types of files associated with the instance on the CFS / logical volumes.Cons: Depends on CFS / LVM. And you won't be enjoying the manageability advantage of ASM. OCFS

OCFS is the Oracle-supplied CFS for Linux and Windows. This is the only CFS that can be used with these platforms. The current version of OCFS was designed specifically to store RAC files, and is not a full-featured CFS. You can store database, CRS and recovery files on it, but it doesn't fully support generic filesystem operations. Thus, for example, you cannot install a shared ORACLE_HOME on an OCFS device.

The next version of OCFS, OCFS2, is currently out in beta version and will support generic filesystem operations, including a shared ORACLE_HOME.

Pros: Provides a CFS option for Linux and Windows.Cons: Cannot store regular filesystem files such as Oracle software. Easier to manage than raw devices, but not as manageable as NFS or ASM. ASM

Oracle recommends ASM for 10g RAC deployments, although CRS files cannot be stored on ASM. In fact, RAC installations using Oracle Database Standard Edition must use ASM.

ASM is a little bit like a logical volume manager and provides many of the benefits of LVMs. But it also provides benefits LVMs don't: file-level striping/mirroring, and ease of manageability. Instead of running LVM software, you run an ASM instance, a new type of "instance" that largely consists of processes and memory and stores its information in the ASM disks it's managing.

Pros: File-level striping and mirroring; ease of manageability through Oracle syntax and