ORACLE RMAN增量备份完整恢复测试
1.创建测试环境:
1.1.创建测试表空间
SQL> create tablespace tablespace1 datafile ‘/data/u01/app/oracle/oradata/orcl/tablespace1.dbf’ size 10m;
SQL>
1.2.创建测试用户并指定为默认表空间:
SQL> create user user1 identified by oracle default tablespace tablespace1;
SQL>
1.3.设置该测试用户权限:
SQL> grant create session,create table,unlimited tablespace to user1;
Grant succeeded.
SQL>
1.4.用新创建的用户登录:
SQL> conn user1/
Enter password:
Connected.
SQL>
1.5.建表并写入数据:
SQL> create table table1 (id int,name varchar2(30));
Table created.
SQL> insert into table1 values(0001,‘Tian’);
1 row created.
SQL> insert into table1 values(0002,‘zhong’);
1 row created.
SQL> select * from table1;
ID NAME
1 Tian
2 zhong
SQL> commit;
Commit complete.
2.配置RMAN环境变量
登录rman
rman target/
切换sys用户作0级备份:
利用configure命令配置RMAN环境:
#开启归档日志自动备份
RMAN>CONFIGURE CONTROLFILE AUTOBACKUP ON;
#指定归档日志备份位置
RMAN>CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/data/u01/bak/ctf/%d_ctf_bak_%F’;
#采用并行度为2且压缩备份集的方式备份到磁盘
RMAN>CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
RMAN>CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT’/data/u01/bak/disk1/%d_datafile_bak_%U’;
RMAN>CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT’/data/u01/bak/disk2/%d_datafile_bak_%U’;
RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP