3.7 Introduction to backup and recovery mechanism --------------------------------------------- - physical and logical backup/recovery 3.7.1 Physical backup/recovery ------------------------ - Archive log mode. Types of failures (user, statement, user process, instance (automatic), media). - Physical backup methods: offline (cold), online (hot). Full and partial backups. - Online backup See PH95p#164,v2 by Rama Velpury For releases >= 7.2 a new functionalitity is introduced: if the machine crashed while taking HOT (ONLINE) backup the headers of the files of tablespaces which where in BEGIN BACKUP mode are not updated during checkpointing and have the old log sequence number. Any attempt to startup database causes "ORA-01113: file n needs media recovery" error. To fix thei problem v7.2 introduces new command: ALTER DATABASE DATAFILE 'file_name' END BACKUP; which writes in the file header valid log sequence number. Oracle can distinguish between a current data file in HOT BACKUP MODE and a RESTORED COPY of the data file by compiring the CHECKPOINT COUNTERS in the file header and the control file. V$BACKUP view allows check to see whether any data files are in HOT BACKUP mode. If the Status column says ACTIVE, then the file is in HOT BACKUP mode - Recovery without achieving. Recovery steps. - Partial recovery (until cancel, time, SCN) WARNING! After restoring all the files (database, control, redo logs) DO NOT STARTUP OPEN restored database because status on files is changed and subsequent recovery will fail! You must STARTUP MOUNT and RESTORE DATABASE UNTIL <...> [USING BACKUP CONTROL FILE] - Structures required for recovery. - Operate with achieving. - Archive modes overview. - Display archive status. - Specify and change archive modes. - Enable and disable archive processing. - Online partial database backup. - Offline partial tablespace backup. - Recover all transactions after media failure. Recover online redo log and control file. - Incomplete (partial) recovery. 3.7.2 Logical backup/recovery & space compaction ------------------------------------------ - export/import. - Export modes. Possible exports scenarios. - Import modes. - Questions and answers Q: What should you be aware of with a full import from one database to another?? Is it different if Oracle7? A: Be aware of export/import from one database into another on the same machine when running V6. You should be very careful, and pre-create all of the tablespaces with the same name regardless of whether you want them or not. With a full import all the tablespaces are created and with the datafiles reused. The export file has the exact path to the datafiles. For example, although I am importing from my test database into my production, tablespaces will be initialized. The production database will crash at the next file access, and the only way to recover is to go to a backup. This is how the create tablespace statement books in import: . importing user SYSTEM "CREATE TABLESPACE "TEST" DATAFILE 'DISK$TEMP:[VMSSPT.VMSSPT1.DB_VMSSPT3]TES" "T.DBS' SIZE 2097152 REUSE DEFAULT STORAGE (INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENS 99 PCTINCREASE 50) ONLINE" A possible workaround is to rename the dbs files of all you tablespaces, precreate ALL the tablespaces, or don't issue a full import. Its natural to think, sure all you have to do is export from one and import into another, however, this could cause problems. This doesn't apply to the Oracle7 import utility, it has the DESTROY option added for this issue. DESTROY=N tells import that if the file exists, do not destroy it, instead, give an error on the create tablespaces statement. DESTROY=Y will reuse the tablespace file.