Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use incremental backup to restore database in noarchive non-archive mode

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "noarchive non-archived mode how to use incremental backup to restore database", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "noarchive non-archived mode how to use incremental backup to restore database" this article.

The experiment begins:

1) undo the database archivelog schema

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 1

Next log sequence to archive 1

Current log sequence 1

SQL >

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL >

SQL > startup mount

ORACLE instance started.

Total System Global Area 835104768 bytes

Fixed Size 2257840 bytes

Variable Size 549456976 bytes

Database Buffers 281018368 bytes

Redo Buffers 2371584 bytes

Database mounted.

SQL >

SQL > alter database noarchivelog

Database altered.

SQL > alter database open

Database altered.

SQL >

SQL >

SQL > archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 1

Current log sequence 1

SQL >

2) create test tables and data

SQL > create table t (x int) tablespace users

Table created.

SQL > insert into t values (1)

1 row created.

SQL > commit

Commit complete.

3) in noarchivelog mode, level 0 backup (backup under mount)

[oracle@wang ~] $rman target /

Recovery Manager: Release 11.2.0.4.0-Production on Fri Dec 8 20:50:52 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to target database: DBDB (DBID=3282897732)

RMAN > run {

Shutdown immediate

Startup mount

Backup as backupset incremental level 0 database

Alter database open

}

Using target database control file instead of recovery catalog

Database closed

Database dismounted

Oracle instance shut down

Connected to target database (not started)

Oracle instance started

Database mounted

Total System Global Area 835104768 bytes

Fixed Size 2257840 bytes

Variable Size 549456976 bytes

Database Buffers 281018368 bytes

Redo Buffers 2371584 bytes

Starting backup at 08-DEC-17

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=18 device type=DISK

Channel ORA_DISK_1: starting incremental level 0 datafile backup set

Channel ORA_DISK_1: specifying datafile (s) in backup set

Input datafile file number=00004 name=/u01/app/oracle/oradata/DBdb/users01.dbf

Input datafile file number=00006 name=/u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf

Input datafile file number=00001 name=/u01/app/oracle/oradata/DBdb/system01.dbf

Input datafile file number=00003 name=/u01/app/oracle/oradata/DBdb/undotbs01.dbf

Channel ORA_DISK_1: starting piece 1 at 08-DEC-17

Channel ORA_DISK_1: finished piece 1 at 08-DEC-17

Piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnnd0_TAG20171208T205150_f2o2q6sv_.bkp tag=TAG20171208T205150 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55

Channel ORA_DISK_1: starting incremental level 0 datafile backup set

Channel ORA_DISK_1: specifying datafile (s) in backup set

Input datafile file number=00002 name=/u01/app/oracle/oradata/DBdb/sysaux01.dbf

Input datafile file number=00005 name=/u01/app/oracle/oradata/DBdb/example01.dbf

Channel ORA_DISK_1: starting piece 1 at 08-DEC-17

Channel ORA_DISK_1: finished piece 1 at 08-DEC-17

Piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnnd0_TAG20171208T205150_f2o2rxwz_.bkp tag=TAG20171208T205150 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

Channel ORA_DISK_1: starting incremental level 0 datafile backup set

Channel ORA_DISK_1: specifying datafile (s) in backup set

Including current control file in backup set

Including current SPFILE in backup set

Channel ORA_DISK_1: starting piece 1 at 08-DEC-17

Channel ORA_DISK_1: finished piece 1 at 08-DEC-17

Piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_ncsn0_TAG20171208T205150_f2o2sr2v_.bkp tag=TAG20171208T205150 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 08-DEC-17

Database opened

RMAN >

4) in noarchivelog mode, level 1 backup (backup under mount)

-- operate first:

SQL > select * from t

X

-

one

SQL > insert into t values (2)

1 row created.

SQL > commit

Commit complete.

SQL > select * from t

X

-

two

one

-- start backup:

