Your SlideShare is downloading. ×
Backup and Recovery
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Backup and Recovery


Published on

Published in: Technology

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. AnarGodjaev BACKUP and RECOVERY Lsnrctl services [listener01] Mean_time_between_failures Mean_time_to_recover //*should be bigger in value*// //*should be smaller in value*// Problem Statement failure logic error insufficient privileges Process failure ‐user session abnormally terminated User errors ‐drop table ‐truncate table ‐delete...commit Instance failure v$sgastat - pool - name - bytes v$log - group_number - log_sequence_number - size_of_the_group - number_of_members v$logfile - name - status - group large pool - backup restore operations - I/O server processes - Session memory fro shared users - Large_pool_size (approximately 2gb) Rman - dbwr_io_slaves (integer) - backup_tape_io_slaves (true|false) Solution Statement failure Add filespace to the tablespace Pmon Recover from a backup Restart the instance
  • 2. AnarGodjaev SQL> alter system switch logfile; Alter database db_name rename file ‘...’ to ‘...’; Fast_start_mttr_target: expectedmttr specified in seconds amount of the time that has passed since the incremental checkpoint at the position where the last write to redo log file occured. Log_checkpoint_interval: number of redo log file blocks that can exist between an incremental checkpoint and the last block written to the redo log. v$instance recovery recovery_estimated_ios: ‐ recovery_estimated_ios: number of dirty buffers in the buffer cache actual_redo_blks: - current actual number of redo blocks required for recovery taret_redo_blks: - current number of redo blocks that must be processed for recovery log_file_size_redo_blks: - current number of redo blocks required to guarantee that a log switch doesnt occur before checkpoint. log_chkpt_timeout_redo_blks: estimated_mttr: current estimated mean time to recover (mttr). Based on the number of dirty buffers and redo log blocks. ckpt_block_writes: number of blocks written by checkpoint writes v$fast_start_servers v$fast_start_transactions rolling forward phase - set recovery_parallelism<integer> - use parallel clause in the recover database statement rolling back phase ‐ set fast_start_parallel_rollback [false | low | high] //low is default user managed backup and recovery offline backup – consistant whole database setup
  • 3. AnarGodjaev SQL> shutdown immediate !cp<files> /backup/... //control file, datafile, redo log file, password file, parameter file startup open online backup – the database should be in archive log mode SQL> alter tablespace users begin backup !copy the datafiles altertablespace users end backup alter system archivelog current //archive the unarchivedredologs so that the redo required to recover the tablespace backup is achieved query the following views. v$backup //file,status,change,time v$datafile_header SQL> alter database end backup; Alter database datafile ‘...’ end backup; Alter tablespace<tablespace name> read only; !backup the datafiles Alter tablespace<tablespace name> read write; Logging and nologging Set database to nologging for faster data loading After this you should backup the datafiles SQL> Alter database backup controlfile to ‘control01.bck’; Alter database backup controlfile to trace; Obtain database information by quering the following views v$datafile v$controlfile v$logfile dba_datafiles user managed recovery - time based - cancel based - change based recovery steps 1‐ damaged files are restored from backup 2‐ changes from archived redo logs or online redo logs are applied if necessary
  • 4. AnarGodjaev 3‐ the database may now contain commited and uncommited changes 4‐ the undo block are used to rollback any uncommited changes 5‐ the database is now in recoverd state recovery in noarchivelog mode 1‐ restore all datafiles even one of them needs recovery 2‐ shutdown the instance 3‐ perform cancel based recovery 4‐ open database with resetlogs SQL> shutdown immediate !cp ‘...’ ‘...’ recover database until cancel using backup control file cancel alter database open resetlogs recovery in archivelog mode 1‐ query the v$recover_file, v$archived_log, v$recovery_log 2‐ recover database //mounted database 3‐ recover datafile ‘...’ //mounted database 4‐ recover tablespaceusers //open database 5‐ recover datafile ‘...’ //open database SQL> shutdown abort Startup mount Recover database //recover datafile ‘...’ Alter database open !cp ‘...’ ‘...’ alter database rename file ‘...’ to ‘...’ startup mount alter database datafile ‘...’ offline alter database open restoredatafile alter database rename file ‘...’ to ‘...’ alter database recover recoverdatafile ‘...’ //recover tablespace<tablespace name> alter database datafile ‘...’ online; altertablespaceuser_data offline immediate; alter database create datafile ‘...’ [as] ‘...’; alter database recover; altertablespacetable_data online;
  • 5. AnarGodjaev createcontrolfile; recover database using backup controlfile; 1‐ shutdown and backup the database 2‐ restore all datafiles, dont restore controlfile, redo logs, password file and parameter file 3‐ mount database 4‐ recover datafiles 5‐ open database with resetlogs 6‐ perform a closed database backup SQL> Recover database until cancel Recover [automatic] database until time ‘2013‐10‐26:14:22:03’ Time based database recovery 1‐ shutdown and backup the database 2‐ restore all datafiles //may need to recover archivelogs 3‐ mount database 4‐ recover database until time 5‐ open with resetlogs 6‐ backup the database cancel based database recovery 1‐ redo logs are not multiplexed one of the redo logs is missing the missing redo log is not archived 2‐ shutdown database 3‐ restore all datafiles from backup 4‐ mount the database 5‐ recover database until cancel 6‐ open database with resetlogs 7‐ backup database loss of current redo log files - attempt to open database - find the current log sequence number - recover database until cancel - drop and recreate log files if necessary - open database with resetlogs - perform whole database backup //select * from v$log SQL> alter database clear unarchivedlogfile group 2;