In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how to use oracle RMAN", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use oracle RMAN" this article.
Introduction to 1.RMAN environment
1) RMAN is a client tool for backing up and restoring databases and automatically managing relevant backup strategies.
2) the RMAN environment consists of at least two parts:
Target database (target database): the database that needs to be backed up and restored, specified by the target command under the RMAN command line
RMAN client: an executable program stored in the $ORACLE_HOME/bin directory by default to execute RMAN commands for database backup and recovery operations.
In some cases, the RMAN environment may also include:
Quick recovery area (fast recovery area): a place for storing and managing backup recovery related files, which can be set up through DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE.
Media Manager: the application that RMAN needs to deal with media devices
Recovery catalog (recovery catalog): a separate database scheme that stores metadata for multiple target databases it manages.
two。 Start RMAN and connect to the target database
1) when you use RMAN to connect to the database, you log in using the SYSDBA role by default.
2) RMAN connection syntax
3. View current RMAN configuration
1) through the show all; command, you can view the current configuration.
4. Backup database
1) back up the database through the backup command. By default, the backup files are placed in the quick recovery area. To back up to another path, you need to set the FORMAT parameter.
2) the default backup type of RMAN is backup set, not mirror. You can back up the image file by entering BACKUP AS COPY.
5. Back up the database in archive mode
1) if archiving is enabled in the database, the database supports RMAN backup in open state, but the backup is inconsistent, that is, archived redo logs are needed during recovery to restore the database to a consistent state.
2) backup database plus archivelog
6. RMAN backup in non-archive mode
1) databases in non-archive mode can only be backed up consistently. Before backup, you need to turn off database consistency, open it to mount state, and then back up.
2) shutdown immediate
Backup database
7. Common typical backup options
1) FORMAT: specify the storage path and naming rules for backup fragments.
BACKUP FORMAT'/ u01 ARCHIVELOG LIKE arc_dest%' App ARCHIVELOG LIKE oracle oradataEnmo1Accord% dAccord% t Accord% s'Accord'%
Where:% U gets a unique name assigned by the system;% d is the timestamp set by the DB_NAME;%t backup;% s is the backup set number;% p is the backup fragment number.
2) TAG: assign a tag to the backup fragment. If it is not specified, the system automatically generates a random unique tag. Tags are always stored in uppercase in the backup original data.
BACKUP TAG 'weekly_full_db_bkup' DATABASE MAXSETSIZE 10m
8. Create an incremental backup
1) incremental backup is divided into cumulative incremental backup (cumulative incremental backup) and differential incremental backup (differential incremental backup). The default type of oracle is differential incremental backup.
2) the difference between differential incremental backup and cumulative incremental backup:
Differential incremental backup: each backup to a backup whose last backup level is less than or equal to the current level.
Cumulative incremental backup: each backup up to the last backup less than the current level.
3) incremental backup requires a level 0 backup as the starting point for backup.
4) oracle recommends that the level of backup is limited to level 0 and level 1 to facilitate backup management.
5) incremental backup example:
Backup incremental level 0 database;----0 level incremental backup as the basis of the incremental backup strategy
Backup incremental level 1 cumulative database;----1 level cumulative incremental backup
Backup incremental level 1 database;----1 level differential incremental backup
9. Create an incremental update backup
1) RMAN supports incremental update backups, but this feature requires the following prerequisites:
First, level 0 data file images are required as the basis, and these images require a system-defined or personally defined label.
Second, during regular backups, the label of a level 1 differential incremental backup needs to be the same as that of a level 0 data file image. The BACKUP FOR RECOVER OF COPY command allows you to specify an incremental backup that only backs up blocks that have changed since the last backup with the same label.
Third, during regular backups, incremental backups are applied to level 0 images, and because the data file images have been updated by incremental backups, the workload required for media recovery will be greatly reduced.
2) example of command:
Backup incremental level 0 for recover of copy tag 'test' database;-use tag to mark the data file image as the basis of the backup strategy
Recover copy of database with tag 'test';---- incremental update backup
10. Check the validity of database files and backups
1) validity includes whether the data file exists in the correct path and whether there is physical block corruption. With the CHECK LOGICAL command, you can also check for logical block corruption.
2) check the data files and archive log files during backup: BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL
3) support checking the database in the data file: VALIDATE DATAFILE 4 BLOCK 10 TO 30
4) support verification of database backup sets: VALIDATE BACKUPSET 3
11. Use script files to perform RMAN tasks
1) RMAN supports files in all formats
2) the script file can be referenced through RMAN @ / my_dir/test.txt or through @ / my_dir/test.txt after logging in to RMAN.
twelve。 Use list to list RMAN backup information
1) list backup of database by backup
List backup by file
List backup summary
List expired backupset/copy
List backup recoverable
13. Use REPORT to list RMAN backup information
REPORT NEED BACKUP DATABASE;-- lists the data files that currently need to be backed up
REPORT OBSOLETE
REPORT SCHEMA
REPORT UNRECOVERABLE
14. Maintain RMAN backup
1) CROSSCHECK: this command synchronizes the location of the database backup and mirroring on the actual storage and the logical records in the repository. If the backup file exists on disk, CROSSCHECK will check whether the file header is valid. Generally, a CROSSCHECK check is required before deleting a backup.
2) example: CROSSCHECK BACKUP; CROSSCHECK COPY
15. Delete timed-out backups
1) the DELETE command will delete the backup file on the disk or tape, and update the status in the control file to "deleted" or delete the record in the backup directory (backup catalog).
2) DELETE OBSOLETE
16. Use the data recovery advisor (data recovery advisor) for failure diagnosis and repair
1) list current failures and determine repair options: failure in oracle refers to data corruption detected by Health Monitor, such as logical or physical block corruption, data file loss, etc. The detected failures have different priorities (CRITICAL, HIGHT, and LOW) and status (OPEN and CLOSED).
2) you can view the current detected failures through LIST FAILURE. If you execute the ADVISE FAILURE command in the same session, the database will list manual and automatic repair options to choose from.
3) generally, first of all, it is repaired by manual repair, and if the manual repair is not successful, it will be repaired automatically.
17. Using flashback database technology
1) if you want to use flashback database technology, you need to enable the flashback log feature. (flashback logs can only be stored in the quick recovery area and will not be archived)
2) the flashback database cannot be used for media recovery and repair of lost data files.
3) flashback database needs to be performed in mount state.
4) Command:
Shutdown immediate;-adjust to mount status
Startup mount
Flashback database to scn 1526845. Talk about a moment in the past.
Flashback database to restore point before_points
Flashback database to timestamp to_date ('20140510 recording recording yyymmdd`)
Alter database read only;---- makes the database read-only for verification
If shutdown immediate;---- meets the requirements after flashback, start the database
Startup mount
Alter database open resetlogs
18. Restore and restore database files
1) restore refers to finding a data file for the restore operation from all the backup or image files.
2) recovery refers to applying the changes recorded in the redo log or incremental backup to the restored data file so that the data file is rolled forward to an SCN value or a point in time.
3) when restoring the database, you can preview it first: restore database preview summary
4) restore the entire database:
Startup force mount;---- puts the database into the mount state
Restore database;---- restore database
Recover database;---- recovery database
Alter database open
5) restore tablespaces: when the database is open, you can restore and restore the tablespace level through restore tablespace and recover tablespace. When restoring and restoring the tablespace, the data files involved in the tablespace need to be set offline, and then set online after the recovery is completed.
Alter tablespace users offline
Alter tablespace users online
6) restore the data block
When the RMAN tool makes a backup, it records the bad blocks detected during the backup to the V$DATABASE_BLOCK_CORRUPTION view.
During the backup process, bad blocks are also recorded in the alarm log and TRACE files. You can check the location of these files through V$DIAG_INFO, and find related files to view bad blocks.
Using RMAN for bad block recovery
Recover corruption list;---- fixes all bad blocks
Recover datafile 1 block 33, 44 datafile 2 blocke 1 to 200
The above is all the contents of this article "how to use oracle RMAN". 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.