Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.

Similar presentations


Presentation on theme: "INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved."— Presentation transcript:

1 INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.

2 DATABASE BACKUP Why backup the database? In case the database needs to be recovered due to a hardware or end user created failure. Types of database backups include: Logical Backup – Uses IMPort/EXPort. Often used to recover dropped tables. Saves the data. Physical Backup – Used to recover the database from hardware failures. Saves the databases data files or data blocks. Backups can be either COLD or HOT.

3 Logical Database Backup In a logical backup the data in the database is backed up, not the data file.. To create a full backup using the “export” utility the DBA issues the following at the operating system command prompt exp system/manager file=full.dmp log=full.log full=y consistent=y Copyright System Managers LLC 2008 all rights reserved.

4 Logical Database Recovery The “import” utility is used when performing a logical database recovery. The DBA issues the following at the operating system command prompt: imp system/manager file=full.dmp log=full.log full=y commit=y Copyright System Managers LLC 2008 all rights reserved.

5 File Level Cold Database Backup Cold backup - Backup that is taken when the database is shutdown. Find files to be backed up: SQL > select member from v$logfile; SQL > select file_name from sys.dba_data_files; SQL > select name from v$controlfiles; Shutdown the database To perform a cold backup save the data files, online log files and control files. Start the database. Copyright System Managers LLC 2008 all rights reserved.

6 File Level Hot Database Backup Hot backup - Backup taken while the database is up (end users can also access the database during the backup). Requires that the database be run in ARCHIVELOG mode. Redo log files are moved to offline storage by the ARCH process when they fill up. Allows for recovery to the point in time of failure Copyright System Managers LLC 2008 all rights reserved.

7 File Level Hot Database Backup Hot Database Backup Process: Save database control file by using: alter database backup controlfile to trace as '/directory- path/file_name'; Save tablespace data files using the ALTER TABLESPACE BEGIN BACKUP; Copy files to backup directory. ALTER TABLESPACE END BACKUP; Save achieved log files using OS copy command Copyright System Managers LLC 2008 all rights reserved.

8 Block Level Hot Database Backup Recovery Manager (RMAN) Block level database backup is done using Oracle’s Recovery Manager (RMAN) utility. Only changed data blocks are written to the backup file. To start RMAN issue the command: rman target sys/manager nocatalog The user will be placed into the RMAN command line interface, and see the following prompt: RMAN > Copyright System Managers LLC 2008all rights reserved.

9 Block Level Hot Database Backup To execute a RMAN command script from the operating system prompt, issue: rman target sys/manager1 nocatalog cmdfile='/directory/hbackup_full.rman' log='/directory/hbackup_full.log‘ Copyright System Managers LLC 2008all rights reserved.

10 Block Level Hot Database Backup Hot backup script hbackup_full.rman: run { allocate channel dev1 type disk; sql "alter system archive log current"; backup validate database archivelog all; backup database format = '/backup/s2t/fdb0_t%t_s%s_p%p'; backup format = '/backup/s2t/far0_t%t_s%s_p%p'archivelog all delete input; release channel dev1; } Copyright System Managers LLC 2008 all rights reserved.

11 Block Level Cold Database Backup The following RMAN script will create a cold backup of the database. run { # Shutdown database for backups and put into MOUNT mode shutdown immediate startup mount allocate channel t1; # Perform full database backup and restart DB. backup full format "%d_FULL_%U" (database) ; sql 'alter database open'; backup current controlfile; sql 'ALTER DATABASE BACKUP CONTROLFILE TO TRACE'; release channel t1; }

12 File Level Database Recovery If the database is running in ARCHIVELOG mode, the DBA issues one of the following commands from the SQL*Plus prompt: RECOVER DATABASE – Recover the entire database RECOVER TABLESPACE – Recover a single tablespace RECOVER DATAFILE - Recover a data file associated with a tablespace. In all cases listed above Oracle will prompt the DBA for the location of the archive log files that will be applied to recovering the data files.

13 Block Level Database Recovery Entering RMAN commands on CLI to recover an entire database (commands can be placed in a file for batch execution): RMAN> run { RMAN> allocate channel t1 type disk; RMAN> restore controlfile to ' '; RMAN> sql "alter database mount"; RMAN> restore database; RMAN> recover database; RMAN> sql "alter database open resetlogs"; RMAN> }

14 Block Level Database Recovery RMAN script to recover a single tablespace: run { allocate channel t1 type disk; restore tablespace users; recover tablespace users; release channel t1; } Copyright System Managers LLC 2008 all rights reserved.

15 RMAN Views Database backup and restore performance views: Copyright System Managers LLC 2008 all rights reserved. V$SESSION_LONGOPS RMAN backup and restore job progress. V$SESSION_WAIT Lists the events or resources for which sessions are waiting. V$BACKUP_ASYNC_IO Displays rows when the I/O is asynchronous to the process performing the backup. V$BACKUP_SYNC_IO Displays rows when the I/O is synchronous to the process performing the backup.

16 DATABASE BACKUP Types of backups include logical and physical database backups Physical backups allow for the recovery of the database due to hardware problems Types of physical backups include Hot and Cold backups Hot backup – backup taken while database is open to end users. Hot backups allow for database recovery to the point in time of failure Database should be run in ARCHIVELOG mode.for hot backups and point in time recovery Copyright System Managers LLC 2008 all rights reserved.


Download ppt "INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved."

Similar presentations


Ads by Google