Tuesday, July 30, 2013

0 Oracle Backup /Restore (1)

In this article, I am going to demo the basic Oracle Backup/Restore.

 

Find all the database files:

select name from v$datafile;
select name from v$tempfile;
select name from v$controlfile;
select member from v$logfile;

image

Offline backup/Cold backup

Shutdown the database server and use the operation command to copy.

 

Online Backup/Warm backup

-- Begin the backup for all datafile
alter database begin backup;
-- Begin backup for single data file
alter tablespace example begin backup;
-- Check if the data file is in backup mode
select * from v$backup;

image

  • Shutdown the database server and use the operation command to copy.
  • Also need to backup the parameter file.
  • Backup the log file, archive the current log and backup the log use os command
ALTER SYSTEM ARCHIVE LOG current;
  • Backup the control file
alter database backup controlfile to '/u01/app/oracle/control_back.ctl';

image

Database Recovery

-- shutdown the database and listener
-- startup listener
-- start database mount
-- recover database
-- alter database open

 

User Tablespace recovery

alter tablespace example offline immediate;
recover tablespace example;
alter tablespace example online;

image

image

image

 

image

 

DataFILE recovery

alter database datafile '/u01/app/oracle/oradata/oracledb1/system01.dbf' online;
recover datafile '/u01/app/oracle/oradata/oracledb1/system01.dbf';
alter database open;

image

0 comments:

Post a Comment

 

SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates