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

What are the methods of Oracle backup and recovery

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

Share

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

What are the knowledge points of this article "what are the methods of Oracle backup and recovery?" most people do not understand, so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what are the methods of Oracle backup and recovery?"

1. Recovery methods for different scenarios when different conditions are met:

Second, the specific recovery ideas are given according to different recovery methods.

2.1. By re-copying redundant control files

1. Some of the control files were damaged online or after closing the database.

2. Shutdown abort shuts down the database

3. Copy one of the intact control files

4. Startup starts the database.

2.2. Full recovery by backing up control files

1. Damage all control files online or after shutting down the database

2. Shutdown abort shuts down the database

3. Startup nomount starts the database

4. Restore controlfile from 'xxx'; restores control files from backup

5 、 alter database mount

5. Recover database using backup controlfile until cancel. Select auto to apply all archived files automatically during execution.

6. Execute recover database using backup controlfile until cancel again and choose to apply the unarchived redo file

7 、 alter database open resetlogs

2.3. Incomplete recovery by backing up control files

1. Damage all control files online or after shutting down the database

2. Shutdown abort shuts down the database

3. Startup nomount starts the database

4. Restore controlfile from 'xxx'; restores control files from backup

5 、 alter database mount

6. Recover database using backup controlfile until cancel, select auto to automatically apply as many archived files as possible during execution

7 、 alter database open resetlogs

2.4.Restoration of reconstruction through backup control files (noresetlogs mode)

1. Damage all control files online or after shutting down the database

2. Shutdown abort shuts down the database

3. Startup nomount starts the database

4. Restore controlfile from 'xxx'; restores control files from backup

5 、 alter database mount

6. Alter database backup controlfile to trace, generate the script to create the control file

7. Shutdown immediate and start to startup nomount state

8. Use noresetlogs to create control files

9. Recover database restore database

10. Open the database through alter database open after recovery

2.5.Restoration of reconstruction through backup control files (resetlogs mode)

1. Damage all control files online or after shutting down the database

2. Shutdown abort shuts down the database

3. Startup nomount starts the database

4. Restore controlfile from 'xxx'; restores control files from backup

5 、 alter database mount

6. Alter database backup controlfile to trace, generate the script to create the control file

7. Shutdown immediate and start to startup nomount state

8. Use resetlogs to create control files

9. If an unarchived redo file is available, directly recover database, and then select the unarchived redo file to apply

Finally, the database is opened by alter database open resetlogs.

10. If the unarchived redo file is not available, you need to set the implicit parameter _ allow_resetlogs_corruption to true hop

After the consistency check, the database is opened by alter database open resetlogs.

Note: after opening the database, there are many problems that need to promote scn.

2.6.Restoration through manually reconstructed control files (noresetlogs mode)

1. Damage all control files online or after shutting down the database

2. Shutdown abort shuts down the database

3. Startup nomount starts the database

4. Construction control file

The following steps refer to step 8 of 2.4

2.7. restore through manually reconstructed control files (resetlogs mode)

1. Damage all control files online or after shutting down the database

2. Shutdown abort shuts down the database

3. Startup nomount starts the database

4. Construction control file

The following steps refer to step 8 of 2.5

Third, simulate the operation of several recovery methods:

The following mainly simulates the operation of these three recovery methods (full recovery of backup control files, recovery of reconstruction of backup control files (noresetlogs), recovery of reconstruction of backup control files (resetlogs)), because the other several recovery methods are either relatively simple or have something in common with these three methods.

3.1. Complete recovery by backing up control files

1. View basic database information and database status

SQL > show parameter db_name

NAME TYPE VALUE

-

Db_name string leonliao

SQL > show parameter control_files

NAME TYPE VALUE

-

Control_files string / home/oracle/oradata/leonliao/

Control01.ctl, / home/oracle/or

Adata/leonliao/control02.ctl

SQL > select open_mode from v$database

OPEN_MODE

-

READ WRITE

2. Backup control files

RMAN > backup current controlfile

3. Delete all control files when the database is online

[oracle@leon1 leonliao] $rm-rf control0*ctl

[oracle@leon1 leonliao] $pwd

/ home/oracle/oradata/leonliao

4. If you cannot shut down the database normally, you can only shutdown abort.

SQL > shutdown immediate

Database closed.

ORA-00210: cannot open the specified control file

ORA-00202: control file:'/ home/oracle/oradata/leonliao/control01.ctl'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

SQL > shutdown abort

ORACLE instance shut down.

SQL >

5. Start the database to nomount state and restore the backup control files

SQL > startup nomount

ORACLE instance started.

Total System Global Area 626327552 bytes

Fixed Size 2230952 bytes

Variable Size 184550744 bytes

Database Buffers 432013312 bytes

Redo Buffers 7532544 bytes

RMAN > restore controlfile from'/ u01qqql3 account 1qvmql3 account 1qvmql3

6. Start the database to mount state and start recovery

SQL > alter database mount

Database altered.

SQL >

SQL >

SQL > recover database using backup controlfile until cancel

ORA-00279: change 1181770 generated at 03/05/2016 05:02:58 needed for thread 1

ORA-00289: suggestion: / home/oracle/oradata/leonliao/arch/1_6_905662043.dbf

ORA-00280: change 1181770 for thread 1 is in sequence # 6

Specify log: {= suggested | filename | AUTO | CANCEL}

Auto alter database backup controlfile to trace

Database altered.

7. Shutdown immediate and start to startup nomount status to create control file

SQL > shutdown immediate

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL > startup nomount

ORACLE instance started.

Total System Global Area 626327552 bytes

Fixed Size 2230952 bytes

Variable Size 184550744 bytes

Database Buffers 432013312 bytes

