backup as compressed backupset database include
current controlfile plus all archivedlog format=......;
sql> select * from t;
id name brith
---------- -------------------- --------------
1 a 14-12月-06
sql> set time on
12:29:30 sql> select table_name from user_tables;
table_name
------------------------------
t
tt
12:41:48 sql> create table ttt(id int) tablespace test;
表已创建。
12:42:07 sql> insert into ttt values(1);
已创建 1 行。
12:42:12 sql> commit;
提交完成。
12:42:14 sql> drop table t;
表已删除。
c:>rman target sys/system@test auxiliary
sys/system@auxi catalog rman/rman@orcl
恢复管理器: release 10.2.0.1.0 - production
on 星期五 12月 15 15:02:21 2006
copyright (c) 1982, 2005, oracle. all rights reserved.
连接到目标数据库: test (dbid=1906627575)
连接到恢复目录数据库
已连接到辅助数据库: test (未装载)
rman> run{
2> allocate auxiliary channel c1 type disk;
3> recover tablespace 'test' until
time "to_date('12/15/2006 12:42:14' , 'mm/dd/
yyyy hh24:mi:ss')" auxiliary
destination 'e:oracleproduct10.2.0oradataauxi'
;
4> release channel c1;
5> }
分配的通道: c1
通道 c1: sid=156 devtype=disk
启动 recover 于 15-12月-06
内存脚本的内容:
{
# set the until clause
set until time "to_date
('12/15/2006 12:42:14' , 'mm/dd/yyyy hh24:mi:ss')";
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log for tspitr to a resent until time
sql 'alter system archive log current';
# avoid unnecessary autobackups for
structural changes during tspitr
sql 'begin dbms_backup_restore.autobackupflag(false); end;';
# resync catalog after controlfile restore
resync catalog;
}
正在执行内存脚本
正在执行命令: set until clause
启动 restore 于 15-12月-06
通道 c1: 正在开始恢复数据文件备份集
通道 c1: 正在复原控制文件
通道 c1: 正在读取备份段 e:rmanatest_09i50smu_1_1.bak
通道 c1: 已恢复备份段 1
段句柄 = e:rmanatest_09i50smu_1_1.bak 标记 = tag20061215t124006
通道 c1: 恢复完成, 用时: 00:00:03
输出文件名=e:oracleproduct10.2.0oradataauxicontrol01.ctl
输出文件名=e:oracleproduct10.2.0oradataauxicontrol02.ctl
完成 restore 于 15-12月-06
sql 语句: alter database mount clone database
sql 语句: alter system archive log current
sql 语句: begin dbms_backup_restore.autobackupflag(false); end;
正在启动全部恢复目录的 resync
完成全部 resync
内存脚本的内容:
{
# generated tablespace point-in-time recovery script
# set the until clause
set until time "to_date
('12/15/2006 12:42:14' ,'mm/dd/yyyy hh24:mi:ss')";
plsql <<<-- tspitr_2
declare
sqlstatement varchar2(512);
offline_not_needed exception;
pragma exception_init(offline_not_needed, -01539);
begin
sqlstatement := 'alter tablespace '||
'test' ||' offline for recover';
krmicd.writemsg(6162, sqlstatement);
krmicd.execsql(sqlstatement);
exception
when offline_not_needed then
null;
end; >>>;
# set a destination filename for restore
set newname for datafile 1 to
"e:oracleproduct10.2.0oradataauxisystem01.dbf";
# set a destination filename for restore
set newname for datafile 2 to
"e:oracleproduct10.2.0oradataauxiundotbs01.dbf";
# set a destination tempfile
set newname for tempfile 1 to
"e:oracleproduct10.2.0oradataauxitemp01.dbf";
# set a destination tempfile
set newname for tempfile 2 to
"e:oracleproduct10.2.0oradataauxitmp.dbf";
# set a destination filename for restore
set newname for datafile 4 to
"e:oracleproduct10.2.0oradatatesttest.dbf";
# rename all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery
set plus the auxilliary tablespaces
restore clone datafile 1, 2, 4;
switch clone datafile all;
#online the datafiles restored or flipped
sql clone "alter database datafile 1 online";
#online the datafiles restored or flipped
sql clone "alter database datafile 2 online";
#online the datafiles restored or flipped
sql clone "alter database datafile 4 online";
# make the controlfile point at the restored
datafiles, then recover them
recover clone database tablespace "test",
"system", "undotbs1" delete archivelo
g;
alter clone database open resetlogs;
# plug here the creation of a temporary
tablespace if export fails due to lack
# of temporary space.
# for example in unix these two lines would do that:
#sql clone "create tablespace aux_tspitr_tmp
# datafile ''/tmp/aux_tspitr_tmp.dbf'' size 500k";
}
正在执行内存脚本
正在执行命令: set until clause
sql 语句: alter tablespace test offline for recover
正在执行命令: set newname
正在执行命令: set newname
正在执行命令: set newname
正在执行命令: set newname
正在执行命令: set newname
启动 restore 于 15-12月-06
通道 c1: 正在开始恢复数据文件备份集
通道 c1: 正在指定从备份集恢复的数据文件
正将数据文件00001恢复到e:oracleproduct10.2.0oradataauxisystem01.dbf
正将数据文件00002恢复到e:oracleproduct10.2.0oradataauxiundotbs01.dbf
正将数据文件00004恢复到e:oracleproduct10.2.0oradatatesttest.dbf
通道 c1: 正在读取备份段 e:rmanatest_08i50sl7_1_1.bak
通道 c1: 已恢复备份段 1
段句柄 = e:rmanatest_08i50sl7_1_1.bak 标记 = tag20061215t124006
通道 c1: 恢复完成, 用时: 00:01:09
完成 restore 于 15-12月-06
数据文件 4 已转换成数据文件副本
输入数据文件副本 recid=9 stamp=609260651 文件名=e:oracleproduct10.2.0oradata
testtest.dbf
sql 语句: alter database datafile 1 online
sql 语句: alter database datafile 2 online
sql 语句: alter database datafile 4 online
启动 recover 于 15-12月-06
正在开始介质的恢复
存档日志线程 1 序列 116 已作为文件 e:oracleproduct10.2.0flash_recovery_area
testarchivelog2006_12_15o1_mf_1_116_2r49v29r_.arc 存在于磁盘上
存档日志线程 1 序列 117 已作为文件 e:oracleproduct10.2.0flash_recovery_area
testarchivelog2006_12_15o1_mf_1_117_2r4l4s2x_.arc 存在于磁盘上
存档日志文件名 =e:oracleproduct10.2.0flash_recovery_areatestarchivelog200
6_12_15o1_mf_1_116_2r49v29r_.arc 线程 =1 序列 =116
存档日志文件名 =e:oracleproduct10.2.0flash_recovery_areatestarchivelog200
6_12_15o1_mf_1_117_2r4l4s2x_.arc 线程 =1 序列 =117
介质恢复完成, 用时: 00:00:02
完成 recover 于 15-12月-06
数据库已打开
内存脚本的内容:
{
# export the tablespaces in the recovery set
host 'exp userid ="sys/system@auxi as sysdba"
point_in_time_recover=y tablespa
ces=
test file=
tspitr_a.dmp';
# shutdown clone before import
shutdown clone immediate
# import the tablespaces in the recovery set
host 'imp userid ="sys/system@test as sysdba" point_in_time_recover=y file=
tspitr_a.dmp';
# online/offline the tablespace imported
sql "alter tablespace test online";
sql "alter tablespace test offline";
# enable autobackups in case user does
open resetlogs from rman after tspitr
sql 'begin dbms_backup_restore.autobackupflag(true); end;';
# resync catalog after tspitr finished
resync catalog;
}
正在执行内存脚本
export: release 10.2.0.1.0 - production
on 星期五 12月 15 15:04:34 2006
copyright (c) 1982, 2005, oracle. all rights reserved.
连接到: oracle database 10g enterprise
edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
已导出 zhs16gbk 字符集和 al16utf16 nchar 字符集
服务器使用 zhs16cgb231280 字符集 (可能的字符集转换)
注: 将不导出表数据 (行)
即将导出表空间时间点恢复对象...
对于表空间 test...
. 正在导出簇定义
. 正在导出表定义
. . 正在导出表 tt
exp-00091: 正在导出有问题的统计信息。
exp-00008: 遇到 oracle 错误 6552
ora-06552: pl/sql: compilation unit analysis terminated
ora-06553: pls-553: 无法识别字符集名称
. . 正在导出表 t
exp-00091: 正在导出有问题的统计信息。
exp-00008: 遇到 oracle 错误 6552
ora-06552: pl/sql: compilation unit analysis terminated
ora-06553: pls-553: 无法识别字符集名称
. . 正在导出表 ttt
. 正在导出引用完整性约束条件
. 正在导出触发器
. 终止时间点恢复
导出成功终止, 但出现警告。
主机命令完成
数据库已关闭
数据库已卸载
oracle 实例已关闭
import: release 10.2.0.1.0 - production
on 星期五 12月 15 15:05:01 2006
copyright (c) 1982, 2005, oracle. all rights reserved.
连接到: oracle database 10g enterprise
edition release 10.2.0.1.0 - production
with the partitioning, olap and data mining options
经由常规路径由 export:v10.02.01 创建的导出文件
即将导入表空间时间点恢复对象...
已经完成 zhs16gbk 字符集和 al16utf16 nchar 字符集中的导入
导入服务器使用 zhs16cgb231280 字符集 (可能的字符集转换)
. 正在将 sys 的对象导入到 sys
. 正在将 xys 的对象导入到 xys
. . 正在导入表 "tt"
. . 正在导入表 "t"
. . 正在导入表 "ttt"
. 正在将 sys 的对象导入到 sys
成功终止导入, 没有出现警告。
主机命令完成
sql 语句: alter tablespace test online
sql 语句: alter tablespace test offline
sql 语句: begin dbms_backup_restore.autobackupflag(true); end;
正在启动全部恢复目录的 resync
完成全部 resync
已删除辅助实例文件 e:oracleproduct10.2.0oradataauxicontrol01.ctl
已删除辅助实例文件 e:oracleproduct10.2.0oradataauxicontrol02.ctl
已删除辅助实例文件 e:oracleproduct10.2.0oradataauxisystem01.dbf
已删除辅助实例文件 e:oracleproduct10.2.0oradataauxiundotbs01.dbf
已删除辅助实例文件 e:oracleproduct10.2.0oradataauxitemp01.dbf
已删除辅助实例文件 e:oracleproduct10.2.0oradataauxitmp.dbf
完成 recover 于 15-12月-06
--====================================
14:48:22 sql> select tablespace_name , status from dba_tablespaces;
tablespace_name status
------------------------------ ------------------
system online
undotbs1 online
sysaux online
temp online
test offline
tmp online
test1 online
已选择7行。
15:06:14 sql> alter tablespace test online;
表空间已更改。
15:06:28 sql> show user
user 为 "xys"
15:06:32 sql> select * from t;
id name brith
---------- -------------- --------
1 a 2006/12/14 08:44:24
|