Oracle validates Rman backup via ODU for truncate object backup processing

Source: Internet
Author: User
Tags commit reserved

After the Rman backup and after the backup of the data files, learned that the process of Rman backup ODU, the majority of TRUNCATE TABLE raw data is not properly backed up (why the vast majority, I can not explain), here you can see the Rman Backup is not really completely physically replicated (and Rman copy is still different, copy cannot be completely superseded)


Creating a simulated environment

The code is as follows Copy Code

Sql> select * from V$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-prod
Pl/sql Release 10.2.0.4.0-production
CORE 10.2.0.4.0 Production
TNS for Linux:version 10.2.0.4.0-production
Nlsrtl Version 10.2.0.4.0-production

sql> Create tablespace Xifenfei datafile '/u01/oracle/oradata/xff/xifenfei01.dbf '
2 size 10m autoextend on maxsize 10g;

Tablespace created.

Sql> Conn Chf/xifenfei
Connected.

Sql> CREATE TABLE T_xifenfei tablespace Xifenfei
2 AS
3 SELECT * from Dba_objects;

Table created.

sql> INSERT INTO T_xifenfei
2 Select * from Dba_objects;

50055 rows created.

Sql> commit;

Commit complete.

Sql> Select BYTES from Dba_free_space where tablespace_name= ' Xifenfei ';

BYTES
----------
983040

Sql> Select BYTES from V$datafile where name= '/u01/oracle/oradata/xff/xifenfei01.dbf ';

BYTES
----------
12582912

Sql> select 12582912-983040 from dual;

12582912-983040
---------------
11599872

Sql> Select object_id,data_object_id from dba_objects where object_name= ' T_xifenfei ';

OBJECT_ID data_object_id
---------- --------------
51833 51833

--Here we get the information:
--1.dataobj#=51833
--2. Use the data file space as: 11599872

Rman Backup no TRUNCATE TABLE data file

The code is as follows Copy Code

[Oracle@xifenfei ~]$ Rman Target/

Recovery manager:release 10.2.0.4.0-production on Thu Dec 15 06:00:05 2011

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to target Database:xff (dbid=3440302261)

rman> backup tablespace xifenfei format '/u01/oracle/oradata/tmp/no_truncate_xifenfei ';

Starting backup at 15-dec-11
Using target database control file instead of recovery catalog
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=158 Devtype=disk
Channel ora_disk_1:starting full datafile backupset
Channel ora_disk_1:specifying DataFile (s) in Backupset
Input datafile fno=00005 name=/u01/oracle/oradata/xff/xifenfei01.dbf
Channel ora_disk_1:starting piece 1 at 15-dec-11
Channel ora_disk_1:finished piece 1 at 15-dec-11
Piece Handle=/u01/oracle/oradata/tmp/no_truncate_xifenfei tag=tag20111215t060343 comment=none
Channel Ora_disk_1:backup set complete, elapsed time:00:00:03
Finished backup at 15-dec-11

TRUNCATE TABLE operation

The code is as follows Copy Code

[Oracle@xifenfei ~]$ Sqlplus/as SYSDBA

Sql*plus:release 10.2.0.4.0-production on Thu Dec 15 06:03:58 2011

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-production
With the partitioning, OLAP, Data Mining and real application testing options

sql> truncate TABLE Chf.t_xifenfei;

Table truncated.

Rman Backup TRUNCATE TABLE data file

The code is as follows Copy Code


rman> backup tablespace xifenfei format '/u01/oracle/oradata/tmp/truncate_xifenfei ';

Starting backup at 15-dec-11
Using target database control file instead of recovery catalog
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=140 Devtype=disk
Channel ora_disk_1:starting full datafile backupset
Channel ora_disk_1:specifying DataFile (s) in Backupset
Input datafile fno=00005 name=/u01/oracle/oradata/xff/xifenfei01.dbf
Channel ora_disk_1:starting piece 1 at 15-dec-11
Channel ora_disk_1:finished piece 1 at 15-dec-11
Piece Handle=/u01/oracle/oradata/tmp/truncate_xifenfei tag=tag20111215t060445 comment=none
Channel Ora_disk_1:backup set complete, elapsed time:00:00:01
Finished backup at 15-dec-11

