oracle 19c RAC到单机ogg部署安装

源端(RAC)目标端(FS)
IP192.168.40.30/31192.168.40.50
数据库版本Oracle 19.3.0Oracle 19.3.0
主机名hfdb30/hfdb31hfogg
操作系统REHL7.6REHL7.6
数据库实例hfdb1/hfdb2hfogg
同步用户hfdb1hfdb1
同步表testtest
OGG版本19.1.0.0.419.1.0.0.4

上传并安装 OGG 软件

#在两台ogg设备上都创建目录
mkdir /ggs
mount /dev/mapper/backvg-backuplv /ggs
vi /etc/fstab
chown -R oracle:dba /ggs
chmod -R 777 /ggs
源端:vim .bash_profile
##原有配置不变,增加 ogg 相关路径
export OGG_HOME=/ggs
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:$OGG_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

目标端:vim .bash_profile
##原有配置不变,增加 ogg 相关路径
export OGG_HOME=/ggs
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:$OGG_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

使环境变量生效
source .bash_profile

上传安装包并解压

下载地址:https://edelivery.oracle.com/

image-20241120091317098

源端和目标端都需上传

su - root

cd /backup

unzip V983658-01.zip

chown -R oracle:oinstall /backup/*

安装 OGG

图形化安装
  • 两种方式:
    • 安装vncserver
su - oracle
[oracle@hfdb30:/backup]$vncserver  #源端和目标端都要执行
[oracle@hfdb30:/backup]$cd /backup/fbo_ggs_Linux_x64_shiphome/Disk1
[oracle@hfdb30:/backup]$./runInstaller
  • 使用display
su - oracle
cd /backup/fbo_ggs_Linux_x64_shiphome/Disk1
export DISPLAY=192.168.40.50:0.0
./runInstaller

image-20241119185855423

image-20241119185922969

image-20241119190129768

在 Oracle 11g 及之前的版本中,安装完 OGG,需要使用 ggsci 工具执行 create subdirs 命令手动创建 OGG 对应的目录,在 12c 及以后版本中,目录自动创建,无需再手动执行 create subdirs 命令。

静默安装

cp /backup/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp ~/

编辑配置文件

#vim ~/oggcore.rsp
INSTALL_OPTION=ORA19c
SOFTWARE_LOCATION=/ggs
START_MANAGER=true
MANAGER_PORT=7809
DATABASE_LOCATION=/oracle/app/oracle/product/19.3.0/dbhome_1
INVENTORY_LOCATION=/oracle/app/oraInventory
UNIX_GROUP_NAME=oinstall

开始安装

cd /u01/soft/fbo_ggs_Linux_x64_shiphome/Disk1/
./runInstaller -silent -nowait -responseFile ~/oggcore.rsp

ogg 配置运行环境准备

01.源端一定要打开归档,目标端一般不需要。

02.源数据库打开补充日志

03.源端开启 force_logging

04.源端关闭回收站功能(下次重启生效,10g 要关,11g 手册说不用关了)

05.修改数据库参数(源端、目标端)

alter system set enable_goldengate_replication=true; 

06.源和目标网络通讯正常。

07.创建专用的 goldengate 用户用来同步数据(源端、目标端)。

源端一定要打开归档,目标端一般不需要。

创建一个归档目录并授权

[oracle@hfdb30:/home/oracle]$mkdir /oracle/archive
[oracle@hfdb30:/home/oracle]$chown -R oracle:dba /oracle/archive
[oracle@hfdb30:/home/oracle]$chmod -R 777 /oracle/archive
SQL> show parameter recovery
SQL> alter system set db_recovery_file_dest_size=100g;
SQL> alter system set db_recovery_file_dest='/oracle/archive';
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list
SQL> alter system switch logfile;  --【alter system archive log current; 】

源数据库打开补充日志

SQL> select supplemental_log_data_min from v$database;  --【no 就是没有打开】
SQL> alter database add supplemental log data;
SQL> select supplemental_log_data_min from v$database; --【YES】
#检查下归档日志,归档日志正常切换说明就成功了
SQL> alter system switch logfile;

源端开启 force_logging 【强制日志】

SQL> select force_logging from v$database; --【no】
SQL> alter database force logging; 
SQL> select force_logging from v$database; --【YES】
SQL> **alter system switch logfile;**

启用 OGG(源端、目标端)

ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION = TRUE SCOPE=BOTH; #源端和目标端都要做

源端关闭回收站功能(下次重启生效)

SQL> show parameter recyclebin
SQL> alter system set recyclebin=off scope=spfile;
SQL> shutdown immediate
SQL> startup

查看配置结果

select log_mode,supplemental_log_data_min,force_logging from v$database;  #archivelog  yes  yes

源和目标网络通讯正常。

配置hosts (非必须)

[root@hfdb30 ~]# cat /etc/hosts --添加另外一台主机名和IP

[root@hfdb31 ~]# cat /etc/hosts --添加另外一台主机名和IP

[root@hfogg ~]# cat /etc/hosts --添加另外一台主机名和IP

[root@hfdb30 ~]# ping hfogg

[root@hfogg ~]# ping hfdb30

配置tnsname

[oracle@hfdb30:/oracle/app/oracle/product/19c/db_1/network/admin]$vi tnsnames. ora

# tnsnames.ora Network Configuration File: /oracle/app/oracle/product/19c/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

DGHFDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.40)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dghfdb)
    )
  )

HFDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hfdbscan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = hfdb)
    )
  )

HFOGG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.50)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = hfogg)
    )
  )

[oracle@hfogg:/oracle/app/oracle/product/19c/db_1/network/admin]$vi tnsnames.ora

# tnsnames.ora Network Configuration File: /oracle/app/oracle/product/19c/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_HFOGG =
  (ADDRESS = (PROTOCOL = TCP)(HOST = hfogg)(PORT = 1521))


HFOGG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hfogg)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = hfogg)
    )
  )

HFDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.32)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = hfdb)
    )
  )

[oracle@hfogg:/oracle/app/oracle/product/19c/db_1/network/admin]$tnsping hfdb

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 19-NOV-2024 19:27:45

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.32)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hfdb)))
OK (10 msec)
[oracle@hfogg:/oracle/app/oracle/product/19c/db_1/network/admin]$

[oracle@hfdb30:/oracle/app/oracle/product/19c/db_1/network/admin]$tnsping hfogg

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 19-NOV-2024 19:28:29

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.50)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hfogg)))
OK (0 msec)
[oracle@hfdb30:/oracle/app/oracle/product/19c/db_1/network/admin]$

创建专用的 goldengate 用户用来同步数据

(源端和目标端都要执行)

#在rac节点hfdb30上面执行
create tablespace ogg_tbs datafile 
'+dgsystem1' size 50m autoextend 
	on next 10m maxsize 1024m extent management local segment space management auto; 
	
create user goldengate identified by goldengate default tablespace ogg_tbs temporary tablespace temp quota unlimited on users ; 
grant connect to goldengate; 
grant alter any table to goldengate; 
grant alter session to goldengate; 
grant create session to goldengate; 
grant flashback any table to goldengate; 
grant select any dictionary to goldengate; 
grant select any table to goldengate; 
grant resource to goldengate; 
grant drop any table to goldengate; 
grant dba to goldengate;

#在目标库hfogg上面执行
create tablespace ogg_tbs datafile '/oradata/hfogg/ogg.dbf' size 50m autoextend on next 10m maxsize 1024m extent management local segment space management auto; 
	
create user goldengate identified by goldengate default tablespace ogg_tbs temporary tablespace temp quota unlimited on users ; 
grant connect to goldengate; 
grant alter any table to goldengate; 
grant alter session to goldengate; 
grant create session to goldengate; 
grant flashback any table to goldengate; 
grant select any dictionary to goldengate; 
grant select any table to goldengate; 
grant resource to goldengate; 
grant drop any table to goldengate; 
grant dba to goldengate;

ogg源端配置过程

ogg 的配置过程(源端)

配置管理进程 mgr
[oracle@hfogg:/ggs]$ggsci
ggsci> CREATE SUBDIRS --【安装中没有勾选,这里需要创建目录】

--01.配置管理进程 mgr 
ggsci> edit params mgr 
port 7809 
autostart er * 
autorestart er *,waitminutes 3,retries 15 
purgeoldextracts ./dirdat/*,usecheckpoints,minkeepdays 7 

ggsci>start mgr

*/
其他可加的参数含义
##########################
/*
DYNAMICPORTLIST 7810-7820
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
ACCESSRULE,PROG *,IPADDR 192.168.*.*,ALLOW

----参数含义
PORT:默认监听端口
DYNAMICPORTLIST:动态端口列表的范围,当指定端口被占用或者出现通 信故障,管理进程将会从列表中选择下一个端口尝试连接,避免通信端口的单点故障。
AUTORESTART:当提取进程中断后尝试自动重启,每隔 3 分钟尝试启动一次,尝试 15 次。
PURGEOLDEXTRACTS:定期清理 dirdat 路径下的本地队列(local trail)。保留期限 7 天,过期后自动删除。
LAGREPORTHOURS:每隔一小时检查一次传输延迟情况
LAGINFOMINUTES:传输延时超过 30 分钟将写入错误日志
LAGCRITICALMINUTES:传输延时超过 45 分钟将写入警告日志
#操作日志
[oracle@hfdb30:/home/oracle]$ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:29
Operating system character set identified as US-ASCII.

Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.



GGSCI (hfdb30) 1> CREATE SUBDIRS

Creating subdirectories under current directory /home/oracle

Parameter file                 /ggs/dirprm: already exists.
Report file                    /ggs/dirrpt: already exists.
Checkpoint file                /ggs/dirchk: already exists.
Process status files           /ggs/dirpcs: already exists.
SQL script files               /ggs/dirsql: already exists.
Database definitions files     /ggs/dirdef: already exists.
Extract data files             /ggs/dirdat: already exists.
Temporary files                /ggs/dirtmp: already exists.
Credential store files         /ggs/dircrd: already exists.
Masterkey wallet files         /ggs/dirwlt: already exists.
Dump files                     /ggs/dirdmp: already exists.


GGSCI (hfdb30) 2> edit params mgr 

GGSCI (hfdb30) 3> start mgr
MGR is already running.

GGSCI (hfdb30) 4> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING

配置检查点

ggsci> edit params ./GLOBALS 
  checkpointtable goldengate.checkpoint 
ggsci> dblogin userid goldengate,password goldengate 
ggsci> add checkpointtable goldengate.checkpoint 
GGSCI (hfdb30) 6> edit params ./GLOBALS


GGSCI (hfdb30) 7> dblogin userid goldengate,password goldengate
Successfully logged into database.

GGSCI (hfdb30 as goldengate@hfdb1) 8> add checkpointtable goldengate.checkpoint

Successfully created checkpoint table goldengate.checkpoint.

GGSCI (hfdb30 as goldengate@hfdb1) 9>

在源端配置抽取进程 extract

cd /ggs 
mkdir -p ./dirdat/eitpux01 
mkdir -p ./dirrpt/eitpux01 


ggsci> edit params eitpux01 

  extract eitpux01 
  userid goldengate,password goldengate 
  exttrail ./dirdat/eitpux01/ex 
  tranlogoptions excludeuser goldengate 
  tranlogoptions dblogreader 
  warnlongtrans 12h,checkinterval 30m
  discardfile ./dirrpt/eitpux01/eitpux01.dsc,append,megabytes 200 
  TABLE hfdb1.*; 
  
  /*
extract ext_che
SETENV (ORACLE_SID="orcl1")
SETENV (NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8")
userid c##ogg,password 123456
DBOPTIONS ALLOWUNUSEDCOLUMN
DISCARDFILE ./dirrpt/ext_che.dsc, APPEND,MEGABYTES 1024
DISCARDROLLOVER AT 22:00 ON SUNDAY
EXTTRAIL ./dirdat/ch
GETTRUNCATES
WARNLONGTRANS 2H,CHECKINTERVAL 5M
FETCHOPTIONS NOUSESNAPSHOT
REPORTCOUNT EVERY 30 MINUTES, RATE
DDL INCLUDE MAPPED
DDLOPTIONS ADDTRANDATA
DDLOPTIONS REPORT
TABLE PDB1.CHE.REGIONS;
  
  
SETENV:配置 Oracle 环境变量
userid:登录 Oracle 数据库用户名和密码
DISCARDFILE:将执行失败的记录保存在 discard file 中,大小为 1024 MB,记录方式为追加。
DISCARDROLLOVER:为了防止 discard file 被写满,周日 2200 做一次文件过期设定
EXTTRAIL:队列文件路径
GETTRUNCATES:捕获源端 truncate table 的操作

2) 添加抽取进程
##sqlplus 中查询将上述的 scn 转换为时间点
select to_char(scn_to_timestamp(2375295), 'yyyy-mm-dd hh24:mi:ss') scndate from dual;
##根据指定时间点配置抽取进程
add extract ext_che, integrated tranlog,begin 2023-01-13 12:36:45
add exttrail ./dirdat/ch,extract ext_che
--添加一个抽取进程 
ggsci > add extract eitpux01,tranlog,begin now,threads 2 
--配置抽取队列文件 
ggsci > add exttrail ./dirdat/eitpux01/ex,extract eitpux01,megabytes 200 

启动停止测试

ggsci> start eitpux01 
ggsci> stop eitpux01 
ggsci> view report eitpux01 
GGSCI (hfdb30) 5> start eitpux01

Sending START request to MANAGER ...
EXTRACT EITPUX01 starting


GGSCI (hfdb30) 6> stop eitpux01
EXTRACT EITPUX01 is already stopped.


GGSCI (hfdb30) 7>  view report eitpux01


***********************************************************************
                 Oracle GoldenGate Capture for Oracle
    Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO
   Linux, x64, 64bit (optimized), Oracle 19c on Oct 17 2019 21:16:58

Copyright (C) 1995, 2019, Oracle and/or its affiliates. All rights reserved.

                    Starting at 2024-11-19 19:57:09
***********************************************************************

Operating System Version:
Linux
Version #1 SMP Thu Oct 4 20:48:51 UTC 2018, Release 3.10.0-957.el7.x86_64
Node: hfdb30
Machine: x86_64
                         soft limit   hard limit
Address Space Size   :    unlimited    unlimited
Heap Size            :    unlimited    unlimited
File Size            :    unlimited    unlimited
CPU Time             :    unlimited    unlimited

Process id: 6003

Description:

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************

2024-11-19 19:57:09  INFO    OGG-03059  Operating system character set identified as US-ASCII.

2024-11-19 19:57:09  INFO    OGG-02695  ANSI SQL parameter syntax is used for parameter parsing.
extract eitpux01
userid goldengate,password ***

Source Context :
  SourceModule            : [er.init]
  SourceID                : [er/init.cpp]
  SourceMethod            : [get_infile_params]
  SourceLine              : [6841]
  ThreadBacktrace         : [11] elements
                          : [/ggs/libgglog.so(CMessageContext::AddThreadContext())]
                          : [/ggs/libgglog.so(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...))]
                          : [/ggs/libgglog.so(_MSG_String(CSourceContext*, int, char const*, CMessageFactory::MessageDisposition))]
                          : [/ggs/extract()]
                          : [/ggs/extract()]
                          : [/ggs/extract(ggs::gglib::MultiThreading::MainThread::ExecMain())]
                          : [/ggs/extract(ggs::gglib::MultiThreading::Thread::RunThread(ggs::gglib::MultiThreading::Thread::ThreadArgs*))]
                          : [/ggs/extract(ggs::gglib::MultiThreading::MainThread::Run(int, char**))]
                          : [/ggs/extract(main)]
                          : [/lib64/libc.so.6(__libc_start_main)]
                          : [/ggs/extract()]

2024-11-19 19:57:12  ERROR   OGG-00303  Unable to connect to database using user goldengate. Ensure that the necessary privileges are granted to the user.
Operation not supported because enable_goldengate_replication is not set to true.

2024-11-19 19:57:12  ERROR   OGG-01668  PROCESS ABENDING.


GGSCI (hfdb30) 8>

在源端配置投递进程 pump

cd /ggs 
mkdir -p ./dirdat/ritpux01 
mkdir -p ./dirrpt/ritpux01 

ggsci> edit params pitpux01 
   extract pitpux01 
   userid goldengate,password goldengate 
   PASSTHRU 
   RMTHOST 192.168.40.50,MGRPORT 7809 
   rmttrail ./dirdat/ritpux01/re 
   discardfile ./dirrpt/ritpux01/ritpux01.dsc,append,megabytes 200 
   TABLE hfdb1.*; 


----参数含义
PASSTHRU:采用 pass-through 模式处理表,不登录到数据库
RMTHOST:目标端主机 IP,管理进程端口号,投递前压缩队列文件
RMTTRAIL:目标端保存队列文件的目录

–增加 pump 进程 (指定本地 trail 文件)

ggsci> add extract pitpux01,exttrailsource ./dirdat/eitpux01/ex 

–增加 rmttail 文件

ggsci> add rmttrail ./dirdat/ritpux01/re,extract pitpux01,megabytes 200 

–检查:

ggsci> info pitpux01

GGSCI (hfdb30) 4>  info pitpux01

EXTRACT    PITPUX01  Initialized   2024-11-19 20:06   Status STOPPED
Checkpoint Lag       00:00:00 (updated 00:01:08 ago)
Log Read Checkpoint  File ./dirdat/eitpux01/ex000000000
                     First Record  RBA 0

ogg 配置的过程(目标端)

配置目标端 mgr 管理

ggsci> edit params mgr 

  port 7809 
  autostart er * 
  autorestart er *,waitminutes 3,retries 15 
  purgeoldextracts ./dirdat/*,usecheckpoints,minkeepdays 7 

ggsci> start mgr

ggsci> info mgr

GGSCI (hfogg) 3> start mgr
MGR is already running.


GGSCI (hfogg) 4> info mgr

Manager is running (IP port TCP:hfogg.7809, Process ID 7564).

配置检查点

ggsci> edit params ./GLOBALS 
  checkpointtable goldengate.checkpoint 

 

ggsci> dblogin userid goldengate,password goldengate 

ggsci> add checkpointtable goldengate.checkpoint

配置复制进程 replicat (目标端) --用oracle用户

cd /ggs 
mkdir -p ./dirdat/ritpux01 
mkdir -p ./dirrpt/ritpux01 

ggsci> edit params ritpux01 
replicat ritpux01 
userid goldengate,password goldengate 
handlecollisions 
assumetargetdefs 
discardfile ./dirrpt/ritpux01/ritpux01.dsc,append,megabytes 200 
map hfdb1.*,target hfdb1.*; 

--添加 replicat 进程 
ggsci> add replicat ritpux01 exttrail ./dirdat/ritpux01/re,checkpointtable goldengate.checkpoint
GGSCI (hfogg) 3> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
REPLICAT    STOPPED     RITPUX01    00:00:00      00:00:13

ogg rac-expdp-impdp初始化

源端启动 extract 进程 (关键 1)

源和目标的 mgr 进程一定要先启动。

ggsci> start mgr

ggsci> start eitpux01 

ggsci> info all 

备份源端数据库(expdp)

注意一定要在抽取进程 启动后再进行数据库备份关键2

sql>select current_scn from v$database;
12345678
create directory hfbak as '/home/oracle';   --上步已经创建了,这里没有再操作了。
grant read,write on directory hfbak to system; 
grant create any directory to system; 
expdp system/oracle directory=hfbak dumpfile=expdp_hffs_m.dmp logfile=expdp_hffs_m.log  flashback_scn=12345678 schemas=hfdb1

把备份文件拷贝到目标库

scp 命令拷贝

在目标库恢复数据库(impdp)

create directory hfbak as '/home/oracle'; 
grant read,write on directory hfbak to system; 
grant create any directory to system; 
	
impdp system/oracle directory=hfbak dumpfile=expdp_hffs_m.dmp logfile=expdp_out_m.log  full=y table_exists_action=truncate
disable 目标库所有的 trigger、cascading delete 、check、 job
收集统计信息
[oracle@racdb1 backup]$ cat tjxjogg.sh 
#!/bin/sh
export ORACLE_SID=ora11g
export ORACLE_BASE=/u01/app/oracle/
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
$ORACLE_HOME/bin/sqlplus / as sysdba <<EOF > /backup/tjxjogg.log
SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') FROM DUAL; 
begin 
dbms_stats.gather_schema_stats(ownname=> '"WYY"' , 
cascade=> TRUE, 
estimate_percent=> null, 
degree=> 4,
no_invalidate=> DBMS_STATS.AUTO_INVALIDATE, 
granularity=> 'AUTO', 
method_opt=> 'FOR ALL COLUMNS SIZE AUTO', 
options=> 'GATHER'); 
end; 
/ 
SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
exit;
EOF
目标库匹配导入导出数据行数
[oracle@ expdp]$ grep " rows" expogg0908.log |sort -n| awk '{print $4,$7,$8}' 
|awk -F "." '{print $2}'> /tmp/exp.a
[oracle@expdp]$ grep " rows" impogg0908.log |sort -n| awk '{print 
$4,$7,$8}'|awk -F "." '{print $2}'> /tmp/imp.b
[oracle@racdb1 expdp]$ diff /tmp/exp.a /tmp/imp.b #此时没有结果输出说明导入导出数据行数一致
禁用目标库约束
#参数 owner_list 里面的用户名请根据实际情况修改
#禁用约束脚本如下:
racdb1:/home/oracle/ogg$cat disable_cascade.sql
set serveroutput on size 1000000
spool /home/oracle/disable_cascade.log
define owner_list=" in ('WYY','OGGWMS') "
declare
cursor c is SELECT A.OWNER, A.TABLE_NAME,A.CONSTRAINT_NAME, C.COLUMN_NAME, 
A.STATUS,A.DELETE_RULE,B.TABLE_NAME REFER_TABLE 
FROM dba_CONSTRAINTS A,dba_CONSTRAINTS B,dba_CONS_COLUMNS C
WHERE A.R_CONSTRAINT_NAME=B.CONSTRAINT_NAME 
AND A.CONSTRAINT_NAME=C.CONSTRAINT_NAME
AND A.status ='ENABLED'
AND A.delete_rule like '%CASCADE%'
 and A.owner &owner_list;
temp varchar2(512);
begin
 dbms_output.put_line('-- BEGIN ALTER TABLE DISABBLE CASCADE --');
 dbms_output.put_line('-- WAIT FOR A MONENT --');
 dbms_output.put_line('--...................--');
for x in c loop
 temp := 'ALTER TABLE "' || x.OWNER || '"."' || x.TABLE_NAME || '" DISABLE 
CONSTRAINT "'|| x.CONSTRAINT_NAME||'"';
 execute immediate temp;
 dbms_output.put_line('--DISABLE CONSTRAINT'|| 
x.OWNER||'.'||x.CONSTRAINT_NAME||' SUCCESSFUL--') ;
end loop;
 dbms_output.put_line('-- END ALTER TABLE DISABBLE CASCADE --');
end;
/
spool off
禁用目标库触发器
#参数 owner_list 里面的用户名请根据实际情况修改
#禁用触发器脚本如下:
racdb1:/home/oracle/ogg$cat disable_trigger.sql
set serveroutput on size 1000000
spool /home/oracle/disable_trigger.log
define owner_list=" in ('WYY','OGGWMS')"
declare
 cursor c is SELECT OWNER,TRIGGER_NAME FROM dba_triggers WHERE status ='ENABLED' 
and owner &owner_list;
temp varchar2(512);
begin
 dbms_output.put_line('-- BEGIN DISABBLE TRIGGERS --');
 dbms_output.put_line('-- WAIT FOR A MONENT --');
 dbms_output.put_line('--...................--');
for x in c loop
 temp := 'ALTER TRIGGER "'||x.OWNER||'"."'||x.TRIGGER_NAME||'" DISABLE';
 execute immediate temp;
 dbms_output.put_line('--DISABLE 
TRIGGER'||x.OWNER||'.'||x.TRIGGER_NAME||' SUCCESSFUL--') ;
end loop;
 dbms_output.put_line('-- END ALTER TABLE DISABBLE TRIGGERS --');
end;
/
spool off
禁用 job
conn oggspa/spaora
spool disable_job.sql
set pagesize 999;
select 'execute DBMS_IJOB.BROKEN('||job||',TRUE); commit;'
 from dba_jobs where BROKEN='N';
spool off
'EXECUTEDBMS_SCHEDULER.STOP_JOB('||JOB_NAME||');COMMIT;'
------------------------------------------------------------------------
execute DBMS_SCHEDULER.stop_job(QUEST_PPCM_JOB_PM_1); commit;
execute DBMS_SCHEDULER.stop_job(JOB_PLANDT_AUTOADD); commit;

--关闭 job
set echo off
set verify off
set feedback off
set pagesize 10000
set heading off
set lines 100
spool disable_job.sql
set pagesize 999;
set linesize 200;
set heading off;
select 'execute DBMS_IJOB.BROKEN('||job||',TRUE); commit;'
 from dba_jobs where BROKEN='N';
spool off
--关闭触发器
spool disable_triggers.sql
select 'alter trigger '||owner||'.'||trigger_name||' disable;'
 from dba_triggers where owner in ('WYY') and status='ENABLED'
 order by status,owner;
spool off

--禁用约束
spool disable_constraints1.sql
select 'alter table '||owner||'.'||table_name||' disable constraint 
'||constraint_name||';'
 from dba_constraints
 where constraint_type in ('R') and owner='WYY'
 order by status,owner;
spool off

目标端启动 replicate 进程

–源端开启投递进程:

ggsci> start eitpux01 --这个从备份开始,就应该一直启动。
ggsci> start pitpux01
ggsci> info all 
GGSCI (hfdb30) 7> start pitpux01

Sending START request to MANAGER ...
EXTRACT PITPUX01 starting


GGSCI (hfdb30) 8> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     STOPPED     EITPUX01    00:00:00      00:25:01
EXTRACT     STOPPED     PITPUX01    00:00:00      00:15:18

–目标端开启复制进程

ggsci> start ritpux01,aftercsn 1341822
ggsci> info all 
ggsci> view report ritpux01 
select checkpoint_change#,file# from v$datafile_header;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/922440.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

现代密码学

概论 计算机安全的最核心三个关键目标&#xff08;指标&#xff09;/为&#xff1a;保密性 Confidentiality、完整性 Integrity、可用性 Availability &#xff0c;三者称为 CIA三元组 数据保密性&#xff1a;确保隐私或是秘密信息不向非授权者泄漏&#xff0c;也不被非授权者使…

QT QGridLayout控件 全面详解

本系列文章全面的介绍了QT中的57种控件的使用方法以及示例&#xff0c;包括 Button(PushButton、toolButton、radioButton、checkBox、commandLinkButton、buttonBox)、Layouts(verticalLayout、horizontalLayout、gridLayout、formLayout)、Spacers(verticalSpacer、horizonta…

Adobe Illustrator 2024 安装教程与下载分享

介绍一下 下载直接看文章末尾 Adobe Illustrator 是一款由Adobe Systems开发的矢量图形编辑软件。它广泛应用于创建和编辑矢量图形、插图、徽标、图标、排版和广告等领域。以下是Adobe Illustrator的一些主要特点和功能&#xff1a; 矢量绘图&#xff1a;Illustrator使用矢量…

IDEA2023设置控制台日志输出到本地文件

1、Run->Edit Configurations 2、选择要输出日志的日志&#xff0c;右侧&#xff0c;IDEA2023的Logs在 Modify option 里 选中就会展示Logs栏。注意一定要先把这个日志文件创建出来&#xff0c;不然不会自动创建日志文件的 IDEA以前版本的Logs会直接展示出来 3、但是…

[UE5学习] 一、使用源代码安装UE5.4

一、简介 本文介绍了如何使用源代码安装编译UE5.4&#xff0c;并且新建简单的项目&#xff0c;打包成安卓平台下的apk安装包。 二、使用源代码安装UE5.4 注意事项&#xff1a; 请保证可以全程流畅地科学上网。请保证C盘具有充足的空间。请保证接下来安装下载的visual studi…

细说敏捷:敏捷四会之standup meeting

上一篇文章中&#xff0c;我们讨论了 敏捷四会 中 冲刺计划会 的实施要点&#xff0c;本篇我们继续分享敏捷四会中实施最频繁&#xff0c;团队最容易实施但往往也最容易走形的第二个会议&#xff1a;每日站会 关于每日站会的误区 站会是一个比较有标志性的仪式活动&#xff0…

10M和100M网口的编码及EMC影响

10M网口编码技术 10M网口&#xff0c;即10Base-T&#xff0c;采用的是曼彻斯特编码方法 。在这种编码中&#xff0c;“0”由“”跳变到“-”&#xff0c;而“1”由“-”跳变到“” 。这种编码方式的特点是信号的DC平衡&#xff0c;即信号在任何一段时间内的平均电压为零&#…

docker基本使用

参考视频&#xff1a; 参考视频https://www.bilibili.com/video/BV1e64y1F7pJ/?share_sourcecopy_web&vd_source8fc0c76c477d3db71f89fa5ae5b258c7 docker容器操作&#xff1a; 拉取镜像&#xff1a; 拉取官网ubuntu镜像 sudo docker pull ubuntu 运行镜像&#xff1a;…

音频信号采集前端电路分析

音频信号采集前端电路 一、实验要求 要求设计一个声音采集系统 信号幅度&#xff1a;0.1mVpp到1Vpp 信号频率&#xff1a;100Hz到16KHz 搭建一个带通滤波器&#xff0c;滤除高频和低频部分 ADC采用套件中的AD7920&#xff0c;转换率设定为96Ksps &#xff1b;96*161536 …

构建高效在线教育:SpringBoot课程管理系统

1系统概述 1.1 研究背景 随着计算机技术的发展以及计算机网络的逐渐普及&#xff0c;互联网成为人们查找信息的重要场所&#xff0c;二十一世纪是信息的时代&#xff0c;所以信息的管理显得特别重要。因此&#xff0c;使用计算机来管理在线课程管理系统的相关信息成为必然。开发…

【云计算网络安全】解析 Amazon 安全服务:构建纵深防御设计最佳实践

文章目录 一、前言二、什么是“纵深安全防御”&#xff1f;三、为什么有必要采用纵深安全防御策略&#xff1f;四、以亚马逊云科技为案例了解纵深安全防御策略设计4.1 原始设计缺少安全策略4.2 外界围栏构建安全边界4.3 访问层安全设计4.4 实例层安全设计4.5 数据层安全设计4.6…

基于LiteFlow的风控系统指标版本控制

个人博客&#xff1a;无奈何杨&#xff08;wnhyang&#xff09; 个人语雀&#xff1a;wnhyang 共享语雀&#xff1a;在线知识共享 Github&#xff1a;wnhyang - Overview 更新日志 最近关于https://github.com/wnhyang/coolGuard此项目更新了如下内容&#xff1a;https://g…

Spring:AOP切入点表达式

对于AOP中切入点表达式&#xff0c;我们总共会学习三个内容&#xff0c;分别是语法格式、通配符和书写技巧。 语法格式 首先我们先要明确两个概念: 切入点:要进行增强的方法切入点表达式:要进行增强的方法的描述方式 对于切入点的描述&#xff0c;我们其实是有两中方式的&a…

docker搭建私有的仓库

docker搭建私有仓库 一、为什么要搭建私有的仓库&#xff1f; 因为在国内&#xff0c;访问&#xff1a;https://hub.docker.com/ 会出现无法访问页面。。。。&#xff08;已经使用了魔法&#xff09; 当然现在也有一些国内的镜像管理网站&#xff0c;比如网易云镜像服务、Dao…

大白话讲Promise(最详细)

学前端的大家都知道promise是重中之重&#xff0c;也是面试的必考项。但是刚接触promise我一直很晕头晕脑的&#xff0c;搜集文章前看后看基本都是讲解promise的状态它的方法就没有再深入了&#xff0c;以至于面试时候面试官一旦往深问我就懵了。所以今天我们就详细的说一下pro…

【笔记】自动驾驶预测与决策规划_Part7_数据驱动的预测方法

文章目录 0. 前言1. 多模态传感器的编码方式1.1 栅格化表示1.2 向量化表示 Vectornet1.3 基于点云或者多模态输入的预测1.4 基于Transformer的方法 2. 网络输出的表达形式2.1 多模态轨迹回归2.2 轨迹分类2.3 轨迹回归轨迹分类2.4 目标点预测 3.场景级别的预测和决策3.1 论文&am…

回溯法经典难题解析

本文将通过几个经典的回溯问题&#xff0c;展示回溯算法的应用及其在解决问题时的核心思想和技巧。这些问题包括全排列、全排列II、N皇后以及数独问题&#xff0c;本文将分别介绍每个问题的思路与实现。 46. 全排列 给定一个不含重复数字的数组 nums &#xff0c;返回其 所有…

无线图传下的低延迟视频传输播放技术探讨

技术背景 无线图传技术即无线图像传输技术&#xff0c;是指不用布线&#xff08;线缆&#xff09;利用无线电波来传输图像数据的技术。 一、工作原理 无线图传技术主要涉及图像采集、编码、调制、发射、接收、解调、解码和图像显示等环节。 图像采集&#xff1a;通过摄像头…

软件测试面试之常规问题

1.描述一下测试过程 类似题目:测试的生命周期 思路:这是一个“范围”很大的题目&#xff0c;而且回答时间一般在3分钟之内&#xff0c;不可能非常详细的描述整个过程&#xff0c;因此答题的思路要从整体结构入手&#xff0c;不要过细。为了保证答案的准确性&#xff0c;可以引…

C++从零到满绩——类和对象(中)

目录 1>>前言 2>>构造函数&#xff08;我称之为初始化函数&#xff09; 3>>析构函数&#xff08;我称之为销毁函数&#xff09; 4>>拷贝构造函数&#xff08;我称之为复制函数&#xff09; 5>>运算符重载 5.2>>赋值运算符重载 ​编辑…