{"id":73185,"date":"2014-09-29T13:19:47","date_gmt":"2014-09-29T13:19:47","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/uncategorized\/oracle-database-12c-rman-new-features-part1\/"},"modified":"2021-07-14T13:07:29","modified_gmt":"2021-07-14T13:07:29","slug":"oracle-database-12c-rman-new-features-part1","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/oracle-database-12c-rman-new-features-part1\/","title":{"rendered":"Oracle Database 12c &#8211; RMAN New Features: Part1"},"content":{"rendered":"<p>Oracle Database 12c has new enhancements and additions in Recovery Manager (RMAN).\u00a0 The Recovery Manager continues to enhance and extend the reliability, efficiency, and availability of Oracle Database Backup and Recovery. In this article series, I will be explaining the new features and how it will help Oracle community.<\/p>\n<p>In this article I will cover:<\/p>\n<ul>\n<li>SQL Interface Improvements<\/li>\n<li>SYSBACKUP Privilege<\/li>\n<li>Support for multitenant container and pluggable databases<\/li>\n<li>DUPLICATE enhancements<\/li>\n<\/ul>\n<h2>SQL Interface Improvements<\/h2>\n<p>In Oracle 12c, you can run SQL commands in RMAN without preceding the command with the SQL keyword.\u00a0 You also no longer need to enclose the SQL command in quotes.<\/p>\n<p>The RMAN DESCRIBE provides the same functionality of SQL*Plus DESCRIBE:<\/p>\n<pre>RMAN&gt; desc dba_profiles;\r\n\r\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Null?\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Type\r\n----------------------------      --------\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0----------------------------\r\nPROFILE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NOT NULL \u00a0\u00a0\u00a0     VARCHAR2(128)\r\nRESOURCE_NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0     \u00a0\u00a0\u00a0\u00a0 NOT NULL \u00a0\u00a0     \u00a0VARCHAR2(32)\r\nRESOURCE_TYPE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 VARCHAR2(8)\r\nLIMIT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 VARCHAR2(128)\r\nCOMMON\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 VARCHAR2(3)<\/pre>\n<p>You can run SQL statements from RMAN command prompt:<\/p>\n<pre>RMAN&gt; select sysdate from dual;\r\n\r\nSYSDATE\r\n---------\r\n10-SEP-14\r\n\r\nRMAN&gt;<\/pre>\n<p>You can run DDL\/DML Commands from RMAN Command prompt, but note that in order to insert you need to use:<\/p>\n<pre>RMAN&gt; create table ora_table(col1 number, col2 varchar2(20));\r\n\r\nStatement processed\r\n\r\nRMAN&gt; insert into ora_table values (1,'Test');\r\n\r\nStatement processed\r\n\r\nRMAN&gt; update ora_table set col1=2;\r\n\r\nStatement processed\r\n\r\nRMAN&gt; drop table ora_table;\r\n\r\nStatement processed<\/pre>\n<p>The user can SHUTDOWN\/STARTUP the database and also can use ALTER commands:<\/p>\n<pre>RMAN&gt; shutdown immediate\r\n\r\ndatabase closed\r\ndatabase dismounted\r\nOracle instance shut down\r\n\r\nRMAN&gt; startup mount\r\n\r\nconnected to target database (not started)\r\nOracle instance started\r\ndatabase mounted\r\n\r\nTotal System Global Area\u00a0\u00a0\u00a0 1610612736 bytes\r\n\r\nFixed Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  2924928 bytes\r\nVariable Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 520097408 bytes\r\nDatabase Buffers\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0    \u00a0 1073741824 bytes\r\nRedo Buffers\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a013848576 bytes\r\n\r\nRMAN&gt; alter database open;\r\n\r\nStatement processed<\/pre>\n<p>With this new SQL Interface improvement\u2019s, users don\u2019t need to switch between RMAN and SQL* Plus prompts during Backup &amp; Recovery, administration&#8230;etc.<\/p>\n<h2>SYSBACKUP Privilege<\/h2>\n<p>Prior to 12c, users needed SYSDBA privilege to backup the database. The new SYSBACKUP privilege allows the user the permissions to perform only backup operations.<\/p>\n<p>The SYSBACKUP privilege allows the DBA to perform RMAN backup commands without additional privileges. Using this new role in 12c, you can segregate Administration and Backup operations.<\/p>\n<p>With RMAN you have same authentication options that are available with SQL*Plus, which are Operating system authentication and password file authentication.<\/p>\n<p>To connect to RMAN using Operating system Authentication Authentication with the SYSBACKUP Privilege use:<br \/>\n<code>$ rman target ' \"\/ as sysbackup\" '<\/code><\/p>\n<p>Authentication with the SYSDBA Privilege use:<br \/>\n<code>$ rman target ' \"\/ as sysdba\" '<\/code><\/p>\n<p>You can also implicitly connect using below command<br \/>\n<code>$ rman target \/<\/code><\/p>\n<p>To Connect to RMAN using Password file Authentication Authentication with the SYSBACKUP Privilege use:<br \/>\n<code>$ rman target1 \u2018 \u201cbkpadm@DB1 as sysbackup\u201d \u2018<\/code><\/p>\n<p><b>Where bkpadm is the user and should have SYSDBA privilege.<\/b><\/p>\n<p>Authentication with the SYSDBA Privilege<br \/>\n<code>$ rman target \u2018 \u201csysadm@DB1 as sysdba\u201d \u2018<\/code><\/p>\n<p>You can implicitly connect using below command. Where sysadm is the user and should have SYSDBA privilege.<br \/>\n<code>$ rman target sysadm@DB1<\/code><\/p>\n<p>Note that SYSBACKUP does not include data access privilege, such as SELECT ANY TABLE. When you don\u2019t specify the role explicitly then the default used is AS SYSDBA.<\/p>\n<h2>Support for multitenant container and pluggable databases<\/h2>\n<p>The multitenant container database (CDB) and pluggable databases (PDB) are introduced in Oracle 12c, and RMAN provides full support for backup and recovery. Using 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.<\/p>\n<p>The multitenant architecture manages many databases as one and retains the isolation, resource control of each database. This will help to manage both infrastructure and human resources effectively.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5209\" alt=\"containerdatabase\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/oracle\/2014\/09\/containerdatabase.png\" width=\"280\" height=\"134\" \/><\/p>\n<p>Backing up a container database is similar to backing up a non-container database. When you back up a container database, RMAN backs up the root, pluggable databases in the container, and archive logs.\u00a0 When you need to restore you can choose the whole container, one or more pluggable databases or the root only.<\/p>\n<h3>Backup the CDB, PDB, and root<\/h3>\n<p>You should have SYSBACKUP or SYSDBA privilege to backup any of the databases.<\/p>\n<p>You can backup the <b>Container Database (CDB)<\/b> as same as non-container database using below command:<br \/>\n<code>RMAN&gt; BACKUP DATABASE plus ARCHIVELOG;<\/code><\/p>\n<p>You can backup the <b>Pluggable Database (PDB)<\/b> using below command:<br \/>\n<code>RMAN&gt; BACKUP PLUGGABLE DATABASE PDB1, PDB2;<\/code><\/p>\n<p>Or connect to pluggable Database in RMAN :<br \/>\n<code>% rman target sys@PDB1<br \/>\nRMAN&gt; BACKUP DATABASE;<\/code><\/p>\n<p>You can backup the <b>root<\/b> using below command:<br \/>\n<code>RMAN&gt; BACKUP DATABASE ROOT;<\/code><\/p>\n<h3>Complete recovery of CDB, PDB and root<\/h3>\n<p>You should have SYSBACKUP or SYSDBA privilege to restore any of the databases.<br \/>\n<b>Restoring Container Database (CDB)<\/b> is similar to non-container database.<br \/>\nYou can restore the whole CDB using below script:<\/p>\n<pre>RMAN&gt; RUN { \r\n     STARTUP MOUNT;\r\n     RESTORE DATABASE;\r\n     RECOVER DATABASE;\r\n     ALTER DATABASE OPEN;\r\n}<\/pre>\n<p>Note that restoring CDB database will restore all the pluggable databases.<br \/>\nYou can <b>restore only ROOT <\/b>Database using below script:<\/p>\n<pre>RMAN&gt; RUN {\r\n     STARTUP MOUNT;\r\n     RESTORE DATABASE ROOT;\r\n     RECOVER DATABASE ROOT;\r\n     ALTER DATABASE OPEN;\r\n}<\/pre>\n<p>You can <b>restore Pluggable Databases<\/b> in two ways. Either you can restore from root container and connect directly to PDB to restore.<\/p>\n<p>Use below script to restore from root. Using this approach you can able to restore and recover multiple PDB\u2019s with a single command.<\/p>\n<pre>RMAN &gt; RUN {\r\n     RESTORE PLUGGABLE DATABASE PDB1, PDB2;\r\n     RECOVER PLUGGABLE DATABASE PDB1, PDB2;\r\n     ALTER PLUGGABLE DATABASE PDB1, PDB2 OPEN;\r\n}<\/pre>\n<p>Use below script to connect PDB, restore and recover the database. Using this approach you will be able to restore and recover <b>only<\/b> one PDB.<\/p>\n<pre>$ rman target=bkpadm@PDB1\r\n     RMAN&gt; run{\r\n     RESTORE DATABASE;\r\n     RECOVER DATABASE;\r\n}<\/pre>\n<p>The steps for performing a point-in-time recovery of the CDB or PDB are the same as a normal database. But note that when you perform Point-in-time recovery on the CDB, it will effect on all the PDBs as well.<\/p>\n<p>When you perform point-in-time recovery on a PDB, it will affect that single database.<br \/>\nThe command to perform a point-in-time recovery is:<\/p>\n<pre>SET UNTIL TIME \"TO_DATE(\u201901-Jan-2014 01:00:00\u2019,\u2019DD-MON-YYYY HH24:MI:SS\u2019)\";\r\nSET UNTIL SCN 1999945; # alternatively, specify SCN\r\nSET UNTIL SEQUENCE 100; # alternatively, specify log seq<\/pre>\n<p>You can refer below URL for point-in-time recovery using RMAN: <a href=\"http:\/\/www.oracleracexpert.com\/2009\/11\/how-to-restore-database-to-point-in.html\">http:\/\/www.oracleracexpert.com\/2009\/11\/how-to-restore-database-to-point-in.html<\/a><\/p>\n<p>Below are the few examples to ALTER PLUGGABLE DATABASE.<\/p>\n<ul>\n<li>Use this command to open all PDBs in one command:<br \/>\n<code>ALTER PLUGGABLE DATABASE ALL OPEN;<\/code><\/li>\n<li>Use this command to open all PDBs except PDB3:<br \/>\n<code>ALTER PLUGGABLE DATABASE ALL EXCEPT PDB3 OPEN;<\/code><\/li>\n<li>Use this command to open PDB4,PDB5 in read only mode:<br \/>\n<code>ALTER PLUGGABLE DATABASE PDB4, PDB5 OPEN READ ONLY;<\/code><\/li>\n<li>Use below command to shut down all PDBs in single command:<br \/>\n<code>ALTER PLUGGABLE DATABASE ALL CLOSE IMMEDIATE;<\/code><\/li>\n<\/ul>\n<h3>Backup of Archived redo logs<\/h3>\n<p>You can back up archive logs when they connect to root as a <i>common<\/i> user with SYSDBA or SYSBACKUP privilege, but you cannot back up or delete archive logs when you connect to PDB as a <i>local<\/i> user with SYSDBA or SYSBACKUP privilege.<\/p>\n<p>You are only able to switch the archived logs when you connect to the root of a CDB, but you cannot switch archived redo logs when connected to a PDB.<\/p>\n<p>If you have more than one archive log destination, when you use RMAN 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.<\/p>\n<p>You can use any of the below commands to backup the archived redo logs<br \/>\nThe command below backs up the database and all the archived redo logs:<br \/>\n<code>RMAN &gt; BACKUP DATABASE PLUS ARCHIVELOG;<\/code><\/p>\n<p>The command below only backs up one copy of the sequence number for all archived redo logs.<br \/>\n<code>RMAN&gt; BACKUP ARCHIVELOG ALL;<\/code><\/p>\n<h2>DUPLICATE enhancements:<\/h2>\n<p>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 \u201cNOOPEN\u201d clause.<\/p>\n<p>This NOOPEN clause useful under following situations:<\/p>\n<ul>\n<li>If you need to make changes to initialization parameters such as block change tracking, flashback database settings<\/li>\n<li>Opening the database conflict with other source database<\/li>\n<li>If you plan to create database for upgrade and want to open in upgrade mode<\/li>\n<\/ul>\n<p>The command below creates duplicate database, but it will not open.<br \/>\n<code>RMAN&gt; DUPLICATE TARGET DATABASE TO DB1<br \/>\nFROM ACTIVE DATABASE NOOPEN;<\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>Oracle Database 12c offers new enhancements and additions in Recovery Manager (RMAN).\u00a0 Take the advantage of new features for efficient backup &amp; recovery.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oracle Database 12c has new enhancements and additions in Recovery Manager (RMAN).\u00a0 The Recovery Manager continues to enhance and extend the reliability, efficiency, and availability of Oracle Database Backup and Recovery. In this article series, I will be explaining the new features and how it will help Oracle community. In this article I will cover: SQL Interface Improvements SYSBACKUP Privileg&hellip;<\/p>\n","protected":false},"author":316203,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143533],"tags":[48492,48521,48522],"coauthors":[],"class_list":["post-73185","post","type-post","status-publish","format-standard","hentry","category-oracle-databases","tag-rman","tag-sysbackup","tag-sysdba"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/73185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/316203"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=73185"}],"version-history":[{"count":1,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/73185\/revisions"}],"predecessor-version":[{"id":91673,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/73185\/revisions\/91673"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=73185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=73185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=73185"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=73185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}