1. 确保数据库处于归档模式 SQL archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 237 Next log sequence to archive 239 Current log sequence 239
1. 确保数据库处于归档模式
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 237
Next log sequence to archive 239
Current log sequence 239
2. 找到需要备份的文件
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/home/oracle11/app/oracle11/oradata/orcl/system01.dbf
/home/oracle11/app/oracle11/oradata/orcl/sysaux01.dbf
/home/oracle11/app/oracle11/oradata/orcl/undotbs01.dbf
/home/oracle11/app/oracle11/oradata/orcl/users01.dbf
3. 记下联机重做日志的最大序列号
SQL> select thread#,max(sequence#)
2 from v$log
3 group by thread#
4 order by thread#;
THREAD# MAX(SEQUENCE#)
---------- --------------
1 239
4. 将数据库/表空间更改为备份模式
SQL> alter database begin backup;
Database altered.
5. 使用OS实用程序复制数据文件
cp /home/oracle11/app/oracle11/oradata/orcl/*.dbf /home/oracle11/duanbb/backup/
6. 使数据库/表空间退出备份模式
SQL> alter database end backup;
Database altered.
7. 归档当前联机重做日志,并记下联机重做日志的最大序列号
SQL> alter system archive log current;
System altered.
SQL> select thread#, max(sequence#)
2 from v$log
3 group by thread#
4 order by thread#;
THREAD# MAX(SEQUENCE#)
---------- --------------
1 240
8. 备份在执行备份过程中生成的所有归档重做日志
cp /home/oracle11/app/oracle11/flash_recovery_area/ORCL/archivelog/2015_03_30/o1_mf_1_239_bkktz0j7_.arc /home/oracle11/duanbb/backup/
9. 备份控制文件
SQL> alter database backup controlfile
2 to '/home/oracle11/duanbb/backup/controlbk.ctl' reuse;
Database altered.
概括一下:
1. 备份数据文件
2. 备份归档日志
3. 备份控制文件
根据<<深入理解Oracle12c 数据库管理>>中的内容整理而成