Search This Blog

Thursday, 13 October 2016

12C RMAN: New Features


12C RMAN: New Features

            RMAN provides backup and recovery of multitenant container databases (CDBs), which are introduced in Oracle Database 12c Release 1 (12.1). This support includes backup and point-in-time recovery of specified pluggable databases (PDBs).

            You can now issue most SQL commands in RMAN without preceding the command with the SQL keyword. You no longer need to enclose the SQL command in quotes, which greatly simplifies the syntax when the SQL command itself requires quotation marks.

            You can take the backup of multiple pluggable databases (pdb) at a time.

Commands:

RMAN> select name,status from v$database,v$instance;


RMAN> alter tablespace users add datafile size 20m;


RMAN>
backup pluggable database sales;

RMAN> backup pluggable database sales, hr_pdb;       (backup of two pdbs in a single command)

RMAN> list backup of pluggable database sales;

RMAN> backup pluggable database rep datafile 1;

RMAN> restore pluggable database rep;

RMAN> restore database root;

RMAN>recover pluggable database ‘pdb$seed’;           (we can also recover seed pdb)

RMAN> recover database root;

RMAN> select * from tab;

RMAN> alter pluggable database datafile 4 offline;

Creating a User:

SQL> create user c##user1 identified by user1;

SQL>grant connect, resource to c##user1;

SQL>conn c##user1/user1;

 

Relocating a datafile without making it Offline:

SQL> select tablespace_name,file_name from cdb_data_files where con_id=1;

SQL> alter database move datafile '/u01/prod/users01.dbf' TO '/u02/data/users01.dbf';

SQL> alter database move datafile '/u01/prod/users01.dbf' ' to '+dg1';

Making columns Invisible:
SQL> CREATE TABLE emp (eno number(6), ename name varchar2(40),sal number(9) INVISIBLE);

Making columns Visible
SQL> ALTER TABLE emp MODIFY (sal visible);
 
Multiple indexes on the same columns:
 
SQL> create index sales_ind1 on sales(sales_id,sales_name);
SQL> create bitmap index cust_ind1 on Customer(Cust_id,Cust_name) INVISIBLE;

Restricting PGA size:


SQL> alter system set pga_aggregate_limit=1g;
SQL> alter system set pga_aggregate_limit=0;           --disables the hard limit
 
                               RMAN Table Recovery
 
RMAN> RECOVER TABLE 'TEST'.'T1' UNTIL Timestamp('12:32:21 21-may-14’) 
            AUXILIARY DESTINATION '/u01/aux'
            DATAPUMP DESTINATION '/u01/export'
            DUMP FILE 'test_t1_prev.dmp';
 
Exporting View as Table:
 
$ expdp system views_as_tables=scott.emp_view directory=exp dumpfile=emp_view.dmp logfile=emp_view_exp.log
 
$impdp system remap_schema=scott:amitbans directory=imp dumpfile=emp_view.dmp logfile=emp_view_imp.log
 
 

No comments:

Post a Comment