RMAN > run {

Shutdown immediate

Startup mount

Backup as backupset incremental level 1 database

Alter database open

}

Database closed

Database dismounted

Oracle instance shut down

Connected to target database (not started)

Oracle instance started

Database mounted

Total System Global Area 835104768 bytes

Fixed Size 2257840 bytes

Variable Size 549456976 bytes

Database Buffers 281018368 bytes

Redo Buffers 2371584 bytes

Starting backup at 09-DEC-17

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=18 device type=DISK

Channel ORA_DISK_1: starting incremental level 1 datafile backup set

Channel ORA_DISK_1: specifying datafile (s) in backup set

Input datafile file number=00004 name=/u01/app/oracle/oradata/DBdb/users01.dbf

Input datafile file number=00006 name=/u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf

Input datafile file number=00001 name=/u01/app/oracle/oradata/DBdb/system01.dbf

Input datafile file number=00003 name=/u01/app/oracle/oradata/DBdb/undotbs01.dbf

Channel ORA_DISK_1: starting piece 1 at 09-DEC-17

Channel ORA_DISK_1: finished piece 1 at 09-DEC-17

Piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_nnnd1_TAG20171209T005144_f2ojs0o5_.bkp tag=TAG20171209T005144 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03

Channel ORA_DISK_1: starting incremental level 1 datafile backup set

Channel ORA_DISK_1: specifying datafile (s) in backup set

Input datafile file number=00002 name=/u01/app/oracle/oradata/DBdb/sysaux01.dbf

Input datafile file number=00005 name=/u01/app/oracle/oradata/DBdb/example01.dbf

Channel ORA_DISK_1: starting piece 1 at 09-DEC-17

Channel ORA_DISK_1: finished piece 1 at 09-DEC-17

Piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_nnnd1_TAG20171209T005144_f2ojs3p5_.bkp tag=TAG20171209T005144 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Channel ORA_DISK_1: starting incremental level 1 datafile backup set

Channel ORA_DISK_1: specifying datafile (s) in backup set

Including current control file in backup set

Including current SPFILE in backup set

Channel ORA_DISK_1: starting piece 1 at 09-DEC-17

Channel ORA_DISK_1: finished piece 1 at 09-DEC-17

Piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_ncsn1_TAG20171209T005144_f2ojs5v4_.bkp tag=TAG20171209T005144 comment=NONE

Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 09-DEC-17

Database opened

RMAN >

6) simulate the failure and delete all control files, log files, data files and parameter files

SQL > conn / as sysdba

Connected.

SQL > select name from v$datafile

NAME

/ u01/app/oracle/oradata/DBdb/system01.dbf

/ u01/app/oracle/oradata/DBdb/sysaux01.dbf

/ u01/app/oracle/oradata/DBdb/undotbs01.dbf

/ u01/app/oracle/oradata/DBdb/users01.dbf

/ u01/app/oracle/oradata/DBdb/example01.dbf

/ u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf

6 rows selected.

SQL > show parameter spfile

NAME TYPE VALUE

-

Spfile string / u01/app/oracle/product/11.2.0/db_1/dbs/spfileDBdb.ora

-- delete:

[oracle@wang ~] $cd / u01/app/oracle/oradata/DBdb/

[oracle@wang DBdb] $ls-lrt

Total 9887200

-rw-r- 1 oracle oinstall 52429312 Dec 9 00:51 redo02.log

-rw-r- 1 oracle oinstall 52429312 Dec 9 00:51 redo03.log

-rw-r- 1 oracle oinstall 3207340032 Dec 9 00:51 users01.dbf

-rw-r- 1 oracle oinstall 355213312 Dec 9 00:51 example01.dbf

-rw-r- 1 oracle oinstall 20979712 Dec 9 00:51 temp01.dbf

-rw-r- 1 oracle oinstall 2710577152 Dec 9 01:51 undotbs01.dbf

-rw-r- 1 oracle oinstall 744497152 Dec 9 01:54 sysaux01.dbf

