- 最后登录
- 2017-5-4
- 在线时间
- 81 小时
- 威望
- 999
- 金钱
- 2391
- 注册时间
- 2013-9-11
- 阅读权限
- 150
- 帖子
- 1124
- 精华
- 5
- 积分
- 999
- UID
- 1220
|
1#
发表于 2017-4-15 19:41:39
|
查看: 1301 |
回复: 0
今天在测试库上无意间发现这样一个问题,有些疑问,请教一下大家
步骤大致如下:
1.非归档模式下运行,mount状态做了RMAN全库备份,备份时的SCN为1039556
2.向T表中插入数据,关闭数据库
SQL> select * from t;
ID NAME
---------- -------------------
1 a
2 ab
3 abc
4 abcd
SQL> insert into t values(5,'abcde');
1 row created.
SQL> commit;
Commit complete.
SQL> alter system checkpoint;
System altered.
SQL> select * from t;
ID NAME
---------- -------------------
1 a
2 ab
3 abc
4 abcd
5 abcde
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
复制代码
id为5的数据虽然写入到了文件中,之后文件被我删除了,但是这个数据仍然在redo group 1中;
3.删除system01.dbf文件;启动数据库到mount状态,查看数据文件信息,结果如下:
SQL> startup mount
ORACLE instance started.
Total System Global Area 264241152 bytes
Fixed Size 2065048 bytes
Variable Size 167775592 bytes
Database Buffers 88080384 bytes
Redo Buffers 6320128 bytes
SQL> select file#,checkpoint_change# from v$datafile;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 1040873
2 1040873
3 1040873
4 1040873
5 1040873
6 1040873
7 1040873
8 1040873
8 rows selected.
SQL> select file#,checkpoint_change# from v$datafile_header;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 0
2 1040873
3 1040873
4 1040873
5 1040873
6 1040873
7 1040873
8 1040873
8 rows selected.
复制代码
4.找到上次备份信息,通过RMAN进行恢复
RMAN> restore datafile 1 from tag TAG20121126T133140;
复制代码
5.查看恢复后的数据文件信息,结果如下:
SQL> select file#,checkpoint_change# from v$datafile;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 1040873
2 1040873
3 1040873
4 1040873
5 1040873
6 1040873
7 1040873
8 1040873
8 rows selected.
SQL> recover database;
Media recovery complete.
SQL> select file#,checkpoint_change# from v$datafile_header;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 1039555
2 1040873
3 1040873
4 1040873
5 1040873
6 1040873
7 1040873
8 1040873
8 rows selected.
复制代码
6.我知道redo group 1中有t表刚插入的数据,所以我清空了group 1
SQL> alter database clear logfile group 1;
Database altered.
复制代码
7.恢复数据文件
SQL> recover datafile 1;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required
复制代码
8.查看数据文件信息
SQL> select file#,checkpoint_change# from v$datafile;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 1040873
2 1040873
3 1040873
4 1040873
5 1040873
6 1040873
7 1040873
8 1040873
8 rows selected.
SQL> recover datafile 1;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required
SQL> select file#,checkpoint_change# from v$datafile_header;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 1039556
2 1040873
3 1040873
4 1040873
5 1040873
6 1040873
7 1040873
8 1040873
8 rows selected.
复制代码
9.打开数据库
SQL> alter database open;
Database altered.
SQL> select file#,checkpoint_change# from v$datafile;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 1040875
2 1040875
3 1040875
4 1040875
5 1040875
6 1040875
7 1040875
8 1040875
8 rows selected.
SQL> select file#,checkpoint_change# from v$datafile_header;
FILE# CHECKPOINT_CHANGE#
---------- ------------------
1 1040875
2 1040875
3 1040875
4 1040875
5 1040875
6 1040875
7 1040875
8 1040875
8 rows selected.
复制代码
10.查看t表数据
SQL> select * from t;
ID NAME
---------- -------------------
1 a
2 ab
3 abc
4 abcd
复制代码
这个结果意料之中,没有什么问题,我疑问是:
1.清空redo log group的操作和丢失redo log gorup中所有的文件有什么区别吗?
2.这种情况属于不完全恢复吗
3.这种情况下也可以直接打开数据库吗?
|
|