Making User-Managed Backups-17.3Making User-Managed Backups of Offline Tablespaces and Datafiles(示例
Posted jhcelue
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Making User-Managed Backups-17.3Making User-Managed Backups of Offline Tablespaces and Datafiles(示例相关的知识,希望对你有一定的参考价值。
17.3、Making User-Managed Backups of Offline Tablespaces and Datafiles
备份离线的表空间时。须要注意下面指导原则:
(1)不能离线system表空间或活动回滚段的表空间
(2)如果一个表在表空间x中,它的索引在表空间y中。y离线,x在线,当运行dml语句时会报错。
备份离线表空间:
(1)备份表空间前,查询dba_data_files识别表空间的数据文件。
(2)尽量使用normal选项离线表空间。由于它确保把表空间置为在线时不须要恢复
(3)备份离线的数据文件
(4)把表空间置为在线
注意:假设使用temporary或immediate优先,仅仅有完毕表空间恢复才干把表空间置为在线
(5)归档未归档的重做日志
SQL> alter system archive log current;
模拟1、把表空间testtbs01离线。然后备份离线的数据文件
(1)
SQL> col file_name for a40
SQL> select tablespace_name,file_name from dba_data_files where tablespace_name=‘TESTTBS01‘;
TABLESPACE_NAME FILE_NAME
------------------------------ ----------------------------------------
TESTTBS01 /oracle/oradata/boss/testtbs01_01.dbf
TESTTBS01 /oracle/oradata/boss/testtbs01_02.dbf
(2)
SQL> alter tablespace testtbs01 offline normal;
(3)
$ cp -rf /oracle/oradata/boss/testtbs01_01.dbf /oradata/bossbak/20140604/testtbs01_01_`date "+%y_%m_%d"`.dbf
$ cp -rf /oracle/oradata/boss/testtbs01_02.dbf /oradata/bossbak/20140604/testtbs01_02_`date "+%y_%m_%d"`.dbf
(4)
SQL> alter tablespace testtbs01 online;
(5)
SQL> select group#,members,sequence#,archived,status,first_change# from v$log;
GROUP# MEMBERS SEQUENCE# ARC STATUS FIRST_CHANGE#
---------- ---------- ---------- --- ---------------- -------------
1 1 17 YES INACTIVE 575472
2 1 18 YES INACTIVE 575475
3 1 19 NO CURRENT 575477
SQL> alter system archive log current;
SQL> select group#,members,sequence#,archived,status,first_change# from v$log;
GROUP# MEMBERS SEQUENCE# ARC STATUS FIRST_CHANGE#
---------- ---------- ---------- --- ---------------- -------------
1 1 20 YES ACTIVE 581638
2 1 21 NO CURRENT 581693
3 1 19 YES ACTIVE 575477
SQL> alter system checkpoint; ##检查点触发dbwrn写进程。把脏数据写入数据文件,此时active的日志马上变为inactive。
SQL> select group#,members,sequence#,archived,status,first_change# from v$log;
GROUP# MEMBERS SEQUENCE# ARC STATUS FIRST_CHANGE#
---------- ---------- ---------- --- ---------------- -------------
1 1 20 YES INACTIVE 581638
2 1 21 NO CURRENT 581693
3 1 19 YES INACTIVE 575477
以上是关于Making User-Managed Backups-17.3Making User-Managed Backups of Offline Tablespaces and Datafiles(示例的主要内容,如果未能解决你的问题,请参考以下文章
Performing User-Managed Database-18.7Performing Complete User-Managed Media Recovery
3 Mental Habits Making You Miserable
Survey of Automated Market Making Algorithms