1.SYSBACKUP Privilege:
The SYSBACKUP privilege allows the DBA to perform RMAN backup commands without additional privileges. Prior to 12c, users needed SYSDBA privilege to backup the database.
rman target ' "/ as sysbackup" '
rman target ' "/ as sysdba" '
rman target /
rman target1 ‘ “bkpadm@PDB1 as sysbackup” ‘
rman target ‘ “sysadm@PDB1 as sysdba” ‘
rman target sysadm@PDB1
2.SQL Interface Improvements:
SQL commands can be run in RMAN.DDL/DML Commands can be from RMAN Command prompt.
SHUTDOWN/STARTUP the database and also can use ALTER commands.
RMAN DESCRIBE provides the same functionality of SQL*Plus DESCRIBE.
RMAN> desc dba_profiles;
RMAN> select sysdate from dual;
RMAN> create table table5(col1 number, col2 varchar2(20));
RMAN> insert into table5 values (1,'Test3');
RMAN> update table5 set col1=2;
RMAN> drop table table5;
RMAN> shutdown immediate
RMAN> startup mount
RMAN> alter database open;
3.Support for multitenant container and pluggable databases:
RMAN provides full support for backup and recovery for CDB and PDB.
RMAN you can back up an entire container database or individual pluggable databases and also can perform point-in-time recovery. But it is recommended that you turn on control file auto backup.Otherwise point-in-time recovery for pluggable databases may not work efficiently when you need to undo data file additions or deletions.
When you back up a container database, RMAN backs up the root, pluggable databases in the container, and archive logs.while restoring we can choose the whole container, one or more pluggable databases or the root only.
Backup the CDB, PDB, and root:
You should have SYSBACKUP or SYSDBA privilege to backup any of the databases
Container Database (CDB) as same as non-container database using below command:
RMAN> BACKUP DATABASE plus ARCHIVELOG;
Pluggable Database (PDB) using below command:
RMAN> BACKUP PLUGGABLE DATABASE PDB1, PDB2;
Or connect to pluggable Database in RMAN :
% rman target sys@PDB1
RMAN> BACKUP DATABASE;
backup the root using below command:
RMAN> BACKUP DATABASE ROOT;
restore the whole CDB using below script.restoring CDB database will restore all the pluggable databases.
RMAN> RUN {
STARTUP MOUNT;
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN;
}
restore only ROOT Database using below script:
RMAN> RUN {
STARTUP MOUNT;
RESTORE DATABASE ROOT;
RECOVER DATABASE ROOT;
ALTER DATABASE OPEN;
}
restore Pluggable Databases in two ways. Either you can restore from root container and connect directly to PDB to restore.
Use below script to restore from root. Using this approach you can able to restore and recover multiple PDB’s with a single command.
RMAN > RUN {
RESTORE PLUGGABLE DATABASE PDB1, PDB2;
RECOVER PLUGGABLE DATABASE PDB1, PDB2;
ALTER PLUGGABLE DATABASE PDB1, PDB2 OPEN;
}
Use below script to connect PDB, restore and recover the database. Using this approach you will be able to restore and recover only one PDB.
$ rman target=bkpadm@PDB1
RMAN> run{
RESTORE DATABASE;
RECOVER DATABASE;
}
performing a point-in-time recovery of the CDB or PDB are the same as a normal database.
when you perform Point-in-time recovery on the CDB, it will effect on all the PDBs as well.
When you perform point-in-time recovery on a PDB, it will affect that single database.
The command to perform a point-in-time recovery is:
SET UNTIL TIME "TO_DATE(’10-Feb-2014 01:00:00’,’DD-MON-YYYY HH24:MI:SS’)";
SET UNTIL SCN 19900005; # alternatively, specify SCN
SET UNTIL SEQUENCE 120; # alternatively, specify log seq
4.Backup of Archived redo logs:
We can back up or delete archive logs when they connect to root as a common user with SYSDBA or SYSBACKUP privilege, but you cannot back up or delete archive logs when you connect to PDB as a local user with SYSDBA or SYSBACKUP privilege.
We only able to switch the archived logs when connect to the root of a CDB, but cannot switch archived redo logs when connected to a PDB.
If there is more than one archive log destination, when RMAN used to backup the archive redo logs it backs up only one copy of the archived redo logs. RMAN does not include more than one copy because multiple destinations will have same log sequence number.
5.DUPLICATE enhancements:
When you duplicate a database using RMAN DUPLICATE, the database is created and opened with RESETLOGS mode. With Oracle database 12c, you can specify that the database must not be opened with “NOOPEN” clause.
NOOPEN clause is useful in following situations:
If need to make changes to initialization parameters such as block change tracking, flashback database settings.
Opening the database conflict with other source database
If plan to create database for upgrade and want to open in upgrade mode.
Below command used to creates duplicate database, but not open.
RMAN> DUPLICATE TARGET DATABASE TO DB1 FROM ACTIVE DATABASE NOOPEN;
6.Multi section Backup Improvements:
This backup functionality introduced in 11g to handle large data file backups. In this RMAN can break up a large file into sections during the backup and recovery, which will improve the performance of large datafiles backup. We can select the size using the SECTION SIZE keyword and each channel will create separate files within the backup set, and backup the database in parallel. This only supports backup sets in 11g.
In 12c, the multisection backup supports incremental backups and image copies, including backup sets (introduced in 11g). This functionality can only be used for data files, We cannot use this to backup control files.
If the SECTION SIZE that is selected is larger than the actual file, then RMAN will not use multisection backup functionality. If specify a small SECTION SIZE that produces more than 256 sections then RMAN increases the SECTION SIZE to a value that results 256 sections.
To Create Multisection backup image copies.
RMAN> BACKUP AS COPY SECTION SIZE 1024M DATABASE;
To Create multisection incremental level1 backup:
RMAN> BACKUP INCREMENTAL LEVEL 1 SECTION SIZE 1024M DATABASE;
To enhance the backup performance, use unused block compression and block change tracking in conjunction with multisection incremental backups.
7.Restoring and Recovering Files over Network:
RMAN can restore and recover a database, tablespace, datafile, controlfile or spfile over network from a physical standby database. Restore to be happens over the network, RESTORE… FROM SERVICE command and RECOVER…FROM SERVICE command is used.
FROM SERVICE clause specifies the service name of the physical standby.
multisection, compression and encryption can be used to improve backup and restore performance.
This is very useful in scenarios involving a standby database:
Restore or recover files lost by connecting through the network on one database (standby/primary) which is available on the other database.
Recover a standby database to using an incremental backup taken off the primary to roll forward the standby.
Example to restoring data file over the network from physical standby to primary database:
Connect to Primary:
RMAN> CONNECT TARGET /
Backup sets encrypted using AES128 encryption algorithm:
RMAN> SET ENCRYPTION ALGORITHM 'AES128';
Restore datafile on the primary using service “standby_db”:
RMAN> RESTORE DATAFILE '/u01/oradata/datafile1.dbf' FROM SERVICE standby_db SECTION SIZE 1024M;
8.Active Database Duplication Improvements:
Active Database duplication introduced in oracle 11g.This feature create clone or standby database by copying the data files and archive logs using the TARGET (Source) database channels over the network to clone AUXILIARY database. In this method no backups of the TARGET database is required. Processing load will be on the TARGET instance as TARGET database channels is being used.
In Oracle 12c, Active Database duplication can be performed using the backup sets. Sufficient AUXILIARY channels is allocated to connect TARGET database and retrieve the backup’s sets over the network, this reduced the load on the TARGET (source) database. Unused block compression can be used to reduce the size of the backups transported over the network. Encrypt backups and multisection backups can also be used. Network consumption reduces and performance improves in 12c.
RMAN to use backup sets we need to establish connection to target database using a net service name and one of the below conditions should satisfy:
(i)AUXILIARY channels numbers should be equal or greater than TARGET channels.
(ii)DUPLICATION …FROM ACTIVE DATABASE should contain either USING BACKUPSET, USING COMPRESSED BACKUPSET or SECTION SIZE .
9.Unified auditing and RMAN:
UNIFIED_AUDIT_TRAIL dictionary view has a set of fields (prefixed with RMAN_) which automatically record RMAN related events. AUDIT_ADMIN or AUDIT_VIEWER role required in order to query the UNIFIED_AUDIT_TRAIL view.
10.Recovering Tables and Table Partitions from RMAN Backups:
A dropped or purged (truncated) table can now back in time without affecting the rest of the objects within the database/tablespace.
RMAN 12c will create an auxiliary instance in a separate disk location of required files, recovers the tables or table partitions up to the desired point in time. It will then create a data pump export dump containing the recovered objects.
11.Storage Snapshot Optimization:
With this feature we can take storage snapshot of database using third-party technologies without keeping the database in BACKUP mode. When need to recover, point in time can be used of the snapshot. Roll forward can be used by using the database archive logs, and use this snapshot feature to recover part or all of the database.
Recommended to use different storage to keep snapshot from where the database is running.
Following are required to backup database using storage snapshot optimization:
(i)The snapshot preserves the write order for each file.
(ii)The database is crash consistent during the snapshot.
(iii)The snapshot technology stores the time at which the snapshot is completed.
If above compliance id not fulfilled with third-party snapshot technology vendor, to take snapshot we have to keep database in BACKUP mode.
Following operational changes ONLINE, OFFLINE, DROP, RENAME, ADD, READONLY and SHRINK on data files and table spaces during the snapshot then the snapshots are unusable.
Recovery time cannot be earlier than the snapshot time.
To recover complete database:
RECOVER DATABASE;
To recover database using particular snapshot
RECOVER DATABASE UNTIL TIME ‘11/10/2019 12:00:00’ SNAPSHOT TIME ‘11/9/2019 11:00:00’
partial recovery using archived redo logs:
RECOVER DATABASE UNTIL CANCEL SNAPSHOT TIME ‘11/19/2019 09:00:00’
No comments:
Post a Comment