20-AUG-2010 in Oracle forum OTN, a interesting thread , here i documented it for future reference.
thread: ORA-00959: tablespace '_$deleted$3$0' does not exist
i thank the forum Opponent Phiri Lighton and participants especially nicolas,ogan and chinar here.
here, we will see the examples , What are the possiblities to get ORA-950 Error
Changes
Made changes to the TEMP tablespace setup.
1. Created a temporary tablespace called TEMP1.
2. Set this tablespace to become the default temporary tablespace.
3. Dropped the existing permanent TEMP tablespace.
4. Renamed the default temporary tablesapce TEMP1 to TEMP.
Reason for this problem/issue
There is an open unpublished bug where basic problem is that a tablespace is renamed to one that use
to exist on the database. Here are the steps that will cause this problem.
create tablespace aa
create tablespace bb
drop tablespace aa
rename bb to aa
Then why it occurs is because when a tablespace is dropped, its ts$ entry is set to an invalid state, but it
is not deleted. When a rename is done, if the target name already has a ts$ entry, then during the
rename, because we cannot have two ts$ entries with the same name, the _$deleted$ construct is
introduced. The change is not taken care of properly, and is flushed to other dictionary tables
causing this problem.
Solution
To resolve in this case, just alter the user to have the new temporary tablespace name, replacing the
_$deleted entry.
SQL> create temporary tablespace temp2 tempfile '+GROUP01' size 20M;
Tablespace created.
SQL> create temporary tablespace temp3 tempfile '+GROUP01' size 20M;
Tablespace created.
SQL> create user testuser identified by testuser temporary tablespace temp2;
User created.
SQL> drop tablespace temp2;
Tablespace dropped.
SQL> alter tablespace temp3 rename to temp2;
Tablespace altered.
- Now look in ts$ and will see the _$deleted construct which includes the ts#.
SQL> select ts#, name from ts$;
TS# NAME
---------- ------------------------------
0 SYSTEM
1 UNDOTBS1
2 SYSAUX
3 TEMP
4 USERS
5 UNDO
6 MYDATA
7 MYINDEXES
8 TESTCASES
9 _$deleted$9$0
10 TEMP2
11 rows selected.
- And when you check the users temporary_tablespace, it too was changed to the _$deleted construct
which causes all the problems.
SQL> select username, temporary_tablespace
2 from dba_users where username = 'TESTUSER';
USERNAME TEMPORARY_TABLESPACE
------------------------------ ------------------------------
TESTUSER _$deleted$9$0
- To resolve, just alter the user to a valid temporary tablespace.
SQL> alter user testuser temporary tablespace temp2;
User altered.
SQL> select username, temporary_tablespace
2 from dba_users where username = 'TESTUSER';
USERNAME TEMPORARY_TABLESPACE
------------------------------ ------------------------------
TESTUSER TEMP2
To avoid this problem altogether, until the bug is fixed, do not rename a tablespace to one that use to
exist on the database. For example, here would be steps to complete the temp tablespace change.
create tablespace NEWTEMP
... change everyone and default temporary tablespace NEWTEMP
drop tablespace TEMP ... exisiting one
create tablespace TEMP ... building it the way you want
.... flip everyone back and default temporary tablespace TEMP
drop tablespace NEWTEMP
reference: ORACLE OTN Forum, MetaLink
Tuesday, November 30, 2010
Sunday, October 31, 2010
Recover a missing/excluded datafile after re-create new control file from controlfile trace file
This is the situation in which lost all control file, and DBA accidently create control file (recreated) with old controlfile trace file backup. After recover,DBA found some datafile is missing.
Here is the steps to recover those missing database datafiles.
http://hemantoracledba.blogspot.com/2010/08/adding-datafile-that-had-been-excluded.html
Here is the steps to recover those missing database datafiles.
16:33:32 SQL> select file#,name from v$datafile; FILE# NAME ---------- --------------------------------------------------- 1 /u01/app/oracle/oradata/rev1/system01.dbf 2 /u01/app/oracle/oradata/rev1/undotbs01.dbf 3 /u01/app/oracle/oradata/rev1/sysaux01.dbf 4 /u01/app/oracle/oradata/rev1/users01.dbf 16:33:43 SQL> set time off; SQL> set time off; SQL> select file#,name from v$datafile; FILE# NAME ---------- --------------------------------------------------- 1 /u01/app/oracle/oradata/rev1/system01.dbf 2 /u01/app/oracle/oradata/rev1/undotbs01.dbf 3 /u01/app/oracle/oradata/rev1/sysaux01.dbf 4 /u01/app/oracle/oradata/rev1/users01.dbf SQL> alter database backup controlfile to trace; Database altered. SQL> alter database backup controlfile to trace; Database altered. SQL> alter system switch logfile; System altered. SQL> alter database backup controlfile to trace; Database altered. SQL> [oracle@rac1 udump]$ cp rev1_ora_6901.trc /home/oracle/Desktop/ctlnew.sql [oracle@rac1 udump]$ pwd /u01/app/oracle/admin/rev1/udump [oracle@rac1 udump]$ SQL> alter tablespace users add datafile '/u01/app/oracle/oradata/rev1/users02.dbf' size 2m; Tablespace altered. SQL> select file#,name from v$datafile; FILE# NAME ---------- --------------------------------------------------- 1 /u01/app/oracle/oradata/rev1/system01.dbf 2 /u01/app/oracle/oradata/rev1/undotbs01.dbf 3 /u01/app/oracle/oradata/rev1/sysaux01.dbf 4 /u01/app/oracle/oradata/rev1/users01.dbf 5 /u01/app/oracle/oradata/rev1/users02.dbf SQL> CREATE CONTROLFILE REUSE DATABASE "REV1" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u01/app/oracle/oradata/rev1/redo01.log' SIZE 5M, GROUP 2 '/u01/app/oracle/oradata/rev1/redo02.log' SIZE 5M, GROUP 3 '/u01/app/oracle/oradata/rev1/redo03.log' SIZE 5M -- STANDBY LOGFILE DATAFILE '/u01/app/oracle/oradata/rev1/system01.dbf', '/u01/app/oracle/oradata/rev1/undotbs01.dbf', '/u01/app/oracle/oradata/rev1/sysaux01.dbf', '/u01/app/oracle/oradata/rev1/users01.dbf' CHARACTER SET WE8ISO8859P1 ; SQL> shu immediate Database closed. Database dismounted. ORACLE instance shut down. [oracle@rac1 udump]$ rm -rf /u01/app/oracle/oradata/rev1/*.ctl [oracle@rac1 udump]$ rm -rf /u01/app/oracle/oradata/rev1/*.ctl [oracle@rac1 rev1]$ pwd /u01/app/oracle/oradata/rev1 [oracle@rac1 rev1]$ ls -ltr total 791480 -rw-r----- 1 oracle oinstall 104865792 Oct 31 15:44 temp01.dbf -rw-r----- 1 oracle oinstall 5243392 Oct 31 16:30 redo02.log -rw-r----- 1 oracle oinstall 5243392 Oct 31 16:39 redo03.log -rw-r----- 1 oracle oinstall 2105344 Oct 31 16:53 users02.dbf -rw-r----- 1 oracle oinstall 10493952 Oct 31 16:53 users01.dbf -rw-r----- 1 oracle oinstall 26222592 Oct 31 16:53 undotbs01.dbf -rw-r----- 1 oracle oinstall 503324672 Oct 31 16:53 system01.dbf -rw-r----- 1 oracle oinstall 251666432 Oct 31 16:53 sysaux01.dbf -rw-r----- 1 oracle oinstall 5243392 Oct 31 16:53 redo01.log [oracle@rac1 rev1]$ SQL> startup ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 146801344 bytes Database Buffers 293601280 bytes Redo Buffers 2973696 bytes ORA-00205: error in identifying control file, check alert log for more info SQL> select status from v$instance; STATUS ---------- STARTED SQL> shu immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 146801344 bytes Database Buffers 293601280 bytes Redo Buffers 2973696 bytes SQL> @/home/oracle/Desktop/recreate_ctlfile.sql Control file created. SQL> recover database using backup controlfile; ORA-00279: change 810892 generated at 10/31/2010 16:53:26 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_7_%u_.arcORA-00280: change 810892 for thread 1 is in sequence #7 Specify log: {reference:=suggested | filename | AUTO | CANCEL} auto ORA-00308: cannot open archived log '/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_7_%u_.arc' ORA-27037: unable to obtain file status Linux Error: 2: No such file or directory Additional information: 3 ORA-00308: cannot open archived log '/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_7_%u_.arc' ORA-27037: unable to obtain file status Linux Error: 2: No such file or directory Additional information: 3 SQL> recover database using backup controlfile; ORA-00279: change 810892 generated at 10/31/2010 16:53:26 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_7_%u_.arcORA-00280: change 810892 for thread 1 is in sequence #7 Specify log: { =suggested | filename | AUTO | CANCEL} /u01/app/oracle/oradata/rev1/redo01.log Log applied. Media recovery complete. SQL> alter database open resetlogs; Database altered. SQL> col name format a55 SQL> select file#,name from v$datafile; FILE# NAME ---------- ------------------------------------------------------- 1 /u01/app/oracle/oradata/rev1/system01.dbf 2 /u01/app/oracle/oradata/rev1/undotbs01.dbf 3 /u01/app/oracle/oradata/rev1/sysaux01.dbf 4 /u01/app/oracle/oradata/rev1/users01.dbf 5 /u01/app/oracle/product/10.2.0/db_1/dbs/MISSING00005 SQL> alter database rename file '/u01/app/oracle/product/10.2.0/db_1/dbs/MISSING00005' to '/u01/app/oracle/oradata/rev1/users02.dbf'; Database altered. SQL> recover datafile 5; ORA-00279: change 810892 generated at 10/31/2010 16:53:26 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_7_%u_.arcORA-00280: change 810892 for thread 1 is in sequence #7 Specify log: { =suggested | filename | AUTO | CANCEL} /u01/app/oracle/oradata/rev1/redo01.log ORA-00342: archived log does not have expected resetlogs SCN 805021 ORA-00334: archived log: '/u01/app/oracle/oradata/rev1/redo01.log' SQL> recover datafile 5; ORA-00279: change 810892 generated at 10/31/2010 16:53:26 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_7_%u_.arcORA-00280: change 810892 for thread 1 is in sequence #7 Specify log: { =suggested | filename | AUTO | CANCEL} auto Log applied. Media recovery complete. SQL> select * from v$recover_file; no rows selected SQL> select file#,name from v$datafile; FILE# NAME ---------- ------------------------------------------------------- 1 /u01/app/oracle/oradata/rev1/system01.dbf 2 /u01/app/oracle/oradata/rev1/undotbs01.dbf 3 /u01/app/oracle/oradata/rev1/sysaux01.dbf 4 /u01/app/oracle/oradata/rev1/users01.dbf 5 /u01/app/oracle/oradata/rev1/users02.dbf SQL> select file#,name,status from v$datafile; FILE# NAME STATUS ---------- ------------------------------------------------------- ---------- 1 /u01/app/oracle/oradata/rev1/system01.dbf SYSTEM 2 /u01/app/oracle/oradata/rev1/undotbs01.dbf ONLINE 3 /u01/app/oracle/oradata/rev1/sysaux01.dbf ONLINE 4 /u01/app/oracle/oradata/rev1/users01.dbf ONLINE 5 /u01/app/oracle/oradata/rev1/users02.dbf OFFLINE SQL> SQL> alter database datafile 5 online; Database altered. SQL> alter system switch logfile; System altered.
http://hemantoracledba.blogspot.com/2010/08/adding-datafile-that-had-been-excluded.html
RMAN TSPITR DEMO
Recovery Manager (RMAN) automatic tablespace point-in-time recovery (commonly abbreviated TSPITR) enables you to quickly recover one or more tablespaces in an Oracle database to an earlier time, without affecting the state of the rest of the tablespaces and other objects in the database.for theoritical part please refer oracle documentation.
Here in this demo i am going to create and truncate a table in tablespace USERS for schema(username) RAJESH and recover truncated table TEST1 of users RAJESH schema in tablespace USERS.
We can use RMAN TSPITR in the following conditions
1. Recovering data lost after an erroneous TRUNCATE TABLE statement;
2. Recovering from logical corruption of a table;
3. Undoing the effects of an incorrect batch job or other DML statement that has affected only a subset of the database;
4. Recovering a logical schema to a point different from the rest of the physical database, when multiple schemas exist in separate tablespaces of one physical database.
reference:
http://download.oracle.com/docs/cd/B14117_01/server.101/b10734/rcmtspit.htm
Here in this demo i am going to create and truncate a table in tablespace USERS for schema(username) RAJESH and recover truncated table TEST1 of users RAJESH schema in tablespace USERS.
We can use RMAN TSPITR in the following conditions
1. Recovering data lost after an erroneous TRUNCATE TABLE statement;
2. Recovering from logical corruption of a table;
3. Undoing the effects of an incorrect batch job or other DML statement that has affected only a subset of the database;
4. Recovering a logical schema to a point different from the rest of the physical database, when multiple schemas exist in separate tablespaces of one physical database.
SQL> select name from v$tablespace; NAME ------------------------------ SYSTEM UNDOTBS1 SYSAUX USERS TEMP SQL> alter user rajesh identified by rajesh default tablespace users; User altered. SQL> conn rajesh/rajesh; Connected. SQL> create table test1(id number); Table created. SQL> insert into test1 values(123); 1 row created. SQL> / 1 row created. SQL> / 1 row created. SQL> / 1 row created. SQL> commit; Commit complete. SQL> select * from test1; ID ---------- 123 123 123 123 SQL> [oracle@rac1 ~]$ . oraenv ORACLE_SID = [cdbs1] ? rev1 [oracle@rac1 ~]$ rlrman target / Recovery Manager: Release 10.2.0.1.0 - Production on Sun Oct 31 15:48:18 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: REV1 (DBID=1886963043) RMAN> backup full database plus archivelog; Starting backup at 31-OCT-10 current log archived using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=153 devtype=DISK channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=18 recid=109 stamp=733321071 input archive log thread=1 sequence=19 recid=110 stamp=733321246 input archive log thread=1 sequence=20 recid=111 stamp=733321261 input archive log thread=1 sequence=21 recid=112 stamp=733351761 input archive log thread=1 sequence=22 recid=113 stamp=733351877 input archive log thread=1 sequence=23 recid=114 stamp=733851812 input archive log thread=1 sequence=24 recid=115 stamp=733851923 input archive log thread=1 sequence=25 recid=116 stamp=733852130 input archive log thread=1 sequence=26 recid=117 stamp=733852142 channel ORA_DISK_1: starting piece 1 at 31-OCT-10 channel ORA_DISK_1: finished piece 1 at 31-OCT-10 piece handle=/u01/app/oracle/backup/13lrrcfp_1_1 tag=TAG20101031T154911 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05 Finished backup at 31-OCT-10 Starting backup at 31-OCT-10 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=/u01/app/oracle/oradata/rev1/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/rev1/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/rev1/undotbs01.dbf input datafile fno=00004 name=/u01/app/oracle/oradata/rev1/users01.dbf channel ORA_DISK_1: starting piece 1 at 31-OCT-10 channel ORA_DISK_1: finished piece 1 at 31-OCT-10 piece handle=/u01/app/oracle/backup/14lrrcg2_1_1 tag=TAG20101031T154920 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:36 Finished backup at 31-OCT-10 Starting backup at 31-OCT-10 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=27 recid=118 stamp=733852258 channel ORA_DISK_1: starting piece 1 at 31-OCT-10 channel ORA_DISK_1: finished piece 1 at 31-OCT-10 piece handle=/u01/app/oracle/backup/15lrrcj4_1_1 tag=TAG20101031T155059 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 31-OCT-10 Starting Control File and SPFILE Autobackup at 31-OCT-10 piece handle=/u01/app/oracle/flash_recovery_area/REV1/autobackup/2010_10_31/o1_mf_s_733852263_6dtjrkts_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 31-OCT-10 RMAN> exit Recovery Manager complete. [oracle@rac1 ~]$ SQL> conn sys/oracle as sysdba; Connected. SQL> alter system switch logfile; System altered. SQL> create tablespace demo datafile '/u01/app/oracle/oradata/rev1/demo01.dbf' size 2m; Tablespace created. SQL> create user sai identified by sai default tablespace demo; User created. SQL> grant connect, resource to sai; Grant succeeded. SQL> conn sai/sai; Connected. SQL> create table test2(id number); Table created. SQL> insert into test2 values(555); 1 row created. SQL> / 1 row created. SQL> / 1 row created. SQL> commit; Commit complete. SQL> select * from test2; ID ---------- 555 555 555 SQL> set time on; 15:54:48 SQL> conn rajesh/rajesh; Connected. 15:54:57 SQL> select * from test1; ID ---------- 123 123 123 123 15:55:15 SQL> truncate table test1; Table truncated. 15:55:26 SQL> select * from test1; no rows selected 15:55:32 SQL> 15:55:32 SQL> conn sys/oracle as sysdba; Connected. 15:59:30 SQL> col name format a51; 15:59:45 SQL> col status for a10; 15:59:51 SQL> select name,status from v$datafile; NAME STATUS --------------------------------------------------- ---------- /u01/app/oracle/oradata/rev1/system01.dbf SYSTEM /u01/app/oracle/oradata/rev1/undotbs01.dbf ONLINE /u01/app/oracle/oradata/rev1/sysaux01.dbf ONLINE /u01/app/oracle/oradata/rev1/users01.dbf RECOVER /u01/app/oracle/oradata/rev1/demo01.dbf ONLINE 16:00:08 SQL> conn sai/sai; Connected. 16:00:55 SQL> create table test3(id number); Table created. 16:01:08 SQL> insert into test3 values(666); 1 row created. 16:01:22 SQL> / 1 row created. 16:01:22 SQL> commit; Commit complete. 16:01:25 SQL> select * from test3; ID ---------- 666 666 16:01:30 SQL> [oracle@rac1 ~]$ . oraenv ORACLE_SID = [rev1] ? [oracle@rac1 ~]$ rlrman target / Recovery Manager: Release 10.2.0.1.0 - Production on Sun Oct 31 15:56:19 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: REV1 (DBID=1886963043) RMAN> recover tablespace USERS until time "to_date('31-OCT-2010 15:55:00','DD-MON-YYYY HH24:MI:SS')" AUXILIARY DESTINATION='/u01/app/oracle'; Starting recover at 31-OCT-10 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=136 devtype=DISK RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point in time List of tablespaces expected to have UNDO segments tablespace SYSTEM tablespace UNDOTBS1 Creating automatic instance, with SID='huEl' initialization parameters used for automatic instance: db_name=REV1 compatible=10.2.0.1.0 db_block_size=8192 db_files=200 db_unique_name=tspitr_REV1_huEl large_pool_size=1M shared_pool_size=110M #No auxiliary parameter file used db_create_file_dest=/u01/app/oracle control_files=/u01/app/oracle/cntrl_tspitr_REV1_huEl.f starting up automatic instance REV1 Oracle instance started Total System Global Area 201326592 bytes Fixed Size 1218508 bytes Variable Size 146802740 bytes Database Buffers 50331648 bytes Redo Buffers 2973696 bytes Automatic instance created contents of Memory Script: { # set the until clause set until time "to_date('31-OCT-2010 15:55:00','DD-MON-YYYY HH24:MI:SS')"; # restore the controlfile restore clone controlfile; # mount the controlfile sql clone 'alter database mount clone database'; # archive current online log for tspitr to a resent until time sql 'alter system archive log current'; # avoid unnecessary autobackups for structural changes during TSPITR sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;'; } executing Memory Script executing command: SET until clause Starting restore at 31-OCT-10 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: sid=36 devtype=DISK channel ORA_AUX_DISK_1: starting datafile backupset restore channel ORA_AUX_DISK_1: restoring control file channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/REV1/autobackup/2010_10_31/o1_mf_s_733852408_6dtjx0yz_.bkp channel ORA_AUX_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/flash_recovery_area/REV1/autobackup/2010_10_31/o1_mf_s_733852408_6dtjx0yz_.bkp tag=TAG20101031T155328 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04 output filename=/u01/app/oracle/cntrl_tspitr_REV1_huEl.f Finished restore at 31-OCT-10 sql statement: alter database mount clone database sql statement: alter system archive log current sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end; released channel: ORA_DISK_1 released channel: ORA_AUX_DISK_1 contents of Memory Script: { # generated tablespace point-in-time recovery script # set the until clause set until time "to_date('31-OCT-2010 15:55:00','DD-MON-YYYY HH24:MI:SS')"; plsql <<<-- tspitr_2 declare sqlstatement varchar2(512); offline_not_needed exception; pragma exception_init(offline_not_needed, -01539); begin sqlstatement := 'alter tablespace '|| 'USERS' ||' offline for recover'; krmicd.writeMsg(6162, sqlstatement); krmicd.execSql(sqlstatement); exception when offline_not_needed then null; end; >>>; # set an omf destination filename for restore set newname for clone datafile 1 to new; # set an omf destination filename for restore set newname for clone datafile 2 to new; # set an omf destination tempfile set newname for clone tempfile 1 to new; # set a destination filename for restore set newname for datafile 4 to "/u01/app/oracle/oradata/rev1/users01.dbf"; # rename all tempfiles switch clone tempfile all; # restore the tablespaces in the recovery set plus the auxilliary tablespaces restore clone datafile 1, 2, 4; switch clone datafile all; #online the datafiles restored or flipped sql clone "alter database datafile 1 online"; #online the datafiles restored or flipped sql clone "alter database datafile 2 online"; #online the datafiles restored or flipped sql clone "alter database datafile 4 online"; # make the controlfile point at the restored datafiles, then recover them recover clone database tablespace "USERS", "SYSTEM", "UNDOTBS1" delete archivelog; alter clone database open resetlogs; # PLUG HERE the creation of a temporary tablespace if export fails due to lack # of temporary space. # For example in Unix these two lines would do that: #sql clone "create tablespace aux_tspitr_tmp # datafile ''/tmp/aux_tspitr_tmp.dbf'' size 500K"; } executing Memory Script executing command: SET until clause sql statement: alter tablespace USERS offline for recover executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME renamed temporary file 1 to /u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_temp_%u_.tmp in control file Starting restore at 31-OCT-10 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: sid=40 devtype=DISK channel ORA_AUX_DISK_1: starting datafile backupset restore channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_system_%u_.dbf restoring datafile 00002 to /u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_undotbs1_%u_.dbf restoring datafile 00004 to /u01/app/oracle/oradata/rev1/users01.dbf channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/14lrrcg2_1_1 channel ORA_AUX_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/backup/14lrrcg2_1_1 tag=TAG20101031T154920 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:17 Finished restore at 31-OCT-10 datafile 1 switched to datafile copy input datafile copy recid=17 stamp=733852877 filename=/u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_system_6dtk9896_.dbf datafile 2 switched to datafile copy input datafile copy recid=18 stamp=733852877 filename=/u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_undotbs1_6dtk98by_.dbf sql statement: alter database datafile 1 online sql statement: alter database datafile 2 online sql statement: alter database datafile 4 online Starting recover at 31-OCT-10 using channel ORA_AUX_DISK_1 starting media recovery archive log thread 1 sequence 27 is already on disk as file /u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_27_6dtjrbnj_.arc archive log thread 1 sequence 28 is already on disk as file /u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_28_6dtk80s9_.arc archive log filename=/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_27_6dtjrbnj_.arc thread=1 sequence=27 archive log filename=/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_10_31/o1_mf_1_28_6dtk80s9_.arc thread=1 sequence=28 media recovery complete, elapsed time: 00:00:03 Finished recover at 31-OCT-10 database opened contents of Memory Script: { # export the tablespaces in the recovery set host 'exp userid =\"/@\(DESCRIPTION=\(ADDRESS=\(PROTOCOL=beq\)\(PROGRAM=/u01/app/oracle/product/10.2.0/db_1/bin/oracle\)\(ARGV0=oraclehuEl\)\(ARGS=^'\(DESCRIPTION=\(LOCAL=YES\)\(ADDRESS=\(PROTOCOL=beq\)\)\)^'\)\(ENVS=^'ORACLE_SID=huEl^'\)\)\(CONNECT_DATA=\(SID=huEl\)\)\) as sysdba\" point_in_time_recover=y tablespaces= USERS file= tspitr_a.dmp'; # shutdown clone before import shutdown clone immediate # import the tablespaces in the recovery set host 'imp userid =\"/@ as sysdba\" point_in_time_recover=y file= tspitr_a.dmp'; # online/offline the tablespace imported sql "alter tablespace USERS online"; sql "alter tablespace USERS offline"; # enable autobackups in case user does open resetlogs from RMAN after TSPITR sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;'; } executing Memory Script Export: Release 10.2.0.1.0 - Production on Sun Oct 31 16:02:07 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning and OLAP options Export done in US7ASCII character set and AL16UTF16 NCHAR character set server uses WE8ISO8859P1 character set (possible charset conversion) Note: table data (rows) will not be exported About to export Tablespace Point-in-time Recovery objects... For tablespace USERS ... . exporting cluster definitions . exporting table definitions . . exporting table A EXP-00091: Exporting questionable statistics. . . exporting table NEW EXP-00091: Exporting questionable statistics. . . exporting table TEST1 . exporting referential integrity constraints . exporting triggers . end point-in-time recovery Export terminated successfully with warnings. host command complete database closed database dismounted Oracle instance shut down Import: Release 10.2.0.1.0 - Production on Sun Oct 31 16:02:54 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning and OLAP options Export file created by EXPORT:V10.02.01 via conventional path About to import Tablespace Point-in-time Recovery objects... import done in US7ASCII character set and AL16UTF16 NCHAR character set import server uses WE8ISO8859P1 character set (possible charset conversion) . importing SYS's objects into SYS . importing SCOTT's objects into SCOTT . . importing table "A" . importing RAJESH's objects into RAJESH . . importing table "NEW" . . importing table "TEST1" . importing SYS's objects into SYS Import terminated successfully without warnings. host command complete sql statement: alter tablespace USERS online sql statement: alter tablespace USERS offline sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end; Removing automatic instance Automatic instance removed auxiliary instance file /u01/app/oracle/cntrl_tspitr_REV1_huEl.f deleted auxiliary instance file /u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_system_6dtk9896_.dbf deleted auxiliary instance file /u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_undotbs1_6dtk98by_.dbf deleted auxiliary instance file /u01/app/oracle/TSPITR_REV1_HUEL/datafile/o1_mf_temp_6dtkdg6g_.tmp deleted auxiliary instance file /u01/app/oracle/TSPITR_REV1_HUEL/onlinelog/o1_mf_1_6dtkd95j_.log deleted auxiliary instance file /u01/app/oracle/TSPITR_REV1_HUEL/onlinelog/o1_mf_2_6dtkdbmb_.log deleted auxiliary instance file /u01/app/oracle/TSPITR_REV1_HUEL/onlinelog/o1_mf_3_6dtkdbrn_.log deleted Finished recover at 31-OCT-10 RMAN> 16:03:06 SQL> select name,status from v$datafile; NAME STATUS --------------------------------------------------- ---------- /u01/app/oracle/oradata/rev1/system01.dbf SYSTEM /u01/app/oracle/oradata/rev1/undotbs01.dbf ONLINE /u01/app/oracle/oradata/rev1/sysaux01.dbf ONLINE /u01/app/oracle/oradata/rev1/users01.dbf OFFLINE /u01/app/oracle/oradata/rev1/demo01.dbf ONLINE 16:03:06 SQL> select name,status from v$datafile; NAME STATUS --------------------------------------------------- ---------- /u01/app/oracle/oradata/rev1/system01.dbf SYSTEM /u01/app/oracle/oradata/rev1/undotbs01.dbf ONLINE /u01/app/oracle/oradata/rev1/sysaux01.dbf ONLINE /u01/app/oracle/oradata/rev1/users01.dbf OFFLINE /u01/app/oracle/oradata/rev1/demo01.dbf ONLINE 16:03:45 SQL> conn rajesh/rajesh; Connected. 16:05:26 SQL> select * from test1; select * from test1 * ERROR at line 1: ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '/u01/app/oracle/oradata/rev1/users01.dbf' 16:05:32 SQL> conn sys/oracle as sysdba; Connected. 16:05:42 SQL> alter tablespace users online; Tablespace altered. 16:05:52 SQL> conn rajesh/rajesh; Connected. 16:05:58 SQL> select * from test1; ID ---------- 123 123 123 123 16:06:05 SQL> conn sai/sai; Connected. 16:06:11 SQL> select * from test2; ID ---------- 555 555 555 16:06:16 SQL> select * from test3; ID ---------- 666 666 16:06:20 SQL> conn sys/oracle as sysdba; Connected. 16:06:32 SQL> select name,status from v$datafile; NAME STATUS --------------------------------------------------- ---------- /u01/app/oracle/oradata/rev1/system01.dbf SYSTEM /u01/app/oracle/oradata/rev1/undotbs01.dbf ONLINE /u01/app/oracle/oradata/rev1/sysaux01.dbf ONLINE /u01/app/oracle/oradata/rev1/users01.dbf ONLINE /u01/app/oracle/oradata/rev1/demo01.dbf ONLINE 16:06:38 SQL>hope, this will helps you.
reference:
http://download.oracle.com/docs/cd/B14117_01/server.101/b10734/rcmtspit.htm
Labels:
10g concepts,
ORACLE RMAN TSPITR DEMO,
rman
Monday, October 25, 2010
RMAN-03002 : ORA-01119: error in creating database file ORA-27038:
this is one of the interview question
your database corrupted/lost after adding a datafile to database you are only having the backup of database before adding the datafile, the newly added datafile is not available in the backupset , what will happen how will you recover? Is the new added datafile will be available after the restore backup command?
the answer is yes the control contains the information about the newly added datafile so RMAN creates a new datafile with the same name and location and applies logs to the datafile to recover. it is similar to sql statement alter database create datafile statement.
here is an demo.
reference:
http://forums.oracle.com/forums/thread.jspa?messageID=3687911
your database corrupted/lost after adding a datafile to database you are only having the backup of database before adding the datafile, the newly added datafile is not available in the backupset , what will happen how will you recover? Is the new added datafile will be available after the restore backup command?
the answer is yes the control contains the information about the newly added datafile so RMAN creates a new datafile with the same name and location and applies logs to the datafile to recover. it is similar to sql statement alter database create datafile statement.
here is an demo.
SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/rev1/system01.dbf /u01/app/oracle/oradata/rev1/undotbs01.dbf /u01/app/oracle/oradata/rev1/sysaux01.dbf /u01/app/oracle/oradata/rev1/users01.dbf [oracle@rac1 ~]$ . oraenv ORACLE_SID = [cdbs1] ? rev1 [oracle@rac1 ~]$ rlrman target / Recovery Manager: Release 10.2.0.1.0 - Production on Mon Oct 25 20:48:50 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: REV1 (DBID=1886963043) RMAN> backup full database plus archivelog; Starting backup at 25-OCT-10 current log archived using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=137 devtype=DISK channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=18 recid=109 stamp=733321071 input archive log thread=1 sequence=19 recid=110 stamp=733321246 input archive log thread=1 sequence=20 recid=111 stamp=733321261 input archive log thread=1 sequence=21 recid=112 stamp=733351761 channel ORA_DISK_1: starting piece 1 at 25-OCT-10 channel ORA_DISK_1: finished piece 1 at 25-OCT-10 piece handle=/u01/app/oracle/backup/0slrc3qs_1_1 tag=TAG20101025T204929 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05 Finished backup at 25-OCT-10 Starting backup at 25-OCT-10 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=/u01/app/oracle/oradata/rev1/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/rev1/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/rev1/undotbs01.dbf input datafile fno=00004 name=/u01/app/oracle/oradata/rev1/users01.dbf channel ORA_DISK_1: starting piece 1 at 25-OCT-10 channel ORA_DISK_1: finished piece 1 at 25-OCT-10 piece handle=/u01/app/oracle/backup/0tlrc3r5_1_1 tag=TAG20101025T204939 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:36 Finished backup at 25-OCT-10 Starting backup at 25-OCT-10 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=22 recid=113 stamp=733351877 channel ORA_DISK_1: starting piece 1 at 25-OCT-10 channel ORA_DISK_1: finished piece 1 at 25-OCT-10 piece handle=/u01/app/oracle/backup/0ulrc3u7_1_1 tag=TAG20101025T205118 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 25-OCT-10 Starting Control File and SPFILE Autobackup at 25-OCT-10 piece handle=/u01/app/oracle/flash_recovery_area/REV1/autobackup/2010_10_25/o1_mf_s_733351882_6dc83mcy_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 25-OCT-10 RMAN> SQL> ALTER TABLESPACE USERS ADD DATAFILE '/u01/app/oracle/oradata/rev1/users02.dbf' SIZE 2m; Tablespace altered. SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/rev1/system01.dbf /u01/app/oracle/oradata/rev1/undotbs01.dbf /u01/app/oracle/oradata/rev1/sysaux01.dbf /u01/app/oracle/oradata/rev1/users01.dbf /u01/app/oracle/oradata/rev1/users02.dbf [oracle@rac1 ~]$ rlrman target / Recovery Manager: Release 10.2.0.1.0 - Production on Mon Oct 25 21:03:50 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: REV1 (DBID=1886963043) RMAN> restore database; Starting restore at 25-OCT-10 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=155 devtype=DISK creating datafile fno=5 name=/u01/app/oracle/oradata/rev1/users02.dbf RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of restore command at 10/25/2010 21:14:13 ORA-01119: error in creating database file '/u01/app/oracle/oradata/rev1/users02.dbf' ORA-27038: created file already exists Additional information: 1 SQL> ! mv /u01/app/oracle/oradata/rev1/users02.dbf /u01/app/oracle/user02.dbf RMAN> restore database; Starting restore at 25-OCT-10 using channel ORA_DISK_1 creating datafile fno=5 name=/u01/app/oracle/oradata/rev1/users02.dbf 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/rev1/system01.dbf restoring datafile 00002 to /u01/app/oracle/oradata/rev1/undotbs01.dbf restoring datafile 00003 to /u01/app/oracle/oradata/rev1/sysaux01.dbf restoring datafile 00004 to /u01/app/oracle/oradata/rev1/users01.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/0tlrc3r5_1_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/backup/0tlrc3r5_1_1 tag=TAG20101025T204939 channel ORA_DISK_1: restore complete, elapsed time: 00:01:26 Finished restore at 25-OCT-10 RMAN> recover database; Starting recover at 25-OCT-10 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:05 Finished recover at 25-OCT-10 RMAN> RMAN> sql 'alter database open'; sql statement: alter database open RMAN> exit Recovery Manager complete. SQL> select status from v$instance; STATUS ------------ OPEN SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/rev1/system01.dbf /u01/app/oracle/oradata/rev1/undotbs01.dbf /u01/app/oracle/oradata/rev1/sysaux01.dbf /u01/app/oracle/oradata/rev1/users01.dbf /u01/app/oracle/oradata/rev1/users02.dbfhope, this will helps you.
reference:
http://forums.oracle.com/forums/thread.jspa?messageID=3687911
Tuesday, September 21, 2010
Re-create lost controlfile
Here in this demo i deleted all control files and re-created using trace file.
In Oracle forum OTN related to re-create controlfile, confusion between shutdown immediate and shutdown abort after controlfile lost. this demo helps you to re-create lost control file
to create control file trace
you can find the sample controlfile trace file in the location user_dump_dest /u01/app/oracle/admin/rev1/udump the last recently created file.
copy and paste the following lines in the notepad/text editor from the above trace files and save it as create_ctl.sql
remove the control files(control01.ctl,control02.ctl,control03.ctl) from the location /u01/app/oracle/oradata/rev1/ for testing purpose to re-create it.
run the create_ctl.sql script to recreate a lost control files
apply the current online redolog files for recover the database here in our example the current
logfile is redo02.log
hope, this will helps you
In Oracle forum OTN related to re-create controlfile, confusion between shutdown immediate and shutdown abort after controlfile lost. this demo helps you to re-create lost control file
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/rev1/control01.ctl
/u01/app/oracle/oradata/rev1/control02.ctl
/u01/app/oracle/oradata/rev1/control03.ctl
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/rev1/system01.dbf
/u01/app/oracle/oradata/rev1/undotbs01.dbf
/u01/app/oracle/oradata/rev1/sysaux01.dbf
/u01/app/oracle/oradata/rev1/users01.dbf
SQL> col member format a50
SQL> select a.group#,a.member,b.status from v$logfile a, v$log b where a.group#=b.group#;
GROUP# MEMBER STATUS
---------- -------------------------------------------------- ----------------
3 /u01/app/oracle/oradata/rev1/redo03.log ACTIVE
2 /u01/app/oracle/oradata/rev1/redo02.log CURRENT
1 /u01/app/oracle/oradata/rev1/redo01.log ACTIVE
to create control file trace
SQL> alter database backup controlfile to trace;
Database altered.
SQL> show parameter user_dump_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest string /u01/app/oracle/admin/rev1/udump
or
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE
2 AS '/home/oracle/Desktop/create_ctl.sql';
Database altered.
you can find the sample controlfile trace file in the location user_dump_dest /u01/app/oracle/admin/rev1/udump the last recently created file.
u01/app/oracle/admin/rev1/udump/rev1_ora_10939.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning and OLAP options
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
System name: Linux
Node name: rac1.localdomain
Release: 2.6.9-42.0.0.0.1.ELhugemem
Version: #1 SMP Sun Oct 15 14:06:18 PDT 2006
Machine: i686
Instance name: rev1
Redo thread mounted by this instance: 1
Oracle process number: 23
Unix process pid: 10939, image: oracle@rac1.localdomain (TNS V1-V3)
*** SERVICE NAME:(SYS$USERS) 2010-09-21 16:52:23.473
*** SESSION ID:(142.32) 2010-09-21 16:52:23.473
*** 2010-09-21 16:52:23.472
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="rev1"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_10=ENABLE
--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
-- Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "REV1" NORESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/rev1/redo01.log' SIZE 5M,
GROUP 2 '/u01/app/oracle/oradata/rev1/redo02.log' SIZE 5M,
GROUP 3 '/u01/app/oracle/oradata/rev1/redo03.log' SIZE 5M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/rev1/system01.dbf',
'/u01/app/oracle/oradata/rev1/undotbs01.dbf',
'/u01/app/oracle/oradata/rev1/sysaux01.dbf',
'/u01/app/oracle/oradata/rev1/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/rev1/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
copy and paste the following lines in the notepad/text editor from the above trace files and save it as create_ctl.sql
CREATE CONTROLFILE REUSE DATABASE "REV1" RESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/rev1/redo01.log' SIZE 5M,
GROUP 2 '/u01/app/oracle/oradata/rev1/redo02.log' SIZE 5M,
GROUP 3 '/u01/app/oracle/oradata/rev1/redo03.log' SIZE 5M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/rev1/system01.dbf',
'/u01/app/oracle/oradata/rev1/undotbs01.dbf',
'/u01/app/oracle/oradata/rev1/sysaux01.dbf',
'/u01/app/oracle/oradata/rev1/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
remove the control files(control01.ctl,control02.ctl,control03.ctl) from the location /u01/app/oracle/oradata/rev1/ for testing purpose to re-create it.
SQL> select name from v$controlfile;
NAME
--------------------------------------------------
/u01/app/oracle/oradata/rev1/control01.ctl
/u01/app/oracle/oradata/rev1/control02.ctl
/u01/app/oracle/oradata/rev1/control03.ctl
SQL> host rm -rf /u01/app/oracle/oradata/rev1/control01.ctl
SQL> ! rm -rf /u01/app/oracle/oradata/rev1/control02.ctl
SQL> ! rm -rf /u01/app/oracle/oradata/rev1/control03.ctl
SQL> shutdown immediate
SQL> startup
ORACLE instance started.
Total System Global Area 444596224 bytes
Fixed Size 1219904 bytes
Variable Size 167772864 bytes
Database Buffers 272629760 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
run the create_ctl.sql script to recreate a lost control files
SQL> @/home/oracle/Desktop/create_ctl.sql
Control file created.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/rev1/system01.dbf'
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 557988 generated at 09/21/2010 16:13:51 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_4_%u_.arc
ORA-00280: change 557988 for thread 1 is in sequence #4
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_4_%u_.ar
c'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log
'/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_4_%u_.ar
c'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/app/oracle/oradata/rev1/system01.dbf'
apply the current online redolog files for recover the database here in our example the current
logfile is redo02.log
SQL> col member format a50
SQL> select a.group#,a.member,b.status from v$logfile a, v$log b where a.group#=b.group#;
GROUP# MEMBER STATUS
---------- -------------------------------------------------- ----------------
3 /u01/app/oracle/oradata/rev1/redo03.log ACTIVE
2 /u01/app/oracle/oradata/rev1/redo02.log CURRENT
1 /u01/app/oracle/oradata/rev1/redo01.log ACTIVE
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 557988 generated at 09/21/2010 16:13:51 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/REV1/archivelog/2010_09_21/o1_mf_1_4_%u_.arc
ORA-00280: change 557988 for thread 1 is in sequence #4
Specify log: {=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/rev1/redo02.log
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;
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 0
Next log sequence to archive 1
Current log sequence 1
hope, this will helps you
Thursday, September 2, 2010
SYSAUX datafile or tablespace corrupted or lost no backup available
Datafiles of the sysaux tablespace are not as critical as datafiles in the system tablespace but they are part of the Oracle configuration. Anyway you should never delete any datafile directly from the OS.
rman target /
report schema; -- identify number of your datafile
sql 'alter database datafile ? offline';
sql 'alter database open';
You should be able to open the database but you could have problems (depends on Oracle options you use)... If you don't want to experience/solve them export what you need and import in another database.
you can create a tablespace then :
alter user ??? default tablespace ???;
You should also give him quota on this tablespace
alter user ??? quota unlimited on ???;
Replace ??? by adequate values (username , tablespace name)
reference: from otn
rman target /
report schema; -- identify number of your datafile
sql 'alter database datafile ? offline';
sql 'alter database open';
You should be able to open the database but you could have problems (depends on Oracle options you use)... If you don't want to experience/solve them export what you need and import in another database.
you can create a tablespace then :
alter user ??? default tablespace ???;
You should also give him quota on this tablespace
alter user ??? quota unlimited on ???;
Replace ??? by adequate values (username , tablespace name)
SQL> startup
ORACLE instance started.
Total System Global Area 444596224 bytes
Fixed Size 1219904 bytes
Variable Size 197132992 bytes
Database Buffers 243269632 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 444596224 bytes
Fixed Size 1219904 bytes
Variable Size 201327296 bytes
Database Buffers 239075328 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
ORA-01110: data file 3: '/u01/app/oracle/oradata/jay/sysaux01.dbf'
[oracle@rac1 ~]$ rlrman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Sep 2 11:45:07 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: JAY (DBID=3148849783, not open)
RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 480 SYSTEM *** /u01/app/oracle/oradata/jay/system01.dbf
2 25 UNDOTBS1 *** /u01/app/oracle/oradata/jay/undotbs01.dbf
3 0 SYSAUX *** /u01/app/oracle/oradata/jay/sysaux01.dbf
4 5 USERS *** /u01/app/oracle/oradata/jay/users01.dbf
5 5 SAMPLE *** /u01/app/oracle/oradata/jay/sam01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 5 TEMP 5 /u01/app/oracle/oradata/jay/newtemp1.dbf
RMAN> sql 'alter database datafile 3 offline';
sql statement: alter database datafile 3 offline
RMAN> sql 'alter database open';
sql statement: alter database open
RMAN>
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
jay OPEN
SQL> select name,status from v$datafile;
NAME STATUS
-------------------------------------------------- -------
/u01/app/oracle/oradata/jay/system01.dbf SYSTEM
/u01/app/oracle/oradata/jay/undotbs01.dbf ONLINE
/u01/app/oracle/oradata/jay/sysaux01.dbf OFFLINE
/u01/app/oracle/oradata/jay/users01.dbf ONLINE
/u01/app/oracle/oradata/jay/sam01.dbf ONLINE
SQL> select username from dba_users
2 where default_tablespace='SYSAUX';
USERNAME
------------------------------
SYSMAN
DBSNMP
OLAPSYS
SI_INFORMTN_SCHEMA
ORDPLUGINS
XDB
WMSYS
DMSYS
EXFSYS
ANONYMOUS
CTXSYS
USERNAME
------------------------------
ORDSYS
MDSYS
RAJESH
14 rows selected.
SQL> ALTER USER RAJESH DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS;
User altered.
reference: from otn
Tuesday, August 31, 2010
restore the server parameter file(spfile) from RMAN backup
1.Connect to target Database with RMAN.
i)If you have lost your spfile and dont have pfile then, follow the steps to recover spfile using RMAN.
RMAN>CONNECT TARGET /
ii)If your database is not up and you don't use recovery catalog then use,
RMAN>CONNECT TARGET /
RMAN>SET DBID=3148849783
2)Start the instance with dummy parameter file.
RMAN>STARTUP FORCE NOMOUNT
Example:
3)Restore server parameter file.
To restore in default location,
RMAN> RESTORE SPFILE FROM AUTOBACKUP;
To restore in another location,
RMAN> RESTORE SPFILE TO 'new_location' FROM AUTOBACKUP;
RMAN> restore spfile to '/tmp/spfilejay.ora' from autobackup;
If you want to restore to a pfile then use,
RMAN> restore spfile to pfile '/tmp/initjay.ora';
4)Restore Spfile from control file autobackup;
RMAN> run
2> { set controlfile autobackup format for device type disk to '/u01/app/oracle/backup/JAY_%F';
3> restore spfile from autobackup;
4> }
Note after restore spfile from RMAN shutdown and startup the database
else you will receive the error message
ORA-00205: error in identifying control file, check alert log for more info
Reference:
Oracle® Database Backup and Recovery Basics 10g Release 2 (10.2)
i)If you have lost your spfile and dont have pfile then, follow the steps to recover spfile using RMAN.
RMAN>CONNECT TARGET /
ii)If your database is not up and you don't use recovery catalog then use,
RMAN>CONNECT TARGET /
RMAN>SET DBID=3148849783
2)Start the instance with dummy parameter file.
RMAN>STARTUP FORCE NOMOUNT
Example:
3)Restore server parameter file.
To restore in default location,
RMAN> RESTORE SPFILE FROM AUTOBACKUP;
To restore in another location,
RMAN> RESTORE SPFILE TO 'new_location' FROM AUTOBACKUP;
RMAN> restore spfile to '/tmp/spfilejay.ora' from autobackup;
If you want to restore to a pfile then use,
RMAN> restore spfile to pfile '/tmp/initjay.ora';
4)Restore Spfile from control file autobackup;
RMAN> run
2> { set controlfile autobackup format for device type disk to '/u01/app/oracle/backup/JAY_%F';
3> restore spfile from autobackup;
4> }
Note after restore spfile from RMAN shutdown and startup the database
else you will receive the error message
ORA-00205: error in identifying control file, check alert log for more info
1. Restore spfile from autobackup;
RMAN> set dbid=3148849783
executing command: SET DBID
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initjay.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 1218268 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
RMAN> restore spfile from autobackup;
2. Restore spfile to non-default location
RMAN> restore spfile to '/tmp/spfilejay.ora' from autobackup;
Starting restore at 31-AUG-10
using channel ORA_DISK_1
recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: JAY
channel ORA_DISK_1: no autobackups found in the recovery area
channel ORA_DISK_1: looking for autobackup on day: 20100831
channel ORA_DISK_1: autobackup found: /u01/app/oracle/backup/JAY_c-3148849783-20100831-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 31-AUG-10
3. If you want to restore to a pfile from restored spfile
RMAN> restore spfile to pfile '/tmp/initjay.ora';
Starting restore at 31-AUG-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=139 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE to PFILE
output filename=/tmp/initjay.ora
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/JAY_c-3148849783-20100831-00
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/backup/JAY_c-3148849783-20100831-00 tag=TAG20100831T174354
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
Finished restore at 31-AUG-10
4.Restore spfile from Controlfile AutoBackup
RMAN> set dbid=3148849783
executing command: SET DBID
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initjay.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 1218268 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
RMAN> run
2> { set controlfile autobackup format for device type disk to '/u01/app/oracle/backup/JAY_%F';
3> restore spfile from autobackup; 4> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
Starting restore at 31-AUG-10
using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20100831
channel ORA_DISK_1: autobackup found: /u01/app/oracle/backup/JAY_c-3148849783-20100831-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 31-AUG-10
Reference:
Oracle® Database Backup and Recovery Basics 10g Release 2 (10.2)
Labels:
rman
ORA-00283: ORA-00314: ORA-00312: Error and solution
While trying to restore controlfile from backup , while recovery i got the error
ORA-00283: recovery session canceled due to errors
ORA-00314: log 2 of thread 1, expected sequence# 2 doesn't match 11
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jay/redo02.log'
In any case, the ArchiveLog must be backed up. Else, a RESTORE alone cannot do a RECOVER.
If your database backup did not include the ArchiveLogs, then the backup you created does not have the Redo information that Oracle must apply to the Database Backup. That is why you got the "unknown log'.
Also, if the controlfile backup is before the archivelog backup, the controlfile, even when restored, is not aware of the archivelogs in the backup created subsequent to it.
RMAN can still do a RECOVER , implicitly using the "BACKUP CONTROLFILE" and doing a rollforward but it needs to have to restore the ArchiveLog first -- and the information about which Backupset contains the ArchiveLog is not available to it. You would need to CATALOG the ArchiveLog BackupSet and then restore the archivelogs from there.
(If you use an RMAN Recovery Catalog database, then of course, the Catalog has information about the ArchiveLogs and the BackupSets containing the ArchiveLogs so RMAN queries the Catalog to identify the BackupSets and extracts the necessary ArchiveLogs from the Backupsets).
ORA-00283: recovery session canceled due to errors
ORA-00314: log 2 of thread 1, expected sequence# 2 doesn't match 11
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jay/redo02.log'
Reason:
In any case, the ArchiveLog must be backed up. Else, a RESTORE alone cannot do a RECOVER.
If your database backup did not include the ArchiveLogs, then the backup you created does not have the Redo information that Oracle must apply to the Database Backup. That is why you got the "unknown log'.
Also, if the controlfile backup is before the archivelog backup, the controlfile, even when restored, is not aware of the archivelogs in the backup created subsequent to it.
RMAN can still do a RECOVER , implicitly using the "BACKUP CONTROLFILE" and doing a rollforward but it needs to have to restore the ArchiveLog first -- and the information about which Backupset contains the ArchiveLog is not available to it. You would need to CATALOG the ArchiveLog BackupSet and then restore the archivelogs from there.
(If you use an RMAN Recovery Catalog database, then of course, the Catalog has information about the ArchiveLogs and the BackupSets containing the ArchiveLogs so RMAN queries the Catalog to identify the BackupSets and extracts the necessary ArchiveLogs from the Backupsets).
Solution:
SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 11 Next log sequence to archive 13 Current log sequence 13 SQL> ! rm -rf /u01/app/oracle/oradata/jay/control* SQL> shu immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 188744384 bytes Database Buffers 251658240 bytes Redo Buffers 2973696 bytes ORA-00205: error in identifying control file, check alert log for more info [oracle@rac1 ~]$ rlrman target / Recovery Manager: Release 10.2.0.1.0 - Production on Tue Aug 31 11:44:44 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: jay (not mounted) RMAN> restore controlfile from '/u01/control01.ctl'; Starting restore at 31-AUG-10 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=155 devtype=DISK channel ORA_DISK_1: copied control file copy output filename=/u01/app/oracle/oradata/jay/control01.ctl output filename=/u01/app/oracle/oradata/jay/control02.ctl output filename=/u01/app/oracle/oradata/jay/control03.ctl Finished restore at 31-AUG-10 RMAN> alter database mount; database mounted released channel: ORA_DISK_1 RMAN> alter database open resetlogs; RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of alter db command at 08/31/2010 11:45:45 ORA-01139: RESETLOGS option only valid after an incomplete database recovery RMAN> alter database open; RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of alter db command at 08/31/2010 11:45:51 ORA-01122: database file 1 failed verification check ORA-01110: data file 1: '/u01/app/oracle/oradata/jay/system01.dbf' ORA-01207: file is more recent than control file - old control file RMAN> recover database; Starting recover at 31-AUG-10 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=155 devtype=DISK RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 08/31/2010 11:46:04 RMAN-06094: datafile 1 must be restored RMAN> restore database; Starting restore at 31-AUG-10 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00002 to /u01/app/oracle/oradata/jay/undotbs01.dbf restoring datafile 00003 to /u01/app/oracle/oradata/jay/sysaux01.dbf restoring datafile 00004 to /u01/app/oracle/oradata/jay/users01.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/jay/1mlmljvq_1_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/backup/jay/1mlmljvq_1_1 tag=TAG20100830T185905 channel ORA_DISK_1: restore complete, elapsed time: 00:00:46 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/jay/system01.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/jay/1vlmncgc_1_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/backup/jay/1vlmncgc_1_1 tag=TAG20100831T110340 channel ORA_DISK_1: restore complete, elapsed time: 00:01:37 Finished restore at 31-AUG-10 RMAN> recover database; Starting recover at 31-AUG-10 using channel ORA_DISK_1 starting media recovery archive log thread 1 sequence 2 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_2_67qdks9h_.arc archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_3_67qfn02l_.arc archive log thread 1 sequence 4 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_4_67qfn0cq_.arc archive log thread 1 sequence 5 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_5_67qfmzj5_.arc archive log thread 1 sequence 1 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_1_67qgpfo4_.arc archive log thread 1 sequence 2 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_67s357q5_.arc archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_3_67s357v5_.arc archive log thread 1 sequence 4 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_4_67s357hd_.arc archive log thread 1 sequence 1 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_1_67s44djv_.arc archive log thread 1 sequence 2 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_67s44dr5_.arc archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_3_67s44dwq_.arc archive log thread 1 sequence 1 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_1_67s4jbd0_.arc archive log thread 1 sequence 2 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_67s4jc79_.arc archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_3_67s4jgmp_.arc archive log thread 1 sequence 4 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_4_67s4jgsl_.arc archive log thread 1 sequence 5 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_5_67s4jmr8_.arc archive log thread 1 sequence 6 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_6_67s4jmvt_.arc archive log thread 1 sequence 7 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_7_67s4jrxw_.arc archive log thread 1 sequence 8 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_8_67s4js5b_.arc archive log thread 1 sequence 9 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_9_67s633xq_.arc archive log thread 1 sequence 10 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_10_67s6340m_.arc archive log thread 1 sequence 11 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_11_67s633qq_.arc archive log thread 1 sequence 1 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_1_67s6698c_.arc archive log thread 1 sequence 2 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_67s66btj_.arc archive log thread 1 sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_3_67s66jb0_.arc archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_2_67qdks9h_.arc thread=1 sequence=2 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_3_67qfn02l_.arc thread=1 sequence=3 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_4_67qfn0cq_.arc thread=1 sequence=4 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_5_67qfmzj5_.arc thread=1 sequence=5 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_30/o1_mf_1_1_67qgpfo4_.arc thread=1 sequence=1 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_67s357q5_.arc thread=1 sequence=2 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_3_67s357v5_.arc thread=1 sequence=3 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_4_67s357hd_.arc thread=1 sequence=4 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_1_67s44djv_.arc thread=1 sequence=1 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_67s44dr5_.arc thread=1 sequence=2 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_3_67s44dwq_.arc thread=1 sequence=3 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_1_67s4jbd0_.arc thread=1 sequence=1 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_67s4jc79_.arc thread=1 sequence=2 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_3_67s4jgmp_.arc thread=1 sequence=3 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_4_67s4jgsl_.arc thread=1 sequence=4 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_5_67s4jmr8_.arc thread=1 sequence=5 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_6_67s4jmvt_.arc thread=1 sequence=6 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_7_67s4jrxw_.arc thread=1 sequence=7 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_8_67s4js5b_.arc thread=1 sequence=8 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_9_67s633xq_.arc thread=1 sequence=9 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_10_67s6340m_.arc thread=1 sequence=10 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_11_67s633qq_.arc thread=1 sequence=11 archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_1_67s6698c_.arc thread=1 sequence=1 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 08/31/2010 11:53:18 ORA-00283: recovery session canceled due to errors RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_1_67s6698c_.arc' ORA-00283: recovery session canceled due to errors ORA-00314: log 2 of thread 1, expected sequence# 2 doesn't match 11 ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jay/redo02.log' RMAN> exit Recovery Manager complete. SQL> shu immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 444596224 bytes Fixed Size 1219904 bytes Variable Size 188744384 bytes Database Buffers 251658240 bytes Redo Buffers 2973696 bytes Database mounted. ORA-01113: file 1 needs media recovery ORA-01110: data file 1: '/u01/app/oracle/oradata/jay/system01.dbf' SQL> alter database clear logfile '/u01/app/oracle/oradata/jay/redo02.log'; Database altered. SQL> alter database open; alter database open * ERROR at line 1: ORA-01113: file 1 needs media recovery ORA-01110: data file 1: '/u01/app/oracle/oradata/jay/system01.dbf' SQL> recover database until cancel; ORA-00279: change 696770 generated at 08/31/2010 11:23:13 needed for thread 1 ORA-00289: suggestion : /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_31/o1_mf_1_2_%u_.arc ORA-00280: change 696770 for thread 1 is in sequence #2 Specify log: {=suggested | filename | AUTO | CANCEL} cancel Media recovery cancelled. SQL> alter database open resetlogs; 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 1 Next log sequence to archive 1 Current log sequence 1 SQL>
Labels:
rman
Saturday, August 28, 2010
Disaster recovery using RMAN Demo
As part of disaster recovery exercise or to test the validity of a RMAN backup, a full restore and recovery of databases can be performed on scratch or test servers utilising the production RMAN backups which have been restored from the tape backups on these test or scratch servers.
This note will illustrate the above procedure by detailing the steps required to restore the backup of a production database
1. same server with same location
2. Different server with same location
The following assumptions are made in this note:
1.The RMAN backups have been restored from tape backups to the same backup location on the test server as the production server where the backup was originally taken
2.The identical directory structure as is present on production has been created on the test server. This will apply to not only the location of the database files (data, control files, redo log files), but also to the bdump,cdump, udump and adump locations.
3.Controlfile autobackup has been enabled. This is important.
#Overview
Restore the spfile from the autobackup
Restore the controlfile from the autobackup
Restore the data files
Recover by applying archived redo log files
Open the database with resetlogs
#Overview
Restore the spfile from the autobackup
Restore the controlfile from the autobackup
Restore the data files
Recover by applying archived redo log files
Open the database with resetlogs
1.Restore the SPFILE [oracle@rac1 backup]$ rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Sat Aug 28 03:12:17 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database (not started) RMAN> set dbid=3148849783 executing command: SET DBID RMAN> startup force nomount; startup failed: ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initjay.ora' starting Oracle instance without parameter file for retrival of spfile Oracle instance started Total System Global Area 159383552 bytes Fixed Size 1218268 bytes Variable Size 54528292 bytes Database Buffers 100663296 bytes Redo Buffers 2973696 bytes RMAN> run 2> { set controlfile autobackup format for device type disk to '/u01/app/oracle/backup/JAY_%F'; 3> RESTORE SPFILE FROM AUTOBACKUP;
4> } executing command: SET CONTROLFILE AUTOBACKUP FORMAT using target database control file instead of recovery catalog Starting restore at 28-AUG-10 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=36 devtype=DISK channel ORA_DISK_1: looking for autobackup on day: 20100828 channel ORA_DISK_1: autobackup found: /u01/app/oracle/backup/JAY_c-3148849783-20100828-03 channel ORA_DISK_1: SPFILE restore from autobackup complete Finished restore at 28-AUG-10 RMAN> RMAN> shutdown immediate Oracle instance shut down 2.Restore the Control File RMAN> startup nomount connected to target database (not started) 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 RMAN> set dbid=3148849783 executing command: SET DBID RMAN> run 2> { set controlfile autobackup format for device type disk to '/u01/app/oracle/backup/JAY_%F'; 3> RESTORE controlfile FROM AUTOBACKUP;
4> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
Starting restore at 28-AUG-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: JAY
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /u01/app/oracle/flash_recovery_area/JAY/autobackup/2010_08_28/o1_mf_s_728189319_67jbxhyh_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/u01/app/oracle/oradata/jay/control01.ctl
output filename=/u01/app/oracle/oradata/jay/control02.ctl
output filename=/u01/app/oracle/oradata/jay/control03.ctl
Finished restore at 28-AUG-10
3.Restore the database
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> restore database;
Starting restore at 28-AUG-10
Starting implicit crosscheck backup at 28-AUG-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 8 objects
Finished implicit crosscheck backup at 28-AUG-10
Starting implicit crosscheck copy at 28-AUG-10
using channel ORA_DISK_1
Finished implicit crosscheck copy at 28-AUG-10
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/JAY/autobackup/2010_08_28/o1_mf_s_728189319_67jbxhyh_.bkp
File Name: /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_26_67jc8po5_.arc
File Name: /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_24_67jc5rko_.arc
File Name: /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_27_67jc90og_.arc
File Name: /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_25_67jc6knx_.arc
File Name: /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_23_67jc4rpk_.arc
using channel ORA_DISK_1
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/jay/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/jay/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/jay/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/jay/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/JAY_0mlmei9b_1_1.bckp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/backup/JAY_0mlmei9b_1_1.bckp tag=TAG20100828T024706channel ORA_DISK_1: restore complete, elapsed time: 00:01:47
Finished restore at 28-AUG-10
4.Recover the database
RMAN> recover database;
Starting recover at 28-AUG-10
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 22 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_22_67jbxb7n_.arc
archive log thread 1 sequence 23 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_23_67jc4rpk_.arc
archive log thread 1 sequence 24 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_24_67jc5rko_.arc
archive log thread 1 sequence 25 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_25_67jc6knx_.arc
archive log thread 1 sequence 26 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_26_67jc8po5_.arc
archive log thread 1 sequence 27 is already on disk as file /u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_27_67jc90og_.arc
archive log thread 1 sequence 28 is already on disk as file /u01/app/oracle/oradata/jay/redo03.log
archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_22_67jbxb7n_.arc thread=1 sequence=22
archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_23_67jc4rpk_.arc thread=1 sequence=23
archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_24_67jc5rko_.arc thread=1 sequence=24
archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_25_67jc6knx_.arc thread=1 sequence=25
archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_26_67jc8po5_.arc thread=1 sequence=26
archive log filename=/u01/app/oracle/flash_recovery_area/JAY/archivelog/2010_08_28/o1_mf_1_27_67jc90og_.arc thread=1 sequence=27
archive log filename=/u01/app/oracle/oradata/jay/redo03.log thread=1 sequence=28media recovery complete, elapsed time: 00:00:06
Finished recover at 28-AUG-10
The recovery will fail at a point where it cannot restore any more archived redo log files.
I had full backup so no error else it gives error , no problem just exit from rman relogin
and open the database with resetlog.
RMAN> sql 'alter database open resetlogs'; sql statement: alter database open resetlogs RMAN> exit Recovery Manager complete. 5.Verify the database [oracle@rac1 backup]$ sqlplus '/as sysdba' SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 28 03:22:35 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning and OLAP options SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 0 Next log sequence to archive 1 Current log sequence 1 SQL> select name,dbid from v$database; NAME DBID --------- ---------- JAY 3148849783 SQL>
Labels:
rman
DBCA hangs at 85%
cause:
kernel BUG at kernel/exit.c:904!
kernel/exit.c:904!
solution:
Upgraded the Kernel to version RHEL4.7
also
the same solution for the Enterprise Manager Agent Starts on RHEL 4
refer metalink Doc ID: 729543.1
Linux Crashes when Enterprise Manager Agent Starts on RHEL 4 Update 6 and 7
reference:
http://forums.oracle.com/forums/thread.jspa?threadID=871254
http://newappsdba.blogspot.com/2009/06/kernel-bug-and-oracle-enterprise-linux.html
kernel BUG at kernel/exit.c:904!
kernel/exit.c:904!
solution:
Upgraded the Kernel to version RHEL4.7
also
the same solution for the Enterprise Manager Agent Starts on RHEL 4
refer metalink Doc ID: 729543.1
Linux Crashes when Enterprise Manager Agent Starts on RHEL 4 Update 6 and 7
reference:
http://forums.oracle.com/forums/thread.jspa?threadID=871254
http://newappsdba.blogspot.com/2009/06/kernel-bug-and-oracle-enterprise-linux.html
Friday, August 27, 2010
Transparent Application Failover TAF Demo
Transparent Application Failover TAF Demo
here, i demonstrated the demo of TAF , i concentrate only the practical demo, for theoretical part refer the oracle documentation.
connect to the database on node1
simultaneously issue shutdown abort in new terminal
the query runs smoothly, user will not receive any kind of error messages.
then check the instance name in node1 machine.
checking node2 machine before and after TAF.
Hope, this will helps you to understand the TAF.
for theoritical part please refer oracle documentation.
Regards,
RAJESHKUMAR G
here, i demonstrated the demo of TAF , i concentrate only the practical demo, for theoretical part refer the oracle documentation.
1. BASIC METHOD
ADD THE ENTRIES TO THE RAC DATABASE NODE1 tnsnames.ora fileCDBS_TAF = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip.localdomain)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = racnode2-vip.localdomain)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdbs) (FAILOVER_MODE= (TYPE=SELECT) (METHOD=BASIC) ) ) )
Make sure all the resources are up and running. root@racnode1 bin]# ./crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora....s1.inst application ONLINE ONLINE racnode1 ora....s2.inst application ONLINE ONLINE racnode2 ora....bs1.srv application ONLINE ONLINE racnode1 ora....bs2.srv application ONLINE ONLINE racnode2 ora...._srv.cs application ONLINE ONLINE racnode2 ora.cdbs.db application ONLINE ONLINE racnode2 ora....SM1.asm application ONLINE ONLINE racnode1 ora....E1.lsnr application ONLINE ONLINE racnode1 ora....de1.gsd application ONLINE ONLINE racnode1 ora....de1.ons application ONLINE ONLINE racnode1 ora....de1.vip application ONLINE ONLINE racnode1 ora....SM2.asm application ONLINE ONLINE racnode2 ora....E2.lsnr application ONLINE ONLINE racnode2 ora....de2.gsd application ONLINE ONLINE racnode2 ora....de2.ons application ONLINE ONLINE racnode2 ora....de2.vip application ONLINE ONLINE racnode2 [oracle@racnode1 admin]$ sqlplus system/oracle@CDBS_TAF SQL*Plus: Release 10.2.0.1.0 - Production on Thu Aug 26 17:36:45 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options SQL> show user; USER is "SYSTEM" SQL> col osuser format a10 SQL> col username format a10 SQL> col failover_type format a15 SQL> col failover_method format a18 SQL> select username,osuser,failover_method,failover_type from v$session 2 where username='SYSTEM'; USERNAME OSUSER FAILOVER_METHOD FAILOVER_TYPE ---------- ---------- ------------------ --------------- SYSTEM oracle BASIC SELECT SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- cdbs1 SQL> select count(*) from demotb; COUNT(*) ---------- 954 SQL> select * from demotb; run the long running query simultaneously open another terminal and give shutdown abort instance cdbs1 SQL> shu abort ORACLE instance shut down. but the query runs smoothly without any interruption after the completion of the query, verify the instance name SQL>select instance_name from v$instance; INSTANCE_NAME ---------------- cdbs2 automatically it switch over to the instance cdbs2 , because of this user can access the database and no failure in queries. users can access without interruption. USER will not receive any error message while running query.
2. PRECONNECT METHOD
Add the entries to the tnsnames.ora file on both nodes.CDBS1_TAF = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdbs) (INSTANCE_NAME = cdbs1) (FAILOVER_MODE= (BACKUP=CDBS2_TAF) (TYPE=SELECT) (METHOD=PRECONNECT) ) ) ) CDBS2_TAF = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = racnode2-vip.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdbs) (INSTANCE_NAME = cdbs2) (FAILOVER_MODE= (BACKUP=CDBS1_TAF) (TYPE=SELECT) (METHOD=PRECONNECT) ) ) )
connect to the database on node1
[oracle@racnode1 ~]$ sqlplus system/oracle@CDBS1_TAF SQL*Plus: Release 10.2.0.1.0 - Production on Fri Aug 27 12:23:11 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options SQL> SELECT INSTANCE_NAME FROM V$INSTANCE; INSTANCE_NAME ---------------- cdbs1 SQL> COL USERNAME FOR a10 SQL> col osuser for a10 SQL> col failover_type format a15 SQL> col failover_method for a18 SQL> select username,failover_type,failover_method from v$session 2 where username='SYSTEM'; USERNAME FAILOVER_TYPE FAILOVER_METHOD ---------- --------------- ------------------ SYSTEM SELECT PRECONNECT SQL> select count(*) from demo; COUNT(*) ---------- 49783 run the long running query. SQL> select * from demo;
simultaneously issue shutdown abort in new terminal
SQL> shu abort; ORACLE instance shut down. SQL>
the query runs smoothly, user will not receive any kind of error messages.
then check the instance name in node1 machine.
SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- cdbs2 SQL> select username,osuser,failover_type,failover_method from v$session 2 where username='SYSTEM'; USERNAME OSUSER FAILOVER_TYPE FAILOVER_METHOD ---------- ---------- --------------- ------------------ SYSTEM oracle SELECT PRECONNECT SQL>
checking node2 machine before and after TAF.
Before TAF SQL> select username,osuser,failover_type,failover_method from v$session 2 where username='SYSTEM'; USERNAME OSUSER FAILOVER_TYPE ------------------------------ ------------------------------ ------------- FAILOVER_M ---------- SYSTEM oracle NONE NONE SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- cdbs2 SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- cdbs2 After TAF. SQL> select username,osuser,failover_type,failover_method from v$session 2 where username='SYSTEM'; USERNAME OSUSER FAILOVER_TYPE ------------------------------ ------------------------------ ------------- FAILOVER_M ---------- SYSTEM oracle SELECT PRECONNECT SQL>
Hope, this will helps you to understand the TAF.
for theoritical part please refer oracle documentation.
Regards,
RAJESHKUMAR G
Labels:
RAC CONCEPTS
Thursday, August 26, 2010
[PRKC-1044 : Failed to check remote command execution setup for node
[PRKC-1044 : Failed to check remote command execution setup for node racnode1.localdomain using shells /usr/bin/ssh and /usr/bin/rsh Permission denied.]]
solution:
#
Log in as the software owner (in this example, the oracle user).
note: dont use su - oracle , logout and login as oracle user.
make sure you login as oracle user.
#
To ensure that you are logged in as the Oracle user, and that the user ID matches the expected user ID you have assigned to the Oracle user, enter the commands id. Ensure that Oracle user group and user and the terminal window process group and user IDs are identical.
example: check it on both nodes
While logged in as oracle perform the following on each of the nodes of the RAC:
1. cd $HOME
2. mkdir ~/.ssh
3. chmod 700 ~/.ssh
4. /usr/bin/ssh-keygen -t rsa
5. /usr/bin/ssh-keygen -t dsa
On Node 1:
1. cd $HOME/.ssh
2. cat id_rsa.pub >> authorized_keys
3. cat id_dsa.pub >> authorized_keys
4. Copy the authorized_keys file to the node 2. scp authorized_keys racnode2:/home/oracle/.ssh
On Node 2:
1. cd $HOME/.ssh
2. cat id_rsa.pub >> authorized_keys
3. cat id_dsa.pub >> authorized_keys
4. scp authorized_keys racnode1:/home/oracle/.ssh
On each node, enter the following commands to start the SSH agent, and to load the SSH keys into memory:
$ exec /usr/bin/ssh-agent $SHELL
$ /usr/bin/ssh-add
At the prompt, enter the pass phrase for each key that you generated.
* Now perform a ssh between all the nodes including the node-priv hostnames as well. Check to make sure that ssh is configured well without prompting for the password (on both the nodes):
#
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
If not then edit and uncomment them. Restart the ssh once you make these changes.
Restart OpenSSH server
Type the following command:
#/etc/init.d/ssh restart
if [ -t 0 ]; then
stty intr ^C
fi
#
ln -s /usr/bin/ssh /usr/local/bin/ssh
ln -s /usr/bin/scp /usr/local/bin/scp
From NODE 1
ssh racnode1 date
ssh racnode2 date
ssh racnode1.localdomain date
ssh racnode2.localdomain date
ssh racnode1-priv date
ssh racnode2-priv date
ssh racnode1-priv.localdomain date
ssh racnode2-priv.localdomain date
From NODE 2
ssh racnode1 date
ssh racnode2 date
ssh racnode1.localdomain date
ssh racnode2.localdomain date
ssh racnode1-priv date
ssh racnode2-priv date
ssh racnode1-priv.localdomain date
ssh racnode2-priv.localdomain date
Hope, This will resolve your issue.
references:
http://download.oracle.com/docs/cd/B28359_01/install.111/b28263/prelinux.htm#BABJBAEB
solution:
Configure SSH between two nodes
#
Log in as the software owner (in this example, the oracle user).
note: dont use su - oracle , logout and login as oracle user.
make sure you login as oracle user.
#
To ensure that you are logged in as the Oracle user, and that the user ID matches the expected user ID you have assigned to the Oracle user, enter the commands id. Ensure that Oracle user group and user and the terminal window process group and user IDs are identical.
example: check it on both nodes
[oracle@racnode1 ~]$ id uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba) [oracle@racnode2 ~]$ id uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)#
While logged in as oracle perform the following on each of the nodes of the RAC:
1. cd $HOME
2. mkdir ~/.ssh
3. chmod 700 ~/.ssh
4. /usr/bin/ssh-keygen -t rsa
5. /usr/bin/ssh-keygen -t dsa
On Node 1:
1. cd $HOME/.ssh
2. cat id_rsa.pub >> authorized_keys
3. cat id_dsa.pub >> authorized_keys
4. Copy the authorized_keys file to the node 2. scp authorized_keys racnode2:/home/oracle/.ssh
On Node 2:
1. cd $HOME/.ssh
2. cat id_rsa.pub >> authorized_keys
3. cat id_dsa.pub >> authorized_keys
4. scp authorized_keys racnode1:/home/oracle/.ssh
$ exec /usr/bin/ssh-agent $SHELL
$ /usr/bin/ssh-add
At the prompt, enter the pass phrase for each key that you generated.
* Now perform a ssh between all the nodes including the node-priv hostnames as well. Check to make sure that ssh is configured well without prompting for the password (on both the nodes):
#
Can you make sure your sshd_config file as following entries uncommented?
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
If not then edit and uncomment them. Restart the ssh once you make these changes.
Restart OpenSSH server
Type the following command:
#/etc/init.d/ssh restart
Add the entries to the .bashrc file as oracle user
#if [ -t 0 ]; then
stty intr ^C
fi
#
Try creating a symbolic link:
ln -s /usr/bin/ssh /usr/local/bin/ssh
ln -s /usr/bin/scp /usr/local/bin/scp
After you set the dsa and rsa keys in to the authorized_keys file.
From NODE 1
ssh racnode1 date
ssh racnode2 date
ssh racnode1.localdomain date
ssh racnode2.localdomain date
ssh racnode1-priv date
ssh racnode2-priv date
ssh racnode1-priv.localdomain date
ssh racnode2-priv.localdomain date
From NODE 2
ssh racnode1 date
ssh racnode2 date
ssh racnode1.localdomain date
ssh racnode2.localdomain date
ssh racnode1-priv date
ssh racnode2-priv date
ssh racnode1-priv.localdomain date
ssh racnode2-priv.localdomain date
Hope, This will resolve your issue.
references:
http://download.oracle.com/docs/cd/B28359_01/install.111/b28263/prelinux.htm#BABJBAEB
Labels:
CLUSTERWARE,
Installation,
RAC CONCEPTS
Saturday, August 21, 2010
ORA-01122: ORA-01110: ORA-01206: After RMAN duplicate in source database
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '+DATA/demodb/datafile/system.296.726853295'
ORA-01206: file is not part of this database - wrong database id
Reason:
RMAN Duplicate command updates source database, datafile headers.
Solution:
Restore and Recover the database with RMAN Backup.
to avoid this error add the following entries in pfile(clone/duplicate database)
db_file_name_convert='+DATA/DEMODB/DATAFILE/','/u01/app/oracle/oradata/dupdb/'
log_file_name_convert='+DATA/DEMODB/ONLINELOG/','/u01/app/oracle/oradata/dupdb/'
or set new name command in rman script.
ORA-01110: data file 1: '+DATA/demodb/datafile/system.296.726853295'
ORA-01206: file is not part of this database - wrong database id
Reason:
RMAN Duplicate command updates source database, datafile headers.
Solution:
Restore and Recover the database with RMAN Backup.
to avoid this error add the following entries in pfile(clone/duplicate database)
db_file_name_convert='+DATA/DEMODB/DATAFILE/','/u01/app/oracle/oradata/dupdb/'
log_file_name_convert='+DATA/DEMODB/ONLINELOG/','/u01/app/oracle/oradata/dupdb/'
or set new name command in rman script.
[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [+ASM2] ? demodb
[oracle@rac2 ~]$ rlsqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 21 14:32:31 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, Real Application Clusters and OLAP options
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '+DATA/demodb/datafile/system.296.726853295'
ORA-01206: file is not part of this database - wrong database id
oracle@rac2 backup]$ . oraenv
ORACLE_SID = [demodb] ? demodb
[oracle@rac2 backup]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Aug 21 14:34:47 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: DEMODB (DBID=3723121283, not open)
RMAN> restore database
2> ;
Starting restore at 21-AUG-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 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 +DATA/demodb/datafile/system.296.726853295
restoring datafile 00002 to +DATA/demodb/datafile/undotbs1.298.726853331
restoring datafile 00003 to +DATA/demodb/datafile/sysaux.297.726853315
restoring datafile 00004 to +DATA/demodb/datafile/users.299.726853339
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/DEMODB_02ll6n2k_1_1.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/backup/DEMODB_02ll6n2k_1_1.bkp tag=TAG20100813T000329
channel ORA_DISK_1: restore complete, elapsed time: 00:02:38
Finished restore at 21-AUG-10
RMAN> recover database;
Starting recover at 21-AUG-10
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 3 is already on disk as file +DATA/demodb/archivelog/2010_08_13/thread_1_seq_3.311.726883477
archive log thread 1 sequence 4 is already on disk as file +DATA/demodb/archivelog/2010_08_13/thread_1_seq_4.312.726885007
archive log thread 1 sequence 5 is already on disk as file +DATA/demodb/archivelog/2010_08_13/thread_1_seq_5.313.726940211
archive log thread 1 sequence 6 is already on disk as file +DATA/demodb/archivelog/2010_08_13/thread_1_seq_6.314.726940893
archive log thread 1 sequence 7 is already on disk as file +DATA/demodb/archivelog/2010_08_13/thread_1_seq_7.315.726940901
archive log filename=+DATA/demodb/archivelog/2010_08_13/thread_1_seq_3.311.726883477 thread=1 sequence=3
archive log filename=+DATA/demodb/archivelog/2010_08_13/thread_1_seq_4.312.726885007 thread=1 sequence=4
archive log filename=+DATA/demodb/archivelog/2010_08_13/thread_1_seq_5.313.726940211 thread=1 sequence=5
media recovery complete, elapsed time: 00:00:39
Finished recover at 21-AUG-10
RMAN> exit
Recovery Manager complete.
[oracle@rac2 backup]$ . oraenv
ORACLE_SID = [demodb] ?
[oracle@rac2 backup]$ rlsqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 21 14:44:48 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, Real Application Clusters and OLAP options
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery
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 7
Next log sequence to archive 9
Current log sequence 9
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/demodb/datafile/system.296.726853295
+DATA/demodb/datafile/undotbs1.298.726853331
+DATA/demodb/datafile/sysaux.297.726853315
+DATA/demodb/datafile/users.299.726853339
SQL>
Labels:
ORA-01122: ORA-01110: ORA-01206:
Subscribe to:
Posts (Atom)