Re-creating Redo Log Files

Download Report

Transcript Re-creating Redo Log Files

Recovering from Noncritical Losses
Copyright © 2006, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to:
• Recover temporary tablespaces
• Recover a redo log group member
• Recover from a lost index
• Re-create the password file
4-2
Copyright © 2006, Oracle. All rights reserved.
Causes of File Loss
File loss can be caused by:
• User error
• Application error
• Media failure
4-3
Copyright © 2006, Oracle. All rights reserved.
Critical Versus Noncritical
A noncritical file loss is one where the database can
continue to function.
You fix the problem by taking one of these actions:
• Create a new file.
• Rebuild the file.
• Recover the lost or damaged file.
4-4
Copyright © 2006, Oracle. All rights reserved.
Losing a TEMPFILE
SQL statements that require TEMP space to execute fail
if one of the tempfiles is missing.
SQL> select * from big_table order by
1,2,3,4,5,6,7,8,9,10,11,12,13;
select * from big_table order by
1,2,3,4,5,6,7,8,9,10,11,12,13
*
ERROR at line 1:
ORA-01565: error in identifying file
'/u01/app/oracle/oradata/orcl/temp01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
4-5
Copyright © 2006, Oracle. All rights reserved.
Recovering from a TEMPFILE Loss
SYSTEM
USERS
Redo log Redo log
file 1A
file 1B
SYSAUX
INDEX
Redo log Redo log
file 2A
file 2B
UNDO
TEMP
Control
files
Parameter
file
Password
file
4-6
Copyright © 2006, Oracle. All rights reserved.
Log Group Status: Review
A redo log group has a status of one of the
following values at any given time:
• CURRENT: The LGWR process is
currently writing redo data to it.
• ACTIVE: It is no longer being written
to, but it is still required for instance
recovery.
• INACTIVE: It is no longer being
written to, and it is no longer required
for instance recovery.
4-7
Copyright © 2006, Oracle. All rights reserved.
Losing a Redo Log Group Member
The alert log and the archiver process (ARCn) trace file
record an error when a redo member file is missing.
Errors in file
/u01/app/oracle/admin/orcl/bdump/orcl_arc1_25739.trc:
ORA-00313: open failed for members of log group 2 of
thread 1
ORA-00312: online log 2 thread 1:
'/u01/app/oracle/oradata/orcl/redo02b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
4-8
Copyright © 2006, Oracle. All rights reserved.
Re-creating Redo Log Files
SYSTEM
USERS
Redo log Redo log
file 1A
file 1B
SYSAUX
INDEX
Redo log Redo log
file 2A
file 2B
UNDO
TEMP
Control
files
Parameter
file
Password
file
SQL>
>
SQL>
SQL>
>
>
4-9
ALTER DATABASE DROP LOGFILE MEMBER
'/u01/app/oracle/oradata/orcl/redo02b.log';
!rm /u01/app/oracle/oradata/orcl/redo02b.log
ALTER DATABASE ADD LOGFILE MEMBER
'/u01/app/oracle/oradata/orcl/redo02b.log'
TO GROUP 2;
Copyright © 2006, Oracle. All rights reserved.
Re-creating Redo Log Files
4-12
Copyright © 2006, Oracle. All rights reserved.
Re-creating Indexes
Use options to reduce the time it takes to create the
index:
• PARALLEL
• NOLOGGING
SQL> CREATE INDEX rname_idx
2 ON hr.regions (region_name)
3 PARALLEL 4;
4-13
Copyright © 2006, Oracle. All rights reserved.
Authentication Methods
for Database Administrators
Remote database
administration
Do you
have a secure
connection?
Local database
administration
Yes
No
4-15
Do you want
to use OS
authentication?
Yes
No
Copyright © 2006, Oracle. All rights reserved.
Use OS
authentication.
Use a
password file.
Re-creating a Password
Authentication File
1. Log in to the database by using OS authentication.
2. Set the REMOTE_LOGIN_PASSWORDFILE parameter
to NONE and restart the database.
3. Re-create the password file by using orapwd.
$ orapwd file=$ORACLE_HOME/dbs/orapwORCL
password=admin entries=5
4. Set REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE.
5. Add users to the password file and assign
appropriate privileges to each user.
6. Restart the instance.
4-16
Copyright © 2006, Oracle. All rights reserved.
Summary
In this lesson, you should have learned how to:
• Recover temporary tablespaces
• Recover a redo log group member
• Recover from a lost index
• Re-create the password file
4-18
Copyright © 2006, Oracle. All rights reserved.
Practice Overview: Recovering from Lost
TEMPFILE and Redo Log File
This practice covers the following topics:
• Starting the database with a missing tempfile
• Creating a new temporary tablespace
• Altering the default temporary tablespace for a
database
• Recovering from a lost online redo log member
4-19
Copyright © 2006, Oracle. All rights reserved.