Oracle Backup tool, file naming format, Rman operations

Source: Internet
Author: User

First, common tools:

Recovery Manager:rman can only perform hot sparing (mount or open state)
Oracle Secure Backup
User-managed Backup: CP/DD [if=/of=/blocksize=]

Ii. Name of Rman

The Rman name does not allow duplication, and%u is definitely not duplicated.

Number of copies of%c backup slices

%d The day ordinal (DD) in the month

%M in the month of the year (MM)

%F a unique name based on dbid, which is in the form of C-IIIIIIIIII-YYYYMMDD-QQ,

%d database name where IIIIIIIIII is the date of the database DBID,YYYYMMDD, QQ is a sequence of 1-256

%n database name, fill to the right up to a maximum of eight characters

%u a eight-character name represents the backup set and the creation time

%p The backup piece number in the backup set, starting from 1 to the number of files created

%u a unique file name that represents%u_%p_%c

%s The number of the backup set

%t Backup set Timestamp

%T date Format (YYYYMMDD)

Third, Rman related operations

--Login Rman
Rman Target/
Rman Target Sys/passwork
Rman Target sys/passwork nocatalog (control file mode)
Rman Target sys/passwork Catalog (Restore directory mode)


--View parameters

Rman> Show All;
CONFIGURE RETENTION POLICY to RECOVERY windows of 7 days;
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/11.2.0/dbhome_1/dbs/snapcf_orcl.f '; # Default

Note: #default表示该配置仍然是初始的默认值. Go back to the default configuration configure. Clear

1) Configure retention policy to:
--to determine which backups are not needed, a total of three options are available:
A) Redundancy 5
--Represents the number of backup sets that exist for a data file, here are 5 copies
b) Recovery window of 7 days
--Indicates that you want the database to be restored to a few days ago.
c) None
--Indicates that a retention policy is not required
NOTES: a) and b) are mutually exclusive relationships
.
2) CONFIGURE BACKUP optimization ...
-In theory, backup optimization works only for read-only table spaces or offline table spaces. Of course, the archived log files that have already been backed up will also be skipped, and the default is off

3) CONFIGURE DEFAULT DEVICE TYPE to:
--Specifies the type of device for I/O operations: SBT or disk. The default is disk.

4) CONFIGURE Controlfile autobackup.
--When the autobackup is not on, Rman does any backup operation and automatically backs up the control files.

5) CONFIGURE Controlfile autobackup FORMAT for DEVICE TYPE DISK to '%F '
--Configure the path and format of the backup slice for the control file
Example: Configure Controlfile autobackup format for device type disk to '/u01/app/oracle/backup/%f '

6) CONFIGURE DEVICE type DISK PARALLELISM 1 BACKUP type to BACKUPSET

--Configures the degree of parallelism of the database device type. The number of parallel numbers determines the number of open channels

7) CONFIGURE datafile BACKUP COPIES for DEVICE TYPE DISK to 1

CONFIGURE ARCHIVELOG BACKUP COPIES for DEVICE TYPE DISK to 1
--whether to start a composite backup and generate the specified number of copies to the specified location in the specified I/O device. The default is 1.
This configuration is only available for data files and archive files, and will only take effect if the channel is automatically assigned!

8) CONFIGURE Maxsetsize to UNLIMITED
--Configures the size of the backup set. The maxpiecesize is typically configured to restrict backup slices.

9) CONFIGURE encryption for DATABASE OFF
--Configure an encrypted backup set. can be specific to a table space:
Configure encryption for tablespace users on;
If we execute set encryption on indentified by think only, then the backup created immediately thereafter requires that password for normal recovery

TEN) CONFIGURE encryption algorithm ' AES128 '
--Specify the encryption algorithm, and another is ' AES256 '

One) CONFIGURE ARCHIVELOG deletion POLICY to NONE
--Specifies the deletion policy of the archive, the default is None, that is, when the archive backup is finished, it can be deleted
However, in the DG Environment, the DBA must ensure that the archive file is always saved on the standby side before it is successfully received and applied, and the primary
Therefore, the DG Environment when set to: Applied on standby

CONFIGURE SNAPSHOT controlfile NAME to '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f '
--Configure the location and file name of the snapshot file for the control file, which is generated during the backup to control the read consistency of the file
In addition, CONFIGURE EXCLUDE for tablespace <tablespace> [CLEAR]; This command is useful for read-only tablespace when the specified tablespace is not backed up to the backup set.

--Modify Save Days
Change the number of days that backup information is retained in the control file with Sqlplus
Show Parameter Control_file_record_keep_time

Alter system set CONTROL_FILE_RECORD_KEEP_TIME=30 Scope=spfile
Shutdown immediate
Startup


--rman Database Cold Backup
Shutdown immediate;
startup Mount;
Backup Database format= '/u01/backup/rman/%d_%t_%s.bak ';
ALTER DATABASE open;
SQL ' alter system archive log current ';


--rman Database Hot Backup
Backup Database format= '/u01/backup/rman/%d_%t_%s.bak ';
SQL ' alter system archive log current ';


--Backup table space
Backup tablespace emp;


--Backup data files
Backup datafile '/u01/mytest.dbf ';
Backup datafile 5 format= '/u01/backup/rman/%n_%s.dbf ';


--Backup Archive log
Backup Archivelog All
Backup Archivelog from time ' sysdate-1 '
Backup Archivelog from sequence 400
Backup Archivelog All Delete input
Backup Archivelog from sequence to delete input

format= '/u01/backup/rman/ar%t_%s.arc '--Specify path%T date


--Back up archived files for the past day
Backup format= '/u01/backup/rman/ar%d_%s.arc '
Archivelog
From Time= ' sysdate-1 ' until time= ' sysdate ';


--Backup data files and archive logs
Backup format= '/u01/backup/rman/t%d_%s.bak ' tablespace emp plus archivelog;


--Backup control files
Backup current Controlfile format= '/u01/backup/rman/%d_%s.ctl ';


--Backup SPFile
Backup SPFile format= '/u01/backup/rman/spf%d_%s.par ';


--Compress backup sets
Backup as compressed backupset tablespace EMP;


--Create a copy of the control file image
Copy current controlfile to '/u01/backup/rman/dbtest.ctl ';
Backup as Copy format= '/u01/backup/rman/dbtest01.ctl ' current controlfile;


--Create a copy of the data file image
Backup as Copy format= '/u01/backup/rman/8.dbf ' datafile 8;


--rman Maintenance Commands
List Backup--list all the backup information
List backup of database--list backup of databases
List Backup of tablespace EMP--Lists the specified tablespace backup
List Backup of datafile 5--Lists the specified data file backup
List backup of Controlfile--list control file backups
List backup of SPFile--list SPFile backup
List Archivelog All--list archived logs
List backup of Archivelog All--lists backup of archived logs

List Backup of database summary--list available backups
List Backup of tablespace EMP Summary--About table space backup
List backup by file--list backups by document type
List expired backup of Archivelog all summary--failed backups

Report obsolete--view expired
Delete obsolete--remove expired

List recoverable backup of database           --list valid backups
List Expired backup                            --List failed backups

List expired backup of Archivelog all         --List of failed archive log backups
List Expired backup of Archivelog
     until sequence 5       & nbsp;                 -- Lists the failed archive log backups for the specified serial number
list expired backup of Archivelog
     until Time "to_date (' 2012-6-30 ', ' Yyyy-mm-dd ') "   
                                                -- Lists the failed archive log backup backups for a specified time

List copy--list image file copies
List copy of database
List copy of tablespace EMP
List copy of DataFile 6
List copy of Archivelog all
List copy of Controfile

Report schema
Report need backup-lists the
Report need backup Day 2 database--list of more than 2 days without backup

Under Mount State
List incarnation;
Reset database to incarnation 980;


--Delete invalid files
Delete a failed backup
Crosscheck Backup (Copy,archivelog all);
Delete Expired backup (Copy,archivelog all);


Delete the invalidation log
Crosscheck Archivelog All;
Delete Expired Archivelog all;

Crosscheck Backup of tablespace sysaux--Check table space backup
Crosscheck Backup of datafile 2--Check data file 2 backup
Crosscheck Backup of Controlfile--check control file backup
Crosscheck Backup of SPFile--check SPFile
Crosscheck Backup of copy-check copy
Crosscheck backup completed after ' sysdate-2 '--2 days before the current time

Crosscheck Copy of database
Crosscheck copy of Tablespace EMP
Crosscheck copy of Controlfile
Crosscheck copy of SPFile

List Backup summary--get the primary key
Validate Backupset 16--Verifying the validity of backup set 16
Change--Modify backup status
Change Backupset unavailable
Change Backupset available
Change Archivelog '/u01/backup/rman/***.log ' unavailable

Change Backupset Delete--Remove backup set 16 (sync Delete)
Delete Expired backupset (Archivelog all); --Delete invalid

Delete Expired--Deleting a failed backup
Delete obsolete--delete backups older than the backup policy date (expired)


--Recovery check
Restore database validate;
Validate Backupset 218;

Restore Database preview;
Restore tablespace users preview;
Restore datafile 5 Preview;


--Command block
run{
2> shutdown immediate;
3> startup Mount;
4> Allocate channel D1 type disk;
5> Backup as Backupset database
6> format= '/u01/backup/rman/%d_%t.bak ';
7> ALTER DATABASE open;
8> SQL ' alter system archive log current ';
9>}

SELECT * from V$log;
SELECT * from V$archived_log;
SELECT * from V$backup_redolog;


--Recovery Consultant
List Failure--Diagnostic error
Advise failure--suggestion
Repair Failure-repair (data files and control files)


Renaming data files under--rman
run{
2> SQL ' alter tablespace test_user offline ';
3> set newname for datafile '/u01/app/oracle/oradata/test_user.dbf '
4> to '/u01/app/oracle/oradata/test_user01.dbf ';
5> restore Tablespace test_user;
6> switch datafile all;
7> recover tablespace Test_user;
8> SQL ' alter tablespace test_user online ';
}


--rman to data file movement
run{
2> SQL ' alter tablespace test_user offline ';
3> set newname for datafile '/u01/app/oracle/oradata/test_user01.dbf '
4> to '/u01/app/oracle/oradata/dbtest/test_user01.dbf ';
5> restore Tablespace test_user;
6> switch datafile all;
7> recover tablespace Test_user;
8> SQL ' alter tablespace test_user online ';
}

Oracle Backup tool, file naming format, Rman operations

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.