Complete Oracle Database Backup

Source: Internet
Author: User

Modify the validity period of the backup file (the database must be started with spfile)

SQL> alter system set control_file_record_keep_time = 30 scope = both;

System altered.

Start Archiving first

SQL> startup mount

Oracle instance started.

Total System Global Area 314572800 bytes

Fixed Size 1219136 bytes

Variable Size 96470464 bytes

Database Buffers 209715200 bytes

Redo Buffers 7168000 bytes

Database mounted.

SQL> alter database archivelog;

 

Database altered.

 

[Root @ bw ~] # Su-oracle

[Oracle @ bw ~] $ Rman target/

 

Recovery Manager: Release 10.2.0.1.0-Production on Sun Apr 24 10:14:45 2011

 

Copyright (c) 1982,200 5, Oracle. All rights reserved.

 

Connected to target database: BW (DBID = 3011863310)

 

RMAN> show all;

 

Using target database control file instead of recovery catalog

RMAN configuration parameters are:

Configure retention policy to redundancy 1; # default

Configure backup optimization off; # default

Configure default device type to disk; # default

Configure controlfile autobackup off; # default

Configure controlfile autobackup format for device type disk to '% F'; # default

Configure device type disk parallelism 1 backup type to backupset; # default

Configure datafile backup copies for device type disk to 1; # default

Configure archivelog backup copies for device type disk to 1; # default

Configure maxsetsize to unlimited; # default

Configure encryption for database off; # default

Configure encryption algorithm 'aes128 '; # default

Configure archivelog deletion policy to none; # default

Configure snapshot controlfile name to '/u01/app/oracle/product/10.2/db_1/dbs/snapcf_b0000f'; # default

 

RMAN> configure controlfile autobackup on;

 

New RMAN configuration parameters:

Configure controlfile autobackup on;

New RMAN configuration parameters are successfully stored

[Oracle @ bw u01] $ rman target/

RMAN> run {

2> allocate channel d1 type disk;

3> allocate channel d2 type disk;

4> backup full database format'/u01/bak/bw20151130_% u. bak 'tag = bwfull01;

5> release channel d1;

6> release channel d2;

7>}

Enter

 

Start restoring database files

Delete the dbf file under/u01/oradata/bw (the control file is not deleted)

[Oracle @ bw] $ rm-rf * dbf

 

Restore

[Oracle @ bw u01] $ rman target/

RMAN> startup nomount;

RMAN> alter database mount;

RMAN> restore database;

RMAN> recover database;

 

Starting recover at 23-APR-11

Using channel ORA_DISK_1

 

Starting media recovery

Media recovery complete, elapsed time: 00:00:01

 

Finished recover at 23-APR-11 (indicating restoration successful)

If both the control file and data file are deleted

[Oracle @ bw ~] $ Cd/u01/oradata/bw/

[Oracle @ bw] $ ll

Total 1005496

-Rw-r ----- 1 oracle oinstall 104865792 Apr 26 bw01.dbf

-Rw-r ----- 1 oracle oinstall 115351552 Apr 26 bwtbs01.dbf

-Rw-r ----- 1 oracle oinstall 17547264 Apr 26 control01.ctl (delete the red part)

-Rw-r ----- 1 oracle oinstall 17547264 Apr 26 control02.ctl

-Rw-r ----- 1 oracle oinstall 17547264 Apr 26 control03.ctl

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo1_1.dbf

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo2_1.dbf

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo3_1.dbf

-Rw-r ----- 1 oracle oinstall 314580992 Apr 26 sysaux01.dbf

-Rw-r ----- 1 oracle oinstall 314580992 Apr 26 system01.dbf

-Rw-r ----- 1 oracle oinstall 209723392 Apr 26 temp01.dbf

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo1_1.rdo

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo2_1.rdo

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo3_1.rdo

[Oracle @ bw ~] $ Rm-rf * dbf

[Oracle @ bw ~] $ Rm-rf * ctl

[Oracle @ bw ~] $ Ll

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo1_1.rdo

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo2_1.rdo

-Rw-r ----- 1 oracle oinstall 20972032 Apr 26 redo3_1.rdo

 

[Oracle @ bw ~] $ Rman target/

 

Recovery Manager: Release 10.2.0.1.0-Production on Tue Apr 26 19:46:45 2011

 

Copyright (c) 1982,200 5, Oracle. All rights reserved.

 

Connected to target database: bw (not mounted)

 

RMAN> startup nomount;

 

Database is already started

[Oracle @ bw ~] $ Cd $ ORACLE_HOME/dbs

[Oracle @ bw dbs] $ ll

Total 34452

-Rw-r ----- 1 oracle oinstall 17629184 Apr 26 c-3011863310-20110426-00

-Rw-r -- 1 oracle oinstall 849 Apr 22 db. SQL

-Rw ---- 1 oracle oinstall 1544 Apr 22 hc_b1_dat

-Rw-r -- 1 oracle oinstall 960 Apr 22 initbw. ora

-Rw-r ----- 1 oracle oinstall 12920 May 3 2001 initdw. ora

-Rw-r ----- 1 oracle oinstall 8385 Sep 11 1998 init. ora

-Rw ---- 1 oracle oinstall 24 Apr 22 13:38 lkBW

-Rw-r ----- 1 oracle oinstall 1536 Apr 22 orapwbw

-Rw-r ----- 1 oracle oinstall 17547264 Apr 26 snapcf_b0000f

-Rw-r ----- 1 oracle oinstall 2560 Apr 26 spfilebw. ora

 

RMAN> set dbid = 3011863310;

 

Executing command: SET DBID

·

RMAN> restore controlfile from autobackup;

 

Starting restore at 26-APR-11

Using target database control file instead of recovery catalog

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid = 47 devtype = DISK

 

Channel ORA_DISK_1: looking for autobackup on day: 20110426

Channel ORA_DISK_1: autobackup found: c-3011863310-20110426-00

Channel ORA_DISK_1: control file restore from autobackup complete

Output filename =/u01/oradata/bw/control01.ctl

Output filename =/u01/oradata/bw/control02.ctl

Output filename =/u01/oradata/bw/control03.ctl

Finished restore at 26-APR-11

(Control file recovered successfully)

Start data file recovery

[Oracle @ bw u01] $ rman target/

RMAN> startup nomount;

RMAN> alter database mount;

RMAN> restore database;

RMAN> recover database;

Starting recover at 23-APR-11

Using channel ORA_DISK_1

 

Starting media recovery

Media recovery complete, elapsed time: 00:00:01

 

Finished recover at 23-APR-11 (indicating restoration successful)

[Oracle @ bw ~] $ Sqlplus/as sysdba

 

SQL * Plus: Release 10.2.0.1.0-Production on Tue Apr 26 20:12:42 2011

 

Copyright (c) 1982,200 5, Oracle. All rights reserved.

 

Connected to an idle instance.

 

SQL> startup

ORACLE instance started.

 

Total System Global Area 314572800 bytes

Fixed Size 1219136 bytes

Variable Size 96470464 bytes

Database Buffers 209715200 bytes

Redo Buffers 7168000 bytes

Database mounted.

The ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

 

SQL> alter database open resetlogs;

 

Database altered.

 

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

 

Total System Global Area 314572800 bytes

Fixed Size 1219136 bytes

Variable Size 96470464 bytes

Database Buffers 209715200 bytes

Redo Buffers 7168000 bytes

Database mounted.

Database opened.

SQL>

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.