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

Detailed explanation of RMAN command

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

Share

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

This article mainly explains the "detailed explanation of RMAN command". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "detailed explanation of RMAN command".

1 list the counterpart

RMAN > list incarnation

2 list backup

2.1 Overview of available backups RMAN > list backup summary

B stands for backup

F stands for FULL

A stands for archive log

0 1 means incremental backup

S indicates backup status (An AVAILABLE X EXPIRED)

2.2 list backups by backup type RMAN > list backup by file

List according to data file backup, archive log backup, control file backup, server parameter file backup

2.3 list detailed backups RMAN > list backup

2.4 list expired backups RMAN > list expired backup

2.5 list tablespaces and data file backups

List backup of tablespace and list backup of datafile output is similar to list backup

Such as: list backup of tablespace user_tbs

List backup of datafile 3

2.6. list archive log backups RMAN > list archivelog all; brief information

RMAN > list backup of archivelog all; details

2.7 list control files and server parameter files

RMAN > list backup of controlfile

RMAN > list backup of spfile

=

=

Report command for RMAN

1. Report data files that have not been backed up recently

RMAN > report need backup days=3

two。 Report backup redundancy or restore window

RMAN > report need backup redundancy=2

RMAN > report need backup recovery window of 2 days

3. Report the unrecoverable operation of the data file

RMAN > report unrecoverable

4. Report database schema

RMAN > report schema

5. Report discarded backups

If a save policy is used, the backup is marked as discarded status RMAN > report obsolete; Delete discard status backup RMAN > delete obsolete

=

=

Crosscheck command for RMAN

1 the backup set has two states A (Available,RMAN believes that this item exists on the backup media) X (Expired, backup exists in the control file or recovery directory, but does not physically exist on the backup media)

The purpose of 2 crosscheck is to check the directory of the RMAN and the physical file, and if the physical file does not exist on the media, it will be marked as Expired. If the physical file exists, the Available is maintained. If the backup set that was previously marked as Expired exists again on the backup media (for example, after recovering a damaged disk drive), crosscheck marks the status back from Expired to Available.

3 crosscheck output is divided into two parts. The first part lists all backup set slices that are determined to exist on the backup media, and the second part lists backup set slices that do not exist on the backup media and marks them as Expired. When the backup preservation policy is set, a backup expires, and the status of the backup marked as discarded after crosscheck is still availabel. Delete the discarded backup delete obsolete.

4 example:

Crosscheck backup

Crosscheck backup of datafile 1

Crosscheck backup of tablespace users

Crosscheck backup of controfile

Crosscheck backup of controlfile

Crosscheck backup tag='SAT_BACKUP'

Crosscheck backup completed after 'sysdate-2'

Crosscheck backup completed between 'sysdate-5' and' sysdate-2'

Crosscheck backup device type sbt

Crosscheck archivelog all

Crosscheck archivelog like'% ARC00012.001'

Crosscheck archivelog from sequence 12

Crosscheck archivelog until sequence 522

=

=

Validate command for RMAN

The 1 validate command verifies that the backup set can be restored

2 list backup summary; got the backup set primary key ID such as 40, and then validate backupset 40

=

=

Backup and save strategy of RMAN and change, delete commands

0. The change command with the delete parameter deletes the backup set, from the backup media, and from the control file and recovery directory.

Change backupset 117118 delete

Change backuppiece 1304 delete

Change archivelog until logseq = 544 delete

1. Two types of strategies: recovery window backup save policy (recovery windows backup retension policy) based on time

Backup redundant backup save strategy (backup redundancy backup retension policy) based on the number of backups

The two types of strategies are mutually exclusive

two。 Even if the backup preservation policy is used, the backup is not deleted when it expires, but is marked as discarded in the RMAN directory, and the status is still available.

To view a backup report obsolete that is marked as discarded, it is only physically deleted by using delete obsolete.

3.configure retension policy to recovery window of 7 days

Configure retension policy to redundancy 3

Display the result show all

4. When viewing backups that are due to be discarded, you may need to save some backups manually. You can use the change command with the keep parameter. After using this command, those backups that have been modified will be considered as a long-term backup, which is no longer affected by the preservation policy, that is, delete obsolete will not be deleted.

5. To make backups unaffected by the save policy, use the backup command with the keep parameter

Backup database keep forever

Backup database keep 5 days

6.change command function

You can modify the backup to be permanently saved and save the logs related to the backup to ensure that the backup can always be restored to the current point in time

Change backupset 31 keep forever logs

You can set a new date for the backup to be discarded. The backup will be saved for 7 more days and will be deleted after 7 days.

Change backupset 32 keep until time 'sysdata + 7' logs

7.change can set the backup set to unavailable

Change backupset 33 unavailable

Backup sets marked as unavailable status do not participate in crosscheck

=

=

Record deletion of the recovery directory

1. $ORACLE_HOME/rdbms/admin/prgrmanc.sql script periodically deletes records with DELETED status in the recovery directory

two。 To delete the old counterpart record incarnation. You must remove these equivalents from the DBINC table and use the RC_DATABASE_INCARNATION view to determine which equivalents to delete. Record the DBINC_KEY of each counterpart to be deleted

Then start SQL*Plus and execute delete from dbinc where dbinc_key=2

=

=

Manually synchronize the recovery directory

Resync catalog

When Oracle synchronizes the recovery directory, first create a snapshot control file, and then compare this file with the recovery directory. After completion, Oracle updates the recovery directory to synchronize the recovery directory with the control file

=

=

Store scripts in RMAN

1, connect to the target database and restore directory

Rman target / catalog rman/rman@rman9i

2, create a script

RMAN > create script my_bk_script

2 > {backup database plus archivelog;}

Create script my_bk_script

3, print script

RMAN > print script my_bk_script

Printing stored scipt:my_bk_script

{backup database plus archivelog;}

4. Run this script to back up the target database

RMAN > run {execute scipt my_bk_script;}

5 delete script

RMAN > delete script my_bk_script

=

=

Full recovery in archivelog mode

Step1:set oracle_sid=recover

Rman target rman_backup/password

Configure controlfile autobackup on

Step2:backup database plus archivelog delete input

Step3:shutdown immediate

Step4: rename all data files and control files without renaming the online redo log.

Step5: startup nomount

Set DBID=****

Restore controlfile from autobackup

Alter database mount

Step6: restore database

Recover database

Alter database open resetlogs

Tablespace recovery

Sql "alter tablespace users offline"

Sql "alter tablespace tools offline"

Restore tablespace users,tools

Recover tablespace users,tools

Sql "alter tablespace users online"

Sql "alter tablespace tools online"

Data file recovery

Sql "alter database datafile 3 offline"

Sql "alter database datafile'd offline oracleoradatausers01.dbf'oradatausers01.dbf'

Restore datafile 3

Restore datafile'dvir oracleoradatausers01.dbf'

Recover datafile 3

Recover datafile'dvir oracleoradatausers01.dbf'

Sql "alter database datafile 3 online"

Sql "alter database datafile 'd:oracleoradatausers01.dbf'online"

=

=

Switch the current incarnation back to the RESET DATABASE TO INCARNATION inc_key before resetlogs

=

=

RMAN Advanced recovery

1 recovery based on point in time

Run

{

Set until time "to_date ('07Compact 01Accord015JOUDUGY hh34:mi:ss')"'

Restore database

Recover database

Alter database open resetlogs

}

2 recovery based on SCN

Startup mount

Restore database UNTIL SCN 10000

Recover database UNTIL SCN 10000

Alter database open resetlogs

3 recovery based on log sequence

Startup mount

Restore database UNTIL SEQUENCE 100 thread 1

Recover database UNTIL SEQUENCE 100 thread 1

Alter database open resetlogs

Thank you for your reading, the above is the content of "detailed explanation of RMAN command". After the study of this article, I believe you have a deeper understanding of the detailed interpretation of RMAN command, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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