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
Recovering from a TEMPFILE Loss Password file Parameter file SYSTEM SYSAUX UNDO USERS INDEX Redo log file 1B Redo log file 1A Redo log file 2B Redo log file 2A Control files TEMP
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.
Recovering from the Loss of a Redo Log Group Group status Inactive Active Fix media? Yes No Clear log file Perform checkpoint CKPT successful? Yes Done No Restore and recover until cancel Start Current
Clearing a Log File Log file archived? Yes No Start ALTER DATABASE CLEAR LOGFILE ... ALTER DATABASE CLEAR LOGFILE UNARCHIVED ... Needed for data file? No ALTER DATABASE CLEAR LOGFILE UNARCHIVED ... UNRECOVERABLE DATAFILE Yes
A tablespace that contains only indexes may be recovered without performing a RECOVER task.
If a data file that belongs to an index-only tablespace is lost, it may be simpler to re-create the tablespace and re-create the indexes.
Authentication Methods for Database Administrators Remote database administration Local database administration Yes Yes No No Do you have a secure connection? Use OS authentication. Use a password file. Do you want to use OS authentication?
Re-Creating a Password Authentication File $ orapwd file=$ORACLE_HOME/dbs/orapworcl password=ora entries=5 SQL> grant sysdba to admin2; grant sysdba to admin2 * ERROR at line 1: ORA-01994: GRANT failed: password file missing or disabled
To recover from the loss of a password file:
Re-create the password file by using orapwd .
Add users to the password file and assign appropriate privileges to each user.
Re-Creating a Password Authentication File Full Notes Page
Complete recovery: Brings the database up to the present, including all committed data changes made to the point in time when the recovery was requested
Incomplete recovery: Brings the database up to a specified point in time in the past, before the recovery operation was requested
Recovery task started at this time Complete recovery Incomplete recovery Missing transactions after incomplete recovery Restore from this backup Time of crash
Complete Recovery Process Restored data files Data files containing committed and uncommitted transactions Recovered data files Changes applied Undo applied 5 1 Database opened 6 3 2 Archived log Archived log Online Redo log 4
Incomplete Recovery Process Data files containing committed and uncommitted transactions up to PIT PIT-recovered data files X X Changes applied to point in time (PIT) Restored data files from as far back as necessary Undo applied 5 1 Database opened Archived log Archived log Online Redo log 6 3 2 4
Performing a User-Managed Backup of the Database ARCHIVELOG mode? Shutdown Put tablespaces into backup mode Copy files No Yes
The Need for Backup Mode Database block A DML statement updates a database block: Different parts of the block are written to at different times: t 2 t 1 t 3 Copy data file while online If the block is copied at time t 2 , then the block is fractured .
Identifying Files to Manually Backup SQL> select name from v$datafile; NAME ------------------------------------------------------------------------/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_36mky81f_.dbf /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_36mky81p_.dbf /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_36mky857_.dbf /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_36mky876_.dbf /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_36ml2cmh_.dbf /u01/app/oracle/oradata/ORCL/datafile/survey01.dbf SQL> select name from v$controlfile; NAME ------------------------------------------------------------------------/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_36ml1f8x_.ctl /u01/app/oracle/flash_recovery_area/ORCL/controlfile/o1_mf_36ml1fkk_.ctl
Can be done with the entire database at once, or a data file or tablespace at a time
Requires a current control file
Requires backups of all files to be recovered
Requires all archive logs up to the present
Performing Complete Closed Database Recovery: Overview Database open? Shutdown. No Yes Query for files to recover. Query for needed archive logs. Restore damaged files and archive logs. Repair hardware. Mount database. Open database. Recover data files. Bring data files online.
SQL> RECOVER AUTOMATIC FROM '/u01/arch_temp' DATABASE; Apply each redo log without prompting. Alternate location for restored archive log files Could be DATABASE , TABLESPACE , or DATAFILE
Open the database:
SQL> ALTER DATABASE OPEN;
Performing Complete Open Database Recovery Query for files to recover. Query for needed archive logs. Restore damaged files and archive logs. Diagnose media problem. Recover data files. Bring tablespaces online. Take damaged data files offline. Yes No Done Can bring data files online?
Performing Complete Open Database Recovery Full Notes Page
Recovering from the Loss of All Control File Copies: Overview Online log status Data file status Unavailable Available Restore backup control file, perform complete recovery, OPEN RESETLOGS Restore backup control file, perform complete recovery, OPEN RESETLOGS Restore backup control file, perform incomplete recovery, OPEN RESETLOGS Backup Re-create control file, OPEN RESETLOGS Current
Recovering the Control File to the Default Location Repair hardware. Yes SHUTDOWN ABORT Restore control file. STARTUP MOUNT Start database recovery. No Yes Specify online log. Open database using RESETLOGS . No Database open? Archivelog missing?