由于12c有CDB和PDB的概念。rman在备份使用上会有点区别。

 

备份:

1.备份全部的数据库(包括CDB)

[oracle@ora12c ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 14:42:27 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)


RMAN> BACKUP DATABASE;

 

2.只备份CDB

[oracle@ora12c ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 14:46:10 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> BACKUP DATABASE ROOT;

 

3.只备份PDB(一个或多个)

单个CDB备份:

[oracle@ora12c ~]$ rman target=sys/oracle@pdb1

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 14:48:00 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> BACKUP DATABASE;

或者

[oracle@ora12c ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 14:48:46 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> BACKUP PLUGGABLE DATABASE pdb1;

 

 

多个CDB备份:

[oracle@ora12c ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 14:49:29 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> BACKUP PLUGGABLE DATABASE pdb1,pdb2;

 

 

4.只备份其中的某一个表空间

     这个和原来的没啥区别,只需要rman登入要备份那个数据库就行了。

[oracle@ora12c ~]$ rman target=sys/oracle@pdb1

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 14:53:54 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> BACKUP TABLESPACE users;

 

 

还原:

 

1.全部数据库还原

[oracle@ora12c ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 15:11:23 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> run
2> {
3> startup mount;
4> restore database;
5> recover database;
6> alter database open;
7> }

 

2.只CDB还原

[oracle@ora12c ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 15:12:41 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> run
2> {
3> startup mount;
4> restore database root;
5> recover database root;
6> alter database open;
7> }

 

3.只PDB还原(一个或者多个)

[oracle@ora12c ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Jan 23 15:20:14 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADBCA (DBID=261209273)

RMAN> run
2> {
3> alter pluggable database pdb1, pdb2 close;
4> restore pluggable database pdb1, pdb2;
5> recover pluggable database pdb1, pdb2;
6> alterpluggable database pdb1, pdb2 open;
7> }