Oracle使用RMAN进行备份详述(2)

完整备份包含每个文件中每个使用过的块。增量备份只有自上一次备份以前改变的块。增量备份策略必须从一个完整备份开始,之后可以有随意多次增量备份,但还原总是需要先还原完整备份(称为0级备份),再应用增量备份,使文件保持最新。只有进行了新的0级备份,才能丢弃以前的备份。

RMAN基本语法

RMAN可执行程序在操作系统提示行上的命令:

rman target / rman target sys/oracle rman target sys/oracle@orclz

所有3个命令都以具备SYSDBA权限的用户身份登录到目标数据库上。在第一个命令中,目标是一个运行在同一台机器上的本地数据库实例,该机器用ORACLE_SID环境变量标识,用户用其操作系统账户进行身份验证。第二个例子也连接一个本地数据库实例,但使用数据库密码文件来验证身份。第三个例子使用tnsnames服务名,通过网络连接一个远程数据库,它也使用密码文件来验证身份。

1.在非归档日志模式下备份

使用RMAN进行关闭的完整备份

[oracle@linuxidc ~]$ rman target / Recovery Manager: Release 11.2.0.1.0 - Production on 鏄熸湡涓€ 4鏈?8 20:26:52 2019 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: PROD (DBID=292420020) RMAN> shutdown immediate; using target database control file instead of recovery catalog database closed database dismounted Oracle instance shut down RMAN> startup mount connected to target database (not started) Oracle instance started database mounted Total System Global Area 523108352 bytes Fixed Size 1337632 bytes Variable Size 394266336 bytes Database Buffers 121634816 bytes Redo Buffers 5869568 bytes RMAN> backup database; Starting backup at 2019-04-08 20:28:01 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=18 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/oradata/prod/system01.dbf input datafile file number=00002 name=/u01/oradata/prod/sysaux01.dbf input datafile file number=00003 name=/u01/oradata/prod/undotbs01.dbf input datafile file number=00005 name=/u01/oradata/prod/example01.dbf input datafile file number=00004 name=/u01/oradata/prod/users01.dbf channel ORA_DISK_1: starting piece 1 at 2019-04-08 20:28:03 channel ORA_DISK_1: finished piece 1 at 2019-04-08 20:29:08 piece handle=/u01/flash_recovery_area/PROD/backupset/2019_04_08/o1_mf_nnndf_TAG20190408T202802_gbphlm1z_.bkp tag=TAG20190408T202802 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 2019-04-08 20:29:09 channel ORA_DISK_1: finished piece 1 at 2019-04-08 20:29:10 piece handle=/u01/flash_recovery_area/PROD/backupset/2019_04_08/o1_mf_ncsnf_TAG20190408T202802_gbphnor0_.bkp tag=TAG20190408T202802 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2019-04-08 20:29:10 RMAN> alter database open; database opened RMAN> exit Recovery Manager complete. [oracle@linuxidc ~]$

2.归档日志模式下的备份可能性

下面是一些简单的备份命令:

BACKUP DATAFILE 1,2;

BACKUP TABLESPACE USERS,EXAMPLE;

BACKUP CURRENT CONTROLFILE;

BACKUP DATABASE;

BACKUP ARCHIVELOG ALL;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9d621004b2278183f8bd2426f2449a98.html