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

RMAN of Oracle Learning (3) full backup

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

We already know how to get into rman and connect to the database that needs to be backed up. So how do you use rman backup, and what can rman back up?

Backup database

RMAN > backup database Starting backup at 2015-07-08 00:58:27using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbfinput datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbfinput datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbfinput datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbfinput datafile file number=00006 name= / u01/app/oracle/oradata/devdb/idx01.dbfinput datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbfchannel ORA_DISK_1: starting piece 1 at 2015-07-08 00:58:28channel ORA_DISK_1: finished piece 1 at 2015-07-08 01:00:33piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_nnndf_TAG20150708T005827_bsr19n9z_.bkp tag=TAG20150708T005827 comment=NONEchannel ORA_DISK_1: backupset complete Elapsed time: 00:02:05channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 2015-07-08 01:00:34channel ORA_DISK_1: finished piece 1 at 2015-07-08 01:00:35piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_ncsnf_TAG20150708T005827_bsr1flnq_.bkp tag=TAG20150708T005827 comment=NONEchannel ORA_DISK_1: backupset complete Elapsed time: 00:00:01Finished backup at 2015-07-08 01:00:35

Backup tablespace

RMAN > backup tablespace users Starting backup at 2015-07-08 01:59:43using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbfchannel ORA_DISK_1: starting piece 1 at 2015-07-08 01:59:43channel ORA_DISK_1: finished piece 1 at 2015-07-08 01:59:44piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/ 2015_07_08/o1_mf_nnndf_TAG20150708T015943_bsr4whv0_.bkp tag=TAG20150708T015943 comment=NONEchannel ORA_DISK_1: backup set complete Elapsed time: 00:00:01Finished backup at 2015-07-08 01:59:44

Backup data files

RMAN > backup datafile'/ u01qqapp.oracleUnixoradataUniverse Starting backup at 2015-07-08 02:01:07using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbfchannel ORA_DISK_1: starting piece 1 at 2015-07-08 02:01:08channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:01:33piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/ 2015_07_08/o1_mf_nnndf_TAG20150708T020108_bsr4z487_.bkp tag=TAG20150708T020108 comment=NONEchannel ORA_DISK_1: backup set complete Elapsed time: 00:00:25channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setincluding current control file in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 2015-07-08 02:01:34channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:01:35piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_ncsnf_TAG20150708T020108_bsr4zygn_.bkp tag=TAG20150708T020108 comment=NONEchannel ORA_DISK_1: backupset complete Elapsed time: 00:00:01Finished backup at 2015-07-08 02:01:35

RMAN cannot back up temporary files when there is a point to be noted. In fact, the reason is very simple, there is no need to back up temporary files.

RMAN > backup datafile'/ u01 02:02:24RMAN-20201 02:02:24RMAN-20201 02:02:24RMAN-20201: datafile not found in the recovery catalogRMAN-06010: error while looking up datafile: / u01/app/oracle/oradata/devdb/temp01.dbfRMAN > backup tempfile'/ u01 RMAN-03002: failure of backup command at 07Accord 08 02:02:24RMAN-20201: datafile not found in the recovery catalogRMAN-06010: error while looking up datafile: / u01/app/oracle/oradata/devdb/temp01.dbfRMAN > backup tempfile'/ u01 apprenticesp01.dbf' RMAN-00571: = = RMAN-00569: = ERROR MESSAGE STACK FOLLOWS = RMAN-00571: = = RMAN-00558: error encountered while parsing input commandsRMAN-01009: syntax error: found "tempfile": expecting one of: "archivelog, as, auxiliary, backupset, backup, channel, check, controlfilecopy, copies, copy, cumulative, current, database, datafilecopy, datafile, db_file_name_convert, db_recovery_file_dest, device, diskratio, duration, filesperset, force, format, for, from, full, incremental, incremental, keep, nochecksum, Skip readonly, skip, spfile, tablespace, tag, to, validate, ("RMAN-01007: at line 1 column 8 file: standard input

