Oracle unrecoverable nologging database objects
Unrecoverable NOLOGGING database objects
1) Back up users tablespaces
[Oracle @ ocmu ~] $ Rman target/
Recovery Manager: Release 11.2.0.1.0-Production on Sat Mar 16 10:41:05 2013
Copyright (c) 1982,200 9, Oracle and/or its affiliates. All rights reserved.
Connected to target database: ORA11GR2 (DBID = 116453860)
RMAN> backup as backupset tablespace users;
Starting backup at 16-MAR-13
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 41 device type = DISK
Channel ORA_DISK_1: starting full datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number = 00004 name =/u01/app/oracle/oradata/ORA11GR2/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 16-MAR-13
Channel ORA_DISK_1: finished piece 1 at 16-MAR-13
Piece handle =/u01/app/FRA/ORA11GR2/backupset/2013_03_16/empty _. bkp tag = tag201301_t1_134 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 16-MAR-13
Starting Control File and SPFILE Autobackup at 16-MAR-13
Piece handle =/u01/app/FRA/ORA11GR2/autobackup/2013_03_16/o1_mf_s_810211299_8n7pz48 H _. bkp comment = NONE
Finished Control File and SPFILE Autobackup at 16-MAR-13
RMAN>
2) use the nologging attribute to create a table and insert data using direct path loading.
SCOTT @ ORA11GR2> create table t_objects nologging tablespace users as select * from all_objects where 1 = 2;
Table created.
SCOTT @ ORA11GR2> insert/* + append */into t_objects select * from all_objects;
55641 rows created.
SCOTT @ ORA11GR2> commit;
Commit complete.
SCOTT @ ORA11GR2>
3) RMAN lists data files containing irrecoverable data
RMAN> report unrecoverable database;
Report of files that need backup due to unrecoverable operations
File Type of Backup Required Name
-----------------------------------------------------------------------
4 full or incremental/u01/app/oracle/oradata/ORA11GR2/users01.dbf
RMAN>
4) Delete the users tablespace and test the non-Recoverability of nologging.
SYS @ ORA11GR2> select file_name from dba_data_files where tablespace_name = 'users ';
FILE_NAME
--------------------------------------------------------------------------
/U01/app/oracle/oradata/ORA11GR2/users01.dbf
SYS @ ORA11GR2>! Ls/u01/app/oracle/oradata/ORA11GR2/users01.dbf
/U01/app/oracle/oradata/ORA11GR2/users01.dbf
SYS @ ORA11GR2>! Rm/u01/app/oracle/oradata/ORA11GR2/users01.dbf
SYS @ ORA11GR2>! Ls/u01/app/oracle/oradata/ORA11GR2/users01.dbf
Ls:/u01/app/oracle/oradata/ORA11GR2/users01.dbf: No such file or directory
SYS @ ORA11GR2>
5) RMAN restores the users tablespace.
RMAN> shutdown immediate;
Database closed
Database dismounted
Oracle instance shut down
RMAN> startup mount;
Connected to target database (not started)
Oracle instance started
Database mounted
Total System Global Area 841162752 bytes
Fixed Size 1339768 bytes
Variable Size 578817672 bytes
Database Buffers 255852544 bytes
Redo Buffers 5152768 bytes
RMAN> restore tablespace users;
Starting restore at 16-MAR-13
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 18 device type = DISK
Channel ORA_DISK_1: starting datafile backup set restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_DISK_1: restoring datafile 00004 to/u01/app/oracle/oradata/ORA11GR2/users01.dbf
Channel ORA_DISK_1: reading from backup piece/u01/app/FRA/ORA11GR2/backupset/2013_03_16/o1_mf_nnndf_tag201301_t1_134_8n7pyymv _. bkp
Channel ORA_DISK_1: piece handle =/u01/app/FRA/ORA11GR2/backupset/2013_03_16/empty _. bkp tag = tag201301_t1_134
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
Finished restore at 16-MAR-13
RMAN> recover tablespace users;
Starting recover at 16-MAR-13
Using channel ORA_DISK_1
Starting media recovery
Media recovery complete, elapsed time: 00:00:01
Finished recover at 16-MAR-13
RMAN> alter database open;
Database opened
RMAN>
6) Verify the non-Recoverability of NOLOGGING
SCOTT @ ORA11GR2> select count (*) from t_objects;
Select count (*) from t_objects
*
ERROR at line 1:
ORA-01578: ORACLE data block upted (file #4, block #675)
ORA-01110: data file 4: '/u01/app/oracle/oradata/ORA11GR2/users01.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option
SCOTT @ ORA11GR2>
7) Summary
NOLONGGING can make you "quick at the moment", but it is highly risky. Therefore, you need to back up the table as soon as possible or recreate the table in idle time.