Tag Archives: rman

rman 在oracle 12c的备份还原

0

Posted on by

  由于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> }

 

RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file

0

Posted on by

在物理备库上更改rman的 RETENTION POLICY参数报下面的错:

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 366 DAYS;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 05/07/2013 13:31:48
RMAN-05021: this configuration cannot be changed for a BACKUP or STANDBY control file

 

mos:有2个解决方案:

1.现在主库上修改,然后重建备库的控制文件

2.直接用rman手动删除过期的备份文件

 

 

具体如下:

 

 

Option 1 :- Recreate standby controlfile from Primary

Once the Retention policy has been changed in Primary. Recreate the Standby controlfile from the Primary.

On the primary database, create the control file for the standby database, as shown in the following example:


SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/disk1/oracle/oradata/standby/payroll2.ctl';

On standby renaming the existing standby controlfile .

Now Copy the new standby controlfile from primary  to standby server in same location and name where it existed on standby database. if copying to different location make changes pfile/spfile to point to new this standby controlfile.

Mount the standby database and check the location of datafile and logfiles are pointing to standby location and not production .

 

Now do

 

Rman> Show retention policy ;

 

 

 

 

Option 2 : – Use Delete obsolete option

 This option doesnot change the retention policy in Rman configuration.

 Its a Temporary workaround at run time.

You can use the following option to Delete Obsolete backups on Standby

On Standby

 

Rman>Connect target /

Rman> delete noprompt obsolete recovery window of 14 days

If you want rman to prompt the backuppiece name before delete run

 

Rman> delete  obsolete recovery window of 14 days

 

rac环境在rman备份出现ORA-00245

1

Posted on by

版本

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

数据库在rman备份的时候出现如下错误:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================

RMAN-03009: failure of backup command on ch1 channel at 04/19/2013 18:04:39
ORA-00245: control file backup failed; target is likely on a local file system

 

错误原因

快照控制文件必须要被所有节点访问,如果快照控制不是放在共享设备上,那么在RMAN 进行控制文件的快照备份时就会报错。

具体原文:

From 11gR2 onwards, the controlfile backup happens without holding the controlfile enqueue. For non-RAC database,
 this doesn't change anything. But for RAC database, due to the changes made to the controlfile backup mechanism in 
11gR2, any instance in the cluster may write to the snapshot controlfile. Due to this snapshot controlfile need to 
be visible to all instances. 


The snapshot controlfile MUST be accessible by all nodes of a RAC database, if the snapshot controlfile does not 
reside on a shared device error will be raised at the time of RMAN backup while taking snapshot of controlfile. 

This applies to backing up controlfile using sqlplus / having autobackup of controlfile configured on non shared location.

解决方法:

1. Check the snapshot controlfile location:

RMAN> show snapshot controlfile name;

2. Configure the snapshot controlfile to a shared disk:

RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '<shared_disk>/snapcf_<DBNAME>.f';

Or in case of ASM use

RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+<DiskGroup>/snapcf_<DBNAME>.f';

 

参考:In RAC environment from 11.2 onwards Backup Or Snapshot controlfile needs to be in shared location [ID 1472171.1]