1.检查scn


备库执行:


查看备库的scn

select to_char(current_scn) from v$database;



#######

TO_CHAR(CURRENT_SCN)

----------------------------------------

3565755424

########


查看数据文件头的最小的scn:

select min(checkpoint_change#) from v$datafile_header

where file# not in (select file# from v$datafile where enabled = 'READ ONLY');



MIN(CHECKPOINT_CHANGE#)

-----------------------

            3565755425


2.主库创建控制文件


主库执行:

-----------------------------------------------------------------------------------------

主库创建控制文件

alter database create standby controlfile as '/路径.ctl';


###################

alter database create standby controlfile as '/home/oracle/XXXXctl.ctl';

###################################


备库执行:

-----------------------------------------------------------------------------------------

复制到备库

并将备库启动到nomount状态(shutdown immediate,startup nomount)


备库进行操作

rman target /

restore controlfile from '控制文件路径';


###########################


restore controlfile from '/home/oracle/XXXXctl.ctl';


#################################################


备库启动到mount


rman下

sql 'alter database mount';





3.主库创建增量文件


主库执行:

----------------------------------------------------------------------------------------

主库根据scn号进行增量备份

run{

allocate channel c1 type disk;

allocate channel c2 type disk;

backup INCREMENTAL from scn  scn号 database format '/路径/incre_%U';

release channel c1;

release channel c2;

}


#######实操记录

run{

allocate channel c1 type disk;

allocate channel c2 type disk;

backup INCREMENTAL from scn  3565755424 database format '/home/oracle/XXXXscn/incre_%U';

release channel c1;

release channel c2;

}

#######


########


run{

allocate channel c1 type disk;

allocate channel c2 type disk;

backup INCREMENTAL from  scn 1109465180 database format '/home/oracle/XXXXzbdata/incre_%U';

release channel c1;

release channel c2;

}


##########




4.数据应用



备库执行:

------------------------------------------------------------------------------------

将该文件夹下数据复制到备库

注册备份集


将新数据文件路径进行注册

catalog start with '/home/oracle/XXXXscn';


将旧数据文件路径进行注册

CATALOG START WITH '+data/XXXXADG/DATAFILE';

SWITCH DATABASE TO COPY;








###############################


catalog start with '/home/oracle/XXXXzbdata/';


#############################################


rman下

recover database noredo;


database下

alter database open;


应用日志

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;