9i backup and recovery scenario

32
Oracle 9i Backup and Recovery In case of a restore from hot backup, please ensure you have taken care of all temporary files. It has been observed in the past that all data files were restored but temporary files were ignored. Scenario 1 -- loss of INACTIVE online Redo Log Group SQL> startup ORACLE instance started. Total System Global Area 26286444 bytes Fixed Size 452972 bytes Variable Size 20971520 bytes Database Buffers 4194304 bytes Redo Buffers 667648 bytes Database mounted. ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: 'C:\ORACLASS\ORADATA\U03\ LOG01A.RDO' ORA-00312: online log 1 thread 1: 'C:\ORACLASS\ORADATA\U04\ LOG01B.RDO' NOTE: Assumption is that there is least 3 redo log group in order to do the following. SQL> alter database drop logfile group 1; Database altered. SQL> alter database open; Database altered. SQL> select group#, thread#,bytes, members from v$log; GROUP# THREAD# BYTES MEMBERS ---------- ---------- ---------- ---------- 2 1 10485760 2 1

Upload: gaurav-nanda

Post on 02-Apr-2015

283 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

In case of a restore from hot backup, please ensure you have taken care of all temporary files. It has been observed in the past that all data files were restored but temporary files were ignored.

Scenario 1 -- loss of INACTIVE online Redo Log Group

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-00313: open failed for members of log group 1 of thread 1ORA-00312: online log 1 thread 1: 'C:\ORACLASS\ORADATA\U03\LOG01A.RDO'ORA-00312: online log 1 thread 1: 'C:\ORACLASS\ORADATA\U04\LOG01B.RDO'

NOTE: Assumption is that there is least 3 redo log group in order to do the following.

SQL> alter database drop logfile group 1;Database altered.

SQL> alter database open;Database altered.

SQL> select group#, thread#,bytes, members from v$log; GROUP# THREAD# BYTES MEMBERS ---------- ---------- ---------- ---------- 2 1 10485760 2 3 1 10485760 2

SQL> select member from v$logfile;MEMBER-----------------------------------C:\ORACLASS\ORADATA\U03\LOG02A.RDOC:\ORACLASS\ORADATA\U04\LOG02B.RDOC:\ORACLASS\ORADATA\U03\LOG03A.RDOC:\ORACLASS\ORADATA\U04\LOG03B.RDO

SQL> alter database add logfile group 1 2 ('c:\oraclass\oradata\u03\log01a.rdo', 'c:\oraclass\oradata\u04\log01b.rdo') size 10485760;Database altered.

1

Page 2: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

2

Page 3: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 2 -- loss of CURRENT online Redo Log GroupIf you created your logfile groups with duplicate online log files -- that is two or more logfiles per group, then you can copy the good (remaining) log file to the missing log file and you will be able to open the db fine. This is our standard.Check from select * from v$logfile;

If you created only one log file per group then you have two choices. You can open a TAR with oracle support for help in forcing the database open when you have lost your active log file. Or, judging by the low sequence numbers of your log files, you may be able to recreate the database from scratch and reapply any transactions. This is shown below:

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-00313: open failed for members of log group 1 of thread 1ORA-00312: online log 1 thread 1: 'C:\ORACLASS\ORADATA\U03\LOG01A.RDO'

SQL> alter database drop logfile group 1;alter database drop logfile group 1*ERROR at line 1:ORA-01623: log 1 is current log for thread 1 - cannot dropORA-00312: online log 1 thread 1: 'C:\ORACLASS\ORADATA\U03\LOG01A.RDO'

SQL> select group#, status, sequence# from v$log; GROUP# STATUS SEQUENCE# ---------- ---------------- --------- 1 CURRENT 69 2 INACTIVE 68 3 INACTIVE 67

log group #1 is the current logfile.

SQL> shutdown immediate;Database dismounted.ORACLE instance shut down.

Restore all Datafile (listed in V$DATAFILE)

SQL> startup

3

Page 4: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

ORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.

4

Page 5: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 2 -- loss of CURRENT online Redo Log Group (continue)