[Root@xifenfei ~]# ls-l/u01/oracle/oradata/tmp/*_xifenfei
-RW-R-----1 Oracle oinstall 11640832 DEC 06:03/u01/oracle/oradata/tmp/no_truncate_xifenfei
-RW-R-----1 Oracle oinstall 630784 DEC 06:04/u01/oracle/oradata/tmp/truncate_xifenfei

ODU digging Rman Pre-backup data files

The code is as follows Copy Code


odu> Unload Dict
CLUSTER c_user# file_no:1 block_no:89
TABLE obj$ file_no:1 block_no:121
CLUSTER c_obj# file_no:1 block_no:25
CLUSTER c_obj# file_no:1 block_no:25
Found ind$ ' s obj# 19
Found ind$ ' s dataobj#:2,ts#:0,file#:1,block#:25,tab#:3
Found tabpart$ ' s obj# 266
Found tabpart$ ' s dataobj#:266,ts#:0,file#:1,block#:2121,tab#:0
Found indpart$ ' s obj# 271
Found indpart$ ' s dataobj#:271,ts#:0,file#:1,block#:2161,tab#:0
Found tabsubpart$ ' s obj# 278
Found tabsubpart$ ' s dataobj#:278,ts#:0,file#:1,block#:2217,tab#:0
Found indsubpart$ ' s obj# 283
Found indsubpart$ ' s dataobj#:283,ts#:0,file#:1,block#:2257,tab#:0
Found ind$ ' s obj# 19
Found ind$ ' s dataobj#:2,ts#:0,file#:1,block#:25,tab#:3
Found lob$ ' s obj# 151
Found lob$ ' s dataobj#:2,ts#:0,file#:1,block#:25,tab#:6
Found lobfrag$ ' s obj# 299
Found lobfrag$ ' s dataobj#:299,ts#:0,file#:1,block#:2393,tab#:0

Odu> Scan Extent Tablespace 6

Scan extent Start:2011-12-15 06:12:28
Scanning extent ...
Scanning extent finished.
Scan extent Completed:2011-12-15 06:12:28

odu> Unload Table Chf.t_xifenfei object 51833

Unloading Table:t_xifenfei,object id:51833
Unloading segment,storage (obj#=51833 dataobj#=51833 ts#=6 file#=5)
100110 Rows unloaded
--Here you can see that odu all found the number of records that were truncate out.

Back up data files using Rman

The code is as follows Copy Code


sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Sql> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-production
With the partitioning, OLAP, Data Mining and real application testing options
[Oracle@xifenfei odu]$ rm/u01/oracle/oradata/xff/xifenfei01.dbf
[Oracle@xifenfei odu]$ Rman Target/

Recovery manager:release 10.2.0.4.0-production on Thu Dec 15 06:14:00 2011

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to target database (not started)

rman> startup Mount;

Oracle instance started
Database mounted

Total System Global area 318767104 bytes

Fixed Size 1267236 bytes
Variable Size 104860124 bytes
Database buffers 205520896 bytes
Redo buffers 7118848 bytes

rman> restore DataFile 5;

Starting restore at 15-dec-11
Using target database control file instead of recovery catalog
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=157 Devtype=disk

Channel ora_disk_1:starting datafile backupset restore
Channel ora_disk_1:specifying DataFile (s) to restore from backup set
restoring DataFile 00005 to/u01/oracle/oradata/xff/xifenfei01.dbf
Channel ora_disk_1:reading from backup Piece/u01/oracle/oradata/tmp/truncate_xifenfei
Channel ora_disk_1:restored backup Piece 1
Piece Handle=/u01/oracle/oradata/tmp/truncate_xifenfei tag=tag20111215t060445
Channel Ora_disk_1:restore complete, elapsed time:00:00:01
Finished restore at 15-dec-11

ODU digging Rman restored data file

The code is as follows Copy Code

Odu> Scan Extent Tablespace 6

Scan extent Start:2011-12-15 06:14:43
Scanning extent ...
Scanning extent finished.
Scan extent Completed:2011-12-15 06:14:43

odu> Unload Table Chf.t_xifenfei object 51833

Unloading Table:t_xifenfei,object id:51833
Unloading segment,storage (obj#=51833 dataobj#=51833 ts#=6 file#=5)
4774 Rows unloaded
--odu only found a very small number of data 4774/100110

How the extent of Rman backup handles related operations such as truncate and drop, as demonstrated by the Rman backup combination odu, in the newer version of Rman, Rman backup Does not fully back up these extent that are considered unwanted.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.