Vous êtes sur la page 1sur 2

Backup & Recovery

Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The reconstructing of data is achieved through media recovery, which refers to the various operations involved in restoring, rolling forward, and rolling back a backup of database files. A backup is a copy of data. This copy can include important parts of the database, such as the control file and datafiles. A backup is a safeguard against unexpected data loss and application errors. If you lose the original data, then you can reconstruct it by using a backup. Backups are divided into physical backups and logical backups. Physical backups, which are the primary concern in a backup and recovery strategy, are copies of physical database files. You can make physical backups with either the Recovery Manager (RMAN) Utility or operating system utilities. In contrast, logical backups contain logical data (for example, tables and stored procedures) extracted with an oracle utility and stored in a binary file. You can use logical backups to supplement physical backups. There are two ways to perform Oracle backup and recovery: Recovery Manager and user managed backup and recovery. 1.Offline backup 2.Online backup 3.logical backup 4.RMAN. 1:Offline backup: To take offline backup we need to shutdown the database before taking backup. Before we shutdown, we must know about the location of files to be copied. Though only datafiles are to be backed up, we can also backup controlfile and redolog files in offline backup. Follow the steps below to take offline backup: Sql>spool backup.sql Sql>select host cp v ||file_name|| /path/backup from dba_data_files union Select host cp v ||name|| /path/backup from v$controlfile union

Select host cp v ||member|| /path/backup from v$logfile; Sql>spool off Sql>shutdown immediate; Sql>@backup.sql Sql>startup The above steps will copy all datafiles, control files and redo log files to /path/backup. 2. Online backup: It may be hard to find the time to shutdown the instance and copy the files, in such situations you may take online backup. Follow the steps below to take online backup: Sql>spool obackup.sql Sql>select host cp v ||file_name|| /path/backup from dba_data_files; Sql>spool off Sql>alter database begin backup; (database should be in archive log mode.) Sql>select file#, status from v$backup; Sql>@obackup.sql Sql>alter database end backup; Sql>alter database backup controlfile to /path/backup/control.ctl.bkp;

Vous aimerez peut-être aussi