SQL> recover automatic database until cancel;ORA-00279: change 193738 generated at 11/18/2002 12:31:03 needed for thread 1ORA-00289: suggestion : C:\ORACLE\ORA92\RDBMS\ARC00069.001ORA-00280: change 193738 for thread 1 is in sequence #69ORA-00278: log file 'C:\ORACLE\ORA92\RDBMS\ARC00069.001' no longer needed forthis recoveryORA-00308: cannot open archived log 'C:\ORACLE\ORA92\RDBMS\ARC00069.001'ORA-27041: unable to open fileOSD-04002: unable to open fileO/S-Error: (OS 2) The system cannot find the file specified.

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}cancelMedia recovery cancelled.

SQL> alter database open resetlogs;Database altered.

SQL> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination C:\oracle\ora92\RDBMSOldest online log sequence 1Next log sequence to archive 1Current log sequence 1

SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

Do a full database backup

5

Page 6: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 3 -- loss of Control Files

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesORA-00205: error in identifying controlfile, check alert log for more infoSQL> shutdownORA-01507: database not mountedORACLE instance shut down.

At this point I refer to the backup done in the past of the controlfile done via the following command: SQL> alter database backup controlfile to trace; Database altered.

Find the file created in the directory listed below and edit the file removing all the lines above the STARTUP NOMOUNT, and also change the # to -- (comments). NOTE: there are two STARTUP MOUNT’s in the file.

SQL> show parameter user NAME TYPE VALUE ------------------------- ----------- --------------------------- user_dump_dest string c:\oraclass\ADMIN\UDUMP

SQL> @controlfileORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesControl file created.ORA-00283: recovery session canceled due to errorsORA-00264: no recovery required

ALTER SYSTEM ARCHIVE LOG ALL*ERROR at line 1:ORA-00271: there are no logs that need archivingDatabase altered.Database altered.Tablespace altered.Tablespace altered.

6

Page 7: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 4 – Loss of Media

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 5 - see DBWR trace fileORA-01110: data file 5: 'C:\ORACLASS\ORADATA\U02\SAMPLE01.DBF'

SQL> select file#, error from v$recover_file; FILE# ERROR---------- --------------------------------------------------------- 2 FILE NOT FOUND 5 FILE NOT FOUND

SQL> select file#,name from v$datafile; FILE# NAME ---------- ---------------------------------------- 1 C:\ORACLASS\ORADATA\U01\SYSTEM01.DBF 2 C:\ORACLASS\ORADATA\U02\UNDOTBS.DBF 3 C:\ORACLASS\ORADATA\U03\USERS01.DBF 4 C:\ORACLASS\ORADATA\U03\INDX01.DBF 5 C:\ORACLASS\ORADATA\U02\SAMPLE01.DBF 6 C:\ORACLASS\ORADATA\U01\QUERYDATA01.DBF

6 rows selected.

Looking at the OS you find that the mount point has been lost and all of files on it. This one also has the UNDO tablespace, So a closed recovery is required.

I restore all lost files.

@@@@@ alter statements!!!

SQL> recover automatic database;Media recovery complete.

SQL> alter database open;Database altered.

7

Page 8: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 5 -- loss of an Online UNDO Segment Tablespace Datafile

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 2 - see DBWR trace fileORA-01110: data file 2: 'C:\ORACLASS\ORADATA\U02\UNDOTBS.DBF'

A closed recover in my only option, so I restore the backup of the UNDO segment tablespace file.

SQL> recover automatic database;Media recovery complete.

SQL> alter database open;Database altered.

8

Page 9: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 6 -- loss of SYSTEM Tablespace Datafile

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 1 - see DBWR trace fileORA-01110: data file 1: 'C:\ORACLASS\ORADATA\U01\SYSTEM01.DBF'

A closed recover in my only option, so I restore the backup of the SYSTEM tablespace file.

SQL> recover automatic database;Media recovery complete.

SQL> alter database open;Database altered.

9

Page 10: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 7 -- Loss of a Non-System, Non-Rollback Segment Datafile

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 3 - see DBWR trace fileORA-01110: data file 3: 'C:\ORACLASS\ORADATA\U03\USERS01.DBF'

SQL> alter database datafile 3 offline;Database altered.

SQL> alter database open;Database altered.

At this point I restore the USERS01.DBF file from the backup.

SQL> recover automatic datafile 3;Media recovery complete.