Backup control file

Back up control files manually

RMAN > backup current controlfile Starting backup at 2015-07-08 02:08:15using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setincluding current control file in backup setchannel ORA_DISK_1: starting piece 1 at 2015-07-08 02:08:16channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:08:17piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_ncnnf_ TAG20150708T020815_bsr5djdz_.bkp tag=TAG20150708T020815 comment=NONEchannel ORA_DISK_1: backup set complete Elapsed time: 00:00:01Finished backup at 2015-07-08 02:08:17

2. INCLUDE CURRENT CONTROLFILE

RMAN > BACKUP DATAFILE'/ u01 INCLUDE CURRENT CONTROLFILE Starting backup at 2015-07-08 02:13:22using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbfchannel ORA_DISK_1: starting piece 1 at 2015-07-08 02:13:22channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:13:29piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/ 2015_07_08/o1_mf_nnndf_TAG20150708T021322_bsr5p2of_.bkp tag=TAG20150708T021322 comment=NONEchannel ORA_DISK_1: backup set complete Elapsed time: 00:00:07channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setincluding current control file in backup setchannel ORA_DISK_1: starting piece 1 at 2015-07-08 02:13:30channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:13:31piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_ncnnf_TAG20150708T021322_bsr5pbv3_.bkp tag=TAG20150708T021322 comment=NONEchannel ORA_DISK_1: backupset complete Elapsed time: 00:00:01Finished backup at 2015-07-08 02:13:31

No matter what backup is made, the controlfile will be backed up automatically as long as you add INCLUDE CURRENT CONTROLFILE,RMAN after the backup statement.

3. By configuring the parameters of RMAN, let rman back up controlfile automatically no matter what kind of backup it does.

RMAN > SHOW CONTROLFILE AUTOBACKUP;RMAN configuration parameters for database with db_unique_name DEVDB are:CONFIGURE CONTROLFILE AUTOBACKUP OFF; # defaultRMAN > CONFIGURE CONTROLFILE AUTOBACKUP ON;new RMAN configuration parameters:CONFIGURE CONTROLFILE AUTOBACKUP ON;new RMAN configuration parameters are successfully storedRMAN > BACKUP DATAFILE'/ u01 apprenticeship oradataUndotbs01.dbf' Starting backup at 2015-07-08 02:18:38using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbfchannel ORA_DISK_1: starting piece 1 at 2015-07-08 02:18:38channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:18:39piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/ 2015_07_08/o1_mf_nnndf_TAG20150708T021838_bsr5zyb4_.bkp tag=TAG20150708T021838 comment=NONEchannel ORA_DISK_1: backup set complete Elapsed time: 00:00:01Finished backup at 2015-07-08 02:18:39Starting Control File and SPFILE Autobackup at 2015-07-08 02:18:39piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884485119_bsr5zzrp_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015-07-08 02:18:40

When CONTROLFILE AUTOBACKUP ON is set, rman not only backs up the control files automatically, but also spfile is backed up.

If you pay close attention to the information printed during the backup, you will find that when we execute backup database, even if CONTROLFILE AUTOBACKUP is set to off. Rman also automatically backs up control files and spfile. Because by default, rman treats controlfile and spfile as part of the database.

Backup archive log

Execute the backup archivelog command

