一、源端环境检查
SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
select FORCE_LOGGING from v$database;
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER DATABASE FORCE LOGGING;
二、重新添加trandata
ggsci
dblogin userid ogg,password ogg
delete trandata owner.*
add trandata owner.*
info trandata owner.*
三、源端数据库备份
Select start_time from gv$transaction where
to_date(start_time, yyyy-mm-dd hh24:mi:ss)<to_date(2019-
03-28 10:20:55, yyyy-mm-dd hh24:mi:ss);
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
allocate channel c6 type disk;
allocate channel c7 type disk;
allocate channel c8 type disk;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
backup database format /backup/db_%U.bak;
backup archivelog format /backup/arc_%U.bak;
backup current controlfile format /backup/controlfile.bak;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
release channel c8;
}
四、目标端进行数据库恢复
recover database
五、目标端添加复制进程
六、源端检查联机日志
select MAX(first_change#)
from v$log
where status=INACTIVE
and ARCHIVED=YES;
七、目标端不完全恢复数据库
run
{
SET UNTIL SCN 11294270011522
RECOVER DATABASE;
}
Alter database open resetlogs
八、目标端数据库调整
SQL> declare
v_sql varchar2(2000);
CURSOR c_trigger IS SELECT alter trigger ||owner||.||trigger_name|| disable ; from dba_triggers where owner in (schema);
BEGIN
OPEN c_trigger;
LOOP
FETCH c_trigger INTO v_sql;
EXIT WHEN c_trigger%NOTFOUND;
execute immediate v_sql;
end loop;
close c_trigger;
end;
/
SQL> declare
v_sql varchar2(2000);
CURSOR c_trigger IS SELECT alter table ||owner||.||table_name|| disable constraint ||constraint_name from dba_constraints where constraint_type=R and owner in (schema);
BEGIN
OPEN c_trigger;
LOOP
FETCH c_trigger INTO v_sql;
EXIT WHEN c_trigger%NOTFOUND;
execute immediate v_sql;
end loop;
close c_trigger;
end;
/
SQL>declare
v_jobname varchar2(50);
err_code NUMBER;
ERR_MSG VARCHAR2(256);
CURSOR c_trigger IS
select owner || . || job_name
from dba_scheduler_jobs
where owner in (SCHEMA1, SCHEMA2)
and enabled = TRUE;
BEGIN
OPEN c_trigger;
LOOP
FETCH c_trigger
INTO v_jobname;
EXIT WHEN c_trigger%NOTFOUND;
begin
dbms_scheduler.disable(v_jobname);
exception
when others then
NULL;
err_code := SQLCODE;
err_msg := substr(SQLERRM, 1, 200);
dbms_output.put_line(sqlcode || -- || sqlerrm);
dbms_output.put_line(v_jobname);
end;
end loop;
close c_trigger;
end;
/
SELECT exec dbms_job.broken( ||JOB||,true); from dba_jobs s where s.BROKEN=N and s.SCHEMA_USER=schema;
九、目标端启动复制进程
start rep_01, aftercsn 11294270011522
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/129617.html
pg_rman备份工具(下) img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; marg...
阅读 1346·2023-01-11 13:20
阅读 1684·2023-01-11 13:20
阅读 1132·2023-01-11 13:20
阅读 1858·2023-01-11 13:20
阅读 4100·2023-01-11 13:20
阅读 2704·2023-01-11 13:20
阅读 1385·2023-01-11 13:20
阅读 3597·2023-01-11 13:20