一、源端環境檢查
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
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/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