RMAN > backup archivelog all Starting backup at 2015-07-08 02:36:09current log archivedusing channel ORA_DISK_1channel ORA_DISK_1: starting archived log backup setchannel ORA_DISK_1: specifying archived log (s) in backup setinput archived log thread=1 sequence=16 RECID=7 STAMP=884486041input archived log thread=1 sequence=17 RECID=8 STAMP=884486144input archived log thread=1 sequence=18 RECID=9 STAMP=884486148input archived log thread=1 sequence=19 RECID=10 STAMP=884486151input archived log thread=1 sequence=20 RECID=11 STAMP=884486169channel ORA_DISK_1: starting piece 1 at 2015-07-08 02:36:09channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:36:10piece handle=/u01 / app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_annnn_TAG20150708T023609_bsr70spk_.bkp tag=TAG20150708T023609 comment=NONEchannel ORA_DISK_1: backupset complete Elapsed time: 00:00:01Finished backup at 2015-07-08 02:36:10Starting Control File and SPFILE Autobackup at 2015-07-08 02:36:10piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884486170_bsr70v0k_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015-07-08 02:36:11

two。 When you execute the backup command, add the plus archivelog clause.

RMAN > backup database plus archivelog Starting backup at 2015-07-08 02:41:08current log archivedusing channel ORA_DISK_1channel ORA_DISK_1: starting archived log backup setchannel ORA_DISK_1: specifying archived log (s) in backup setinput archived log thread=1 sequence=16 RECID=7 STAMP=884486041input archived log thread=1 sequence=17 RECID=8 STAMP=884486144input archived log thread=1 sequence=18 RECID=9 STAMP=884486148input archived log thread=1 sequence=19 RECID=10 STAMP=884486151input archived log thread=1 sequence=20 RECID=11 STAMP=884486169input archived log thread=1 sequence=21 RECID=12 STAMP=884486468channel ORA_DISK_1: starting piece 1 at 2015-07-08 02:41:08channel ORA_DISK_1: finished piece 1 at 2015-07-08 02: 41:09piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_annnn_TAG20150708T024108_bsr7b4wr_.bkp tag=TAG20150708T024108 comment=NONEchannel ORA_DISK_1: backupset complete Elapsed time: 00:00:01Finished backup at 2015-07-08 02:41:09Starting backup at 2015-07-08 02:41:09using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbfinput datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbfinput datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbfinput datafile file number=00003 Name=/u01/app/oracle/oradata/devdb/undotbs01.dbfinput datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbfinput datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbfchannel ORA_DISK_1: starting piece 1 at 2015-07-08 02:41:10channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:42:05piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_nnndf _ TAG20150708T024110_bsr7b68z_.bkp tag=TAG20150708T024110 comment=NONEchannel ORA_DISK_1: backup set complete Elapsed time: 00:00:55Finished backup at 2015-07-08 02:42:05Starting backup at 2015-07-08 02:42:05current log archivedusing channel ORA_DISK_1channel ORA_DISK_1: starting archived log backup setchannel ORA_DISK_1: specifying archived log (s) in backup setinput archived log thread=1 sequence=22 RECID=13 STAMP=884486525channel ORA_DISK_1: starting piece 1 at 2015-07-08 02:42:05channel ORA_DISK_1: finished piece 1 at 2015-07-08 02:42:06piece handle=/u01/app/oracle/ Fast_recovery_area/DEVDB/backupset/2015_07_08/o1_mf_annnn_TAG20150708T024205_bsr7cxsd_.bkp tag=TAG20150708T024205 comment=NONEchannel ORA_DISK_1: backupset complete Elapsed time: 00:00:01Finished backup at 2015-07-08 02:42:06Starting Control File and SPFILE Autobackup at 2015-07-08 02:42:06piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884486526_bsr7cz3l_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015-07-08 02:42:07

What is the difference between this method and the above one? the difference is so obvious that the BACKUP.PLUS ARCHIVELOG command performs the following steps in turn during the backup process:

1 >. Run the ALTER SYSTEM ARCHIVE LOG CURRENT statement to archive the current redolog.

2 >. Execute the BACKUP ARCHIVELOG ALL command to back up all archived logs.

3 >. Execute the BACKUP command to back up the specified item.

4 >. Run ALTER SYSTEM ARCHIVE LOG CURRENT again to archive the current redolog.

5 >. Back up the newly generated archive files that have not yet been backed up.

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