1、做次全备份
run{
backup tag 'full' format 'd:\rmanbk\full_%d_s%s_p%p_%t'
database plus archivelog delete all input;
}
SQL> select * from test;
ID SYS_DATE
---------- -------------------
1 2008-06-12 10:55:19
2 2008-06-12 10:55:23
3 2008-06-12 10:56:20
4 2008-06-12 10:56:26
5 2008-06-12 11:02:35
6 2008-06-12 11:02:39
7 2008-06-12 11:02:44
8 2008-06-12 11:03:52
2、删除5、6
SQL> delete test where id='5' or id='6';
已删除2行。
SQL> commit;
提交完成。
SQL> select * from test;
ID SYS_DATE
---------- -------------------
1 2008-06-12 10:55:19
2 2008-06-12 10:55:23
3 2008-06-12 10:56:20
4 2008-06-12 10:56:26
7 2008-06-12 11:02:44
8 2008-06-12 11:03:52
已选择6行。
插入9、10
SQL> insert into test select 9,sysdate from dual;
已创建 1 行。
SQL> insert into test select 10,sysdate from dual;
已创建 1 行。
SQL> commit;
提交完成。
3、SQL> select * from test;
ID SYS_DATE
---------- -------------------
1 2008-06-12 10:55:19
2 2008-06-12 10:55:23
3 2008-06-12 10:56:20
4 2008-06-12 10:56:26
7 2008-06-12 11:02:44
8 2008-06-12 11:03:52
9 2008-06-12 11:28:59
10 2008-06-12 11:29:03
已选择8行。
归档备份
RMAN> backup archivelog all delete input tag 'arc' format 'd:\rmanbk\arc_%t';
4、SQL> insert into test select 11,sysdate from dual;
已创建 1 行。
SQL> insert into test select 12,sysdate from dual;
已创建 1 行。
SQL> select * from test;
ID SYS_DATE
---------- -------------------
1 2008-06-12 10:55:19
2 2008-06-12 10:55:23
3 2008-06-12 10:56:20
4 2008-06-12 10:56:26
12 2008-06-12 11:31:04
7 2008-06-12 11:02:44
8 2008-06-12 11:03:52
9 2008-06-12 11:28:59
10 2008-06-12 11:29:03
11 2008-06-12 11:31:01
已选择10行。
归档备份
RMAN> backup archivelog all delete input tag 'arc' format 'd:\rmanbk\arc_%t';
5、数据库到mount状态
startup force mount
6、恢复
RMAN> run{
2> allocate channel ch1 type disk;
3> set until time "to_date('2008-06-12 11:28:59','YYYY-MM-DD hh24:mi:ss')";
4> restore database;
5> recover database;
6> release channel ch1;
7> }
恢复后应该显示绿色显示部分
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
会话已更改。
SQL> select * from test;
ID SYS_DATE
---------- -------------------
1 2008-06-12 10:55:19
2 2008-06-12 10:55:23
3 2008-06-12 10:56:20
4 2008-06-12 10:56:26
7 2008-06-12 11:02:44
8 2008-06-12 11:03:52
总结:恢复的时间点必须是最后一次备份(全备、归档等)前的时间
阅读(1769) | 评论(0) | 转发(1) |