-rw-r- 1 oracle oinstall 2936020992 Dec 9 01:54 system01.dbf

-rw-r- 1 oracle oinstall 52429312 Dec 9 01:58 redo01.log

-rw-r- 1 oracle oinstall 10272768 Dec 9 01:58 control01.ctl

[oracle@wang DBdb] $rm-rf *

[oracle@wang DBdb] $

[oracle@wang DBdb] $cd / u01/app/oracle/fast_recovery_area/DBDB/newback/

[oracle@wang newback] $ls

DBDB lost+found oradataback ts_xxf_01.dbf

[oracle@wang newback] $rm-rf ts_xxf_01.dbf

[oracle@wang newback] $

[oracle@wang newback] $cd / u01/app/oracle/product/11.2.0/db_1/dbs/

[oracle@wang dbs] $ls

Hc_DBdb.dat init.ora initDBdb.ora lkDBDB orapwDBdb snapcf_DBdb.f spfileDBdb.ora

[oracle@wang dbs] $mv spfileDBdb.ora spfileDBdb.ora.bak_2017

[oracle@wang dbs] $ls

Hc_DBdb.dat init.ora initDBdb.ora lkDBDB orapwDBdb snapcf_DBdb.f spfileDBdb.ora.bak_2017

[oracle@wang dbs] $

7) perform recovery

-- forced shutdown (error message is reported in the log)

SQL > shutdown abort

ORACLE instance shut down.

SQL >

-- start rman:

[oracle@wang ~] $rman target /

Recovery Manager: Release 11.2.0.4.0-Production on Sat Dec 9 02:04:33 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to target database (not started)

-- Force boot to nomount mode

RMAN > startup nomount

Oracle instance started

Total System Global Area 835104768 bytes

Fixed Size 2257840 bytes

Variable Size 587205712 bytes

Database Buffers 243269632 bytes

Redo Buffers 2371584 bytes

-- restore parameter files, preferably using the backup media of the last incremental backup:

RMAN > restore spfile from "/ u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_ncsn1_TAG20171209T005144_f2ojs5v4_.bkp"

Starting restore at 09-DEC-17

Using channel ORA_DISK_1

Channel ORA_DISK_1: restoring spfile from AUTOBACKUP / u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_ncsn1_TAG20171209T005144_f2ojs5v4_.bkp

Channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete

Finished restore at 09-DEC-17

RMAN >

-- complete the recovery of the parameter file and start it to nomount mode using the restored parameter file (you can also use the rman tool)

SQL > shutdown abort

ORACLE instance shut down.

SQL >

SQL > startup nomount

ORACLE instance started.

Total System Global Area 835104768 bytes

Fixed Size 2257840 bytes

Variable Size 549456976 bytes

Database Buffers 281018368 bytes

Redo Buffers 2371584 bytes

SQL >

SQL >

-- restore control files. Note: when restoring control files here, be sure to use the backup media of the last incremental backup, otherwise there will be problems with the recovery due to version problems:

RMAN > restore controlfile from "/ u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_ncsn1_TAG20171209T005144_f2ojs5v4_.bkp"

Starting restore at 09-DEC-17

Using target database control file instead of recovery catalog

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=20 device type=DISK

Channel ORA_DISK_1: restoring control file

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Output file name=/u01/app/oracle/oradata/DBdb/control01.ctl

Output file name=/u01/app/oracle/fast_recovery_area/DBdb/control02.ctl

Finished restore at 09-DEC-17

-- Control file recovery is complete, and the database is started to mount mode

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

RMAN >

-- perform the restore of the whole library

RMAN > restore database

Starting restore at 09-DEC-17

Starting implicit crosscheck backup at 09-DEC-17

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=20 device type=DISK

Crosschecked 12 objects

Finished implicit crosscheck backup at 09-DEC-17

Starting implicit crosscheck copy at 09-DEC-17

Using channel ORA_DISK_1

Crosschecked 1 objects