Redo Buffers 7532544 bytes

SQL > CREATE CONTROLFILE REUSE DATABASE "LEONLIAO" NORESETLOGS ARCHIVELOG

2 MAXLOGFILES 16

3 MAXLOGMEMBERS 3

4 MAXDATAFILES 100

5 MAXINSTANCES 8

6 MAXLOGHISTORY 292

7 LOGFILE

8 GROUP 1'/ home/oracle/oradata/leonliao/redo01.log' SIZE 50m BLOCKSIZE 512

9 GROUP 2'/ home/oracle/oradata/leonliao/redo02.log' SIZE 50m BLOCKSIZE 512

10 GROUP 3'/ home/oracle/oradata/leonliao/redo03.log' SIZE 50m BLOCKSIZE 512

11-- STANDBY LOGFILE

12 DATAFILE

13'/ home/oracle/oradata/leonliao/system01.dbf'

14'/ home/oracle/oradata/leonliao/sysaux01.dbf'

15'/ home/oracle/oradata/leonliao/undotbs01.dbf'

16'/ home/oracle/oradata/leonliao/users01.dbf'

17 CHARACTER SET ZHS16GBK

18

Control file created.

8. Start recovery

SQL > recover database

ORA-00283: recovery session canceled due to errors

ORA-00264: no recovery required

9. Open the database in open mode

SQL > alter database open

Database altered.

SQL > select open_mode from v$database

OPEN_MODE

-

READ WRITE

3.3.Restoration of reconstruction through backup control files (resetlogs mode)

1. View basic database information and database status

SQL > show parameter db_name

NAME TYPE VALUE

-

Db_name string leonliao

SQL > show parameter control_files

NAME TYPE VALUE

-

Control_files string / home/oracle/oradata/leonliao/

Control01.ctl, / home/oracle/or

Adata/leonliao/control02.ctl

SQL > select * from v$logfile

GROUP# STATUS TYPE MEMBER IS_

1 ONLINE / home/oracle/oradata/leonliao/redo01.log NO

3 ONLINE / home/oracle/oradata/leonliao/redo03.log NO

2 ONLINE / home/oracle/oradata/leonliao/redo02.log NO

SQL > select open_mode from v$database

OPEN_MODE

-

READ WRITE

2. Backup control files

RMAN > backup current controlfile

3. Delete all control files and redo files when the database is online

[oracle@leon1 leonliao] $rm-rf control0*ctl

[oracle@leon1 leonliao] $rm-rf redo0*log

[oracle@leon1 leonliao] $pwd

/ home/oracle/oradata/leonliao

4. If you cannot shut down the database normally, you can only shutdown abort.

SQL > shutdown immediate

Database closed.

ORA-00210: cannot open the specified control file

ORA-00202: control file:'/ home/oracle/oradata/leonliao/control01.ctl'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

SQL > shutdown abort

ORACLE instance shut down.

SQL >

5. Start the database to nomount state and restore the backup control files

SQL > startup nomount

ORACLE instance started.

Total System Global Area 626327552 bytes

Fixed Size 2230952 bytes

Variable Size 184550744 bytes

Database Buffers 432013312 bytes

Redo Buffers 7532544 bytes

RMAN > restore controlfile from'/ u01qqvmtbjAction1qvmtbjAccording

6. Start the database to the mount state and generate a script to create the control file

SQL > alter database mount

Database altered.

SQL > alter database backup controlfile to trace

Database altered.

7. Shutdown immediate and start to startup nomount state to create the control file of resetlogs

SQL > shutdown immediate

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL > startup nomount

ORACLE instance started.

Total System Global Area 626327552 bytes

Fixed Size 2230952 bytes

Variable Size 184550744 bytes

Database Buffers 432013312 bytes

Redo Buffers 7532544 bytes

SQL > CREATE CONTROLFILE REUSE DATABASE "LEONLIAO" RESETLOGS ARCHIVELOG

2 MAXLOGFILES 16

3 MAXLOGMEMBERS 3

4 MAXDATAFILES 100

5 MAXINSTANCES 8

6 MAXLOGHISTORY 292

7 LOGFILE

8 GROUP 1'/ home/oracle/oradata/leonliao/redo01.log' SIZE 50m BLOCKSIZE 512

9 GROUP 2'/ home/oracle/oradata/leonliao/redo02.log' SIZE 50m BLOCKSIZE 512

10 GROUP 3'/ home/oracle/oradata/leonliao/redo03.log' SIZE 50m BLOCKSIZE 512

11-- STANDBY LOGFILE

12 DATAFILE

13'/ home/oracle/oradata/leonliao/system01.dbf'

14'/ home/oracle/oradata/leonliao/sysaux01.dbf'

15'/ home/oracle/oradata/leonliao/undotbs01.dbf'

16'/ home/oracle/oradata/leonliao/users01.dbf'

17 CHARACTER SET ZHS16GBK

18

Control file created.

8. Because all redo files have been deleted and cannot be recovered, there will be a consistency problem. Skip the consistency check by setting the implicit parameter _ allow_resetlogs_corruption for true

SQL > alter system set "_ allow_resetlogs_corruption" = true scope=spfile

System altered.

SQL > shutdown immediate

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL > startup mount

ORACLE instance started.

Total System Global Area 626327552 bytes

Fixed Size 2230952 bytes

Variable Size 184550744 bytes

Database Buffers 432013312 bytes

Redo Buffers 7532544 bytes

Database mounted.

9. Open the database in open resetlogs mode

SQL > alter database open resetlogs

Database altered.

SQL > select open_mode from v$database

OPEN_MODE

-

READ WRITE above is about the content of this article on "what are the methods of Oracle backup and recovery". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please 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