SQL> alter database datafile 3 online;Database altered.

10

Page 11: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 8 – Time Based Recovery

Example table created10:01:10 SQL> create table sales as select * from sh.sales;Table created.10:02:50 SQL> select count(*) from sales;COUNT(*)-------------- 1016271

13:04:58 SQL> drop table sales;Table dropped.

This assumes that you have discovered the problem and have restored all the datafiles.

SQL> startup mountORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.13:20:33 SQL> recover automatic database until time '2002-11-18:13:03:00';Media recovery complete.

13:15:41 SQL> alter database open resetlogs;Database altered.

13:17:20 SQL> select count(*) from sales;

COUNT(*) ---------- 1016271

11

Page 12: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 9 -- Failure During Hot Backup

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01113: file 5 needs media recoveryORA-01110: data file 5: 'C:\ORACLASS\ORADATA\U02\SAMPLE01.DBF'

SQL> select * from v$backup;

FILE# STATUS CHANGE# TIME ---------- ------------------ ---------- --------- 1 NOT ACTIVE 0 2 NOT ACTIVE 0 3 NOT ACTIVE 0 4 NOT ACTIVE 0 5 ACTIVE 87244 15-NOV-02 6 NOT ACTIVE 0

6 rows selected.

SQL> alter database end backup;Database altered.

SQL> alter database open;Database altered.

12

Page 13: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 11 – Non-Essential datafile with no backup and no archivelog on

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 8 - see DBWR trace fileORA-01110: data file 8: 'C:\ORACLASS\ORADATA\U05\JUNK01.DBF'

SQL> alter database datafile 8 offline drop;Database altered.

SQL> alter database open;Database altered.

SQL> select d.name,t.name tblspace from 2 v$datafile d, v$tablespace t 3 where d.ts# = t.ts#; NAME TBLSPACE---------------------------------------- --------------------C:\ORACLASS\ORADATA\U01\SYSTEM01.DBF SYSTEMC:\ORACLASS\ORADATA\U02\UNDOTBS01.DBF UNDOTBSC:\ORACLASS\ORADATA\U03\USERS01.DBF USERSC:\ORACLASS\ORADATA\U03\INDX01.DBF INDXC:\ORACLASS\ORADATA\U02\SAMPLE01.DBF SAMPLEC:\ORACLASS\ORADATA\U01\QUERYDATA01.DBF QUERY_DATAC:\ORACLASS\ORADATA\U02\EXAMPLE01.DBF EXAMPLEC:\ORACLASS\ORADATA\U05\JUNK01.DBF JUNK

8 rows selected.

SQL> drop tablespace junk including contents;Tablespace dropped.

13

Page 14: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 12 – Loss of a datafile and missing archivelog file

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 3 - see DBWR trace fileORA-01110: data file 3: 'C:\ORACLASS\ORADATA\U03\USERS01.DBF'

Restore missing Datafile

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.

SQL> recover automatic database;ORA-00279: change 217990 generated at 11/19/2002 10:13:57 needed for thread 1ORA-00289: suggestion : C:\ORACLASS\ORADATA\ARCHIVE1\ARC00002.001ORA-00280: change 217990 for thread 1 is in sequence #2ORA-00278: log file 'C:\ORACLASS\ORADATA\ARCHIVE1\ARC00002.001' no longerneeded for this recoveryORA-00308: cannot open archived log 'C:\ORACLASS\ORADATA\ARCHIVE1\ARC00002.001'ORA-27041: unable to open fileOSD-04002: unable to open fileO/S-Error: (OS 2) The system cannot find the file specified.

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}cancelMedia recovery cancelled.

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

14

Page 15: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 12 – Loss of a datafile and missing archivelog file (continue)

Incomplete Recover is required at this point Restore all Datafile (listed in V$DATAFILE)

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01113: file 1 needs media recoveryORA-01110: data file 1: 'C:\ORACLASS\ORADATA\U01\SYSTEM01.DBF'

SQL> recover automatic until cancel;ORA-00279: change 217990 generated at 11/19/2002 10:13:57 needed for thread 1ORA-00289: suggestion : C:\ORACLASS\ORADATA\ARCHIVE1\ARC00002.001ORA-00280: change 217990 for thread 1 is in sequence #2ORA-00278: log file 'C:\ORACLASS\ORADATA\ARCHIVE1\ARC00002.001' no longerneeded for this recoveryORA-00308: cannot open archived log 'C:\ORACLASS\ORADATA\ARCHIVE1\ARC00002.001'ORA-27041: unable to open fileOSD-04002: unable to open fileO/S-Error: (OS 2) The system cannot find the file specified.

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}cancelMedia recovery cancelled.SQL> alter database open resetlogs;Database altered.

SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.

Do a full database backup

15

Page 16: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 13 -- Recover a lost Datafile with No Backup

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 7 - see DBWR trace fileORA-01110: data file 7: 'C:\ORACLASS\ORADATA\U04\NEW01.DBF'

A tablespace and table were created in the past with the following commands: SQL> create tablespace new_sample datafile 2 'c:\oraclass\oradata\u04\new01.dbf' size 1m; Tablespace created. SQL> create table new_tables (col1 number ,col2 number) 2 tablespace new_sample; Table created.

SQL> alter database datafile 7 offline;Database altered.

SQL> alter database open;Database altered.

SQL> alter database create datafile 'c:\oraclass\oradata\u04\new01.dbf';Database altered.

SQL> recover automatic datafile 7;Media recovery complete.

SQL> alter database datafile 7 online;Database altered.

SQL> select * from new_tables;no rows selected

16

Page 17: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 14 -- Missing Mirrored Online Redo Log Files

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.Database opened.

SQL> select group#, status, member from v$logfile; GROUP# STATUS MEMBER ---------- ------- ---------------------------------------- 3 C:\ORACLASS\ORADATA\U03\LOG03A.RDO 3 INVALID C:\ORACLASS\ORADATA\U04\LOG03B.RDO 2 C:\ORACLASS\ORADATA\U03\LOG02A.RDO 2 INVALID C:\ORACLASS\ORADATA\U04\LOG02B.RDO 1 C:\ORACLASS\ORADATA\U03\LOG01A.RDO 1 INVALID C:\ORACLASS\ORADATA\U04\LOG01B.RDO

SQL> select group#, sequence#, archived, status from v$log; GROUP# SEQUENCE# ARC STATUS ---------- ---------- --- ---------------- 1 17 YES INACTIVE 2 18 YES INACTIVE 3 19 NO CURRENT

SQL> alter database drop logfile member 2 'C:\ORACLASS\ORADATA\U04\LOG01B.RDO';Database altered.SQL> alter database drop logfile member 2 'C:\ORACLASS\ORADATA\U04\LOG02B.RDO';Database altered.SQL> alter database drop logfile member 2 'C:\ORACLASS\ORADATA\U04\LOG03B.RDO';alter database drop logfile member 'C:\ORACLASS\ORADATA\U04\LOG03B.RDO'*ERROR at line 1:ORA-01609: log 3 is the current log for thread 1 - cannot drop membersORA-00312: online log 3 thread 1: 'C:\ORACLASS\ORADATA\U03\LOG03A.RDO'ORA-00312: online log 3 thread 1: 'C:\ORACLASS\ORADATA\U04\LOG03B.RDO'

17

Page 18: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 14 -- Missing Mirrored Online Redo Log Files (Continued)

SQL> alter system switch logfile;System altered.SQL> alter database drop logfile member 2 'C:\ORACLASS\ORADATA\U04\LOG03B.RDO';Database altered.SQL> alter database add logfile member 2 'C:\ORACLASS\ORADATA\U04\LOG01B.RDO' to group 1;Database altered.SQL> alter database add logfile member 2 'C:\ORACLASS\ORADATA\U04\LOG02B.RDO' to group 2;Database altered.SQL> alter database add logfile member 2 'C:\ORACLASS\ORADATA\U04\LOG03B.RDO' to group 3;Database altered.SQL> select group#, status, member from v$logfile; GROUP# STATUS MEMBER ---------- ------- ---------------------------------------- 3 C:\ORACLASS\ORADATA\U03\LOG03A.RDO 3 INVALID C:\ORACLASS\ORADATA\U04\LOG03B.RDO 2 C:\ORACLASS\ORADATA\U03\LOG02A.RDO 2 INVALID C:\ORACLASS\ORADATA\U04\LOG02B.RDO 1 C:\ORACLASS\ORADATA\U03\LOG01A.RDO 1 INVALID C:\ORACLASS\ORADATA\U04\LOG01B.RDO

SQL> alter system switch logfile;System altered.SQL> alter system switch logfile;System altered.SQL> alter system switch logfile;System altered.SQL> select group#, status, member from v$logfile;

GROUP# STATUS MEMBER ---------- ------- ---------------------------------------- 3 C:\ORACLASS\ORADATA\U03\LOG03A.RDO 3 C:\ORACLASS\ORADATA\U04\LOG03B.RDO 2 C:\ORACLASS\ORADATA\U03\LOG02A.RDO 2 C:\ORACLASS\ORADATA\U04\LOG02B.RDO 1 C:\ORACLASS\ORADATA\U03\LOG01A.RDO 1 C:\ORACLASS\ORADATA\U04\LOG01B.RDO

18

Page 19: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 15 – Missing Controlfile and Read Only Datafile

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesORA-00205: error in identifying controlfile, check alert log for more info

SQL> @c:\oraclass\backup\ctlControl file created.ORA-00283: recovery session canceled due to errorsORA-00264: no recovery required

System altered.Database altered.

ALTER DATABASE RENAME FILE 'MISSING00006'*ERROR at line 1:ORA-01511: error in renaming log/data filesORA-01141: error renaming data file 6 - new file'C:\ORACLASS\ORADATA\U01\QUERYDATA01.DBF' not foundORA-01111: name for data file 6 is unknown - rename to correct fileORA-01110: data file 6: 'C:\ORACLE\ORA92\DATABASE\MISSING00006'ORA-27041: unable to open fileOSD-04002: unable to open fileO/S-Error: (OS 2) The system cannot find the file specified.

ALTER TABLESPACE "QUERY_DATA" ONLINE*ERROR at line 1:ORA-01157: cannot identify/lock data file 6 - see DBWR trace fileORA-01111: name for data file 6 is unknown - rename to correct fileORA-01110: data file 6: 'C:\ORACLE\ORA92\DATABASE\MISSING00006'Tablespace altered.

SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.

19

Page 20: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 15 – Missing Controlfile and Read Only Datafile (continue)

Copy the backup of the QUERYDATA01.DBF datafile

SQL> @c:\oraclass\backup\ctlORACLE instance started.

Total System Global Area 118037284 bytesFixed Size 453412 bytesVariable Size 113246208 bytesDatabase Buffers 4194304 bytesRedo Buffers 143360 bytes

Control file created.ORA-00283: recovery session canceled due to errorsORA-00264: no recovery required

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

20

Page 21: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Scenario 16 -- Lost of Datafile used as Default Temporary Tablespace

SQL> startupORACLE instance started.Total System Global Area 26286444 bytesFixed Size 452972 bytesVariable Size 20971520 bytesDatabase Buffers 4194304 bytesRedo Buffers 667648 bytesDatabase mounted.Database opened.SQL> select * from dba_tab_columns order by 1,2,3,4;ERROR:ORA-01157: cannot identify/lock data file 201 - see DBWR trace fileORA-01110: data file 201: 'C:\ORACLASS\ORADATA\U02\TEMP01.DBF'no rows selected

SQL> create temporary tablespace temp2 tempfile 'c:\oraclass\oradata\u02\temp02.ora' size 2m;Tablespace created.

SQL> alter database default temporary tablespace temp2;Database altered.

SQL> drop tablespace temp including contents and datafiles;Tablespace dropped.

SQL> create temporary tablespace temp tempfile 'c:\oraclass\oradata\u02\tem01p.ora' size 20m;Tablespace created.

SQL> alter database default temporary tablespace temp;Database altered.

SQL> drop tablespace temp2 including contents and datafiles;Tablespace dropped.

21

Page 22: 9i backup and recovery scenario

Oracle 9i Backup and Recovery

Changes to the SPFILE that are valid

SQL> alter system set pga_aggregate_target=5m scope=spfile;System altered.

SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startupORA-00093: pga_aggregate_target must be between 10M and 4096G-1

The only way I could the fix the problem was to delete the spfile and create an init.ora file from the non-default parameters from the alert log file.

22