Finished implicit crosscheck copy at 09-DEC-17

Searching for all files in the recovery area

Cataloging files...

Cataloging done

List of Cataloged Files

=

File Name: / u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_ncsn1_TAG20171209T005144_f2ojs5v4_.bkp

Using channel ORA_DISK_1

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 00001 to / u01/app/oracle/oradata/DBdb/system01.dbf

Channel ORA_DISK_1: restoring datafile 00003 to / u01/app/oracle/oradata/DBdb/undotbs01.dbf

Channel ORA_DISK_1: restoring datafile 00004 to / u01/app/oracle/oradata/DBdb/users01.dbf

Channel ORA_DISK_1: restoring datafile 00006 to / u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf

Channel ORA_DISK_1: reading from backup piece / u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnnd0_TAG20171208T205150_f2o2q6sv_.bkp

Channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnnd0_TAG20171208T205150_f2o2q6sv_.bkp tag=TAG20171208T205150

Channel ORA_DISK_1: restored backup piece 1

Channel ORA_DISK_1: restore complete, elapsed time: 00:02:15

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 00002 to / u01/app/oracle/oradata/DBdb/sysaux01.dbf

Channel ORA_DISK_1: restoring datafile 00005 to / u01/app/oracle/oradata/DBdb/example01.dbf

Channel ORA_DISK_1: reading from backup piece / u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnnd0_TAG20171208T205150_f2o2rxwz_.bkp

Channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnnd0_TAG20171208T205150_f2o2rxwz_.bkp tag=TAG20171208T205150

Channel ORA_DISK_1: restored backup piece 1

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

Finished restore at 09-DEC-17

RMAN >

-- noredo clause is used for recovery because it is not archived and the online redo log is lost

RMAN > recover database

Starting recover at 09-DEC-17

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting incremental datafile backup set restore

Channel ORA_DISK_1: specifying datafile (s) to restore from backup set

Destination for restore of datafile 00001: / u01/app/oracle/oradata/DBdb/system01.dbf

Destination for restore of datafile 00003: / u01/app/oracle/oradata/DBdb/undotbs01.dbf

Destination for restore of datafile 00004: / u01/app/oracle/oradata/DBdb/users01.dbf

Destination for restore of datafile 00006: / u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf

Channel ORA_DISK_1: reading from backup piece / u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_nnnd1_TAG20171209T005144_f2ojs0o5_.bkp

Channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_nnnd1_TAG20171209T005144_f2ojs0o5_.bkp tag=TAG20171209T005144

Channel ORA_DISK_1: restored backup piece 1

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Channel ORA_DISK_1: starting incremental datafile backup set restore

Channel ORA_DISK_1: specifying datafile (s) to restore from backup set

Destination for restore of datafile 00002: / u01/app/oracle/oradata/DBdb/sysaux01.dbf

Destination for restore of datafile 00005: / u01/app/oracle/oradata/DBdb/example01.dbf

Channel ORA_DISK_1: reading from backup piece / u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_nnnd1_TAG20171209T005144_f2ojs3p5_.bkp

Channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_09/o1_mf_nnnd1_TAG20171209T005144_f2ojs3p5_.bkp tag=TAG20171209T005144

Channel ORA_DISK_1: restored backup piece 1

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Starting media recovery

RMAN-08187: WARNING: media recovery until SCN 3974526 complete

Finished recover at 09-DEC-17

RMAN >

RMAN > recover database noredo

Starting recover at 09-DEC-17

Using channel ORA_DISK_1

Finished recover at 09-DEC-17

RMAN >

-- restore is complete, open the database in resetlogs mode, and complete the recovery of all missing files

RMAN > alter database open resetlogs

Database opened

RMAN >

8) verify the data inserted before testing (before incremental backup)

SQL > select status from v$instance

STATUS

-

OPEN

SQL > select * from t

X

-

two

one

SQL >

These are all the contents of the article "how to use incremental backup to restore a database in noarchive non-archive mode". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report