以下技能在备库部署ogg初始化时可用到。

exp可直接执行:

exp jyc/jyc@pdbdgorcl buffer=409600000 file=dg_jyc.dmp log=dg_jyc.log owner=jyc

[oracle@dgrac2 ~]$ exp jyc/jyc@pdbdgorcl buffer=409600000 file=dg_jyc.dmp log=dg_jyc.log owner=jyc

Export: Release 19.0.0.0.0 - Production on Wed Feb 16 09:52:56 2022
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user JYC 
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user JYC 
About to export JYC's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export JYC's tables via Conventional Path ...
. . exporting table                           TEST          2 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.

expdp需通过主库或其它库的network_link方式导出

expdp jyc/jyc@pdborcl network_link=expdp_primary directory=dmp schemas=JYC dumpfile=dg_jyc.dmp logfile=dg_jyc.log cluster=n exclude=statistics

备库操作报错如下:

[oracle@dgrac1 trace]$ expdp jyc/jyc@pdbdgorcl directory=dmp schemas=JYC dumpfile=dg_jyc.dmp logfile=dg_jyc.log cluster=n exclude=statistics

Export: Release 19.0.0.0.0 - Production on Wed Feb 16 09:42:03 2022
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
ORA-31626: job does not exist
ORA-31633: unable to create master table "JYC.SYS_EXPORT_SCHEMA_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 1163
ORA-16000: database or pluggable database open for read-only access
ORA-06512: at "SYS.KUPV$FT", line 1056
ORA-06512: at "SYS.KUPV$FT", line 1044

主库操作:(主备库先创建好dmp目录)

[oracle@rac1 ~]$ sqlplus jyc/jyc@pdborcl

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Feb 16 09:32:25 2022
Version 19.5.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0

SQL> select table_name from user_tables;

no rows selected

SQL> create table test (id int);

Table created.

SQL> insert into test values(1);

1 row created.

SQL> insert into test values(2);

1 row created.

SQL> commit;

Commit complete.

SQL> set line 130
SQL> set wrap off
SQL> col DIRECTORY_NAME for a30
SQL> select * from dba_directories;
rows will be truncated

OWNER DIRECTORY_NAME                 DIRECTORY_PATH
----- ------------------------------ ---------------------------------------------------------------------------------------------
SYS   SDO_DIR_WORK
SYS   SDO_DIR_ADMIN                  /oracle/app/oracle/product/19c/dbhome_1/md/admin
SYS   XMLDIR                         /oracle/app/oracle/product/19c/dbhome_1/rdbms/xml
SYS   XSDDIR                         /oracle/app/oracle/product/19c/dbhome_1/rdbms/xml/schema
SYS   OPATCH_INST_DIR                /oracle/app/oracle/product/19c/dbhome_1/OPatch
SYS   ORACLE_OCM_CONFIG_DIR2         /oracle/app/oracle/product/19c/dbhome_1/ccr/state
SYS   ORACLE_BASE                    /oracle/app/oracle
SYS   ORACLE_HOME                    /oracle/app/oracle/product/19c/dbhome_1
SYS   ORACLE_OCM_CONFIG_DIR          /oracle/app/oracle/product/19c/dbhome_1/ccr/state
SYS   DATA_PUMP_DIR                  /oracle/app/oracle/product/19c/dbhome_1/rdbms/log/A0044C1C44692EE6E0539634A8C0A37C
SYS   DBMS_OPTIM_LOGDIR              /oracle/app/oracle/product/19c/dbhome_1/cfgtoollogs

OWNER DIRECTORY_NAME                 DIRECTORY_PATH
----- ------------------------------ ---------------------------------------------------------------------------------------------
SYS   DBMS_OPTIM_ADMINDIR            /oracle/app/oracle/product/19c/dbhome_1/rdbms/admin
SYS   OPATCH_SCRIPT_DIR              /oracle/app/oracle/product/19c/dbhome_1/QOpatch
SYS   OPATCH_LOG_DIR                 /oracle/app/oracle/product/19c/dbhome_1/rdbms/log
SYS   JAVA$JOX$CUJS$DIRECTORY$       /oracle/app/oracle/product/19c/dbhome_1/javavm/admin/

15 rows selected.

SQL> !mkdir -p /oracle/app/oracle/dmp

SQL> create directory dmp as '/oracle/app/oracle/dmp';
grant read,write on directory dmp to public;

Directory created.

SQL> 
Grant succeeded.

此处开始备库操作:先取消同步,这样备库数据不变情况下导出对比主库新增记录的情况:

[oracle@dgrac1 trace]$ dgmgrl sys/oracle@dgorcl
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Wed Feb 16 09:43:20 2022
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "dgorcl"
Connected as SYSDBA.

DGMGRL> show CONFIGURATION;

Configuration - adg

Protection Mode: MaxPerformance
  Members:
  orcl   - Primary database
    dgorcl - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 11 seconds ago)

DGMGRL> show database verbose dgorcl

Database - dgorcl

Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          0 seconds (computed 0 seconds ago)
  Average Apply Rate: 42.00 KByte/s
  Active Apply Rate:  1.45 MByte/s
  Maximum Apply Rate: 1.63 MByte/s
  Real Time Query:    ON
  Instance(s):
    orcl1
    orcl2 (apply instance)

Properties:
    DGConnectIdentifier             = 'dgorcl'
    ObserverConnectIdentifier       = ''
    FastStartFailoverTarget         = ''
    PreferredObserverHosts          = ''
    LogShipping                     = 'ON'
    RedoRoutes                      = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyLagThreshold               = '30'
    TransportLagThreshold           = '30'
    TransportDisconnectedThreshold  = '30'
    ApplyParallel                   = 'AUTO'
    ApplyInstances                  = '0'
    StandbyFileManagement           = ''
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '0'
    LogArchiveMinSucceedDest        = '0'
    DataGuardSyncLatency            = '0'
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = ''
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    ArchiveLocation                 = ''
    AlternateLocation               = ''
    StandbyArchiveLocation          = ''
    StandbyAlternateLocation        = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    LogXptStatus                    = '(monitor)'
    SendQEntries                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    HostName(*)
    StaticConnectIdentifier(*)
    TopWaitEvents(*)
    SidName(*)
    (*) - Please check specific instance for the property value

Log file locations(*):
    (*) - Check specific instance for log file locations.

Database Status:
SUCCESS

DGMGRL> edit database 'dgorcl' set state='apply-off';
Succeeded.
DGMGRL> show database verbose dgorcl

Database - dgorcl

Role:               PHYSICAL STANDBY
  Intended State:     APPLY-OFF
  Transport Lag:      0 seconds (computed 1 second ago)
  Apply Lag:          12 seconds (computed 1 second ago)
  Average Apply Rate: (unknown)
  Active Apply Rate:  (unknown)
  Maximum Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    orcl1
    orcl2 (apply instance)

Properties:
    DGConnectIdentifier             = 'dgorcl'
    ObserverConnectIdentifier       = ''
    FastStartFailoverTarget         = ''
    PreferredObserverHosts          = ''
    LogShipping                     = 'ON'
    RedoRoutes                      = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyLagThreshold               = '30'
    TransportLagThreshold           = '30'
    TransportDisconnectedThreshold  = '30'
    ApplyParallel                   = 'AUTO'
    ApplyInstances                  = '0'
    StandbyFileManagement           = ''
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '0'
    LogArchiveMinSucceedDest        = '0'
    DataGuardSyncLatency            = '0'
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = ''
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    ArchiveLocation                 = ''
    AlternateLocation               = ''
    StandbyArchiveLocation          = ''
    StandbyAlternateLocation        = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    LogXptStatus                    = '(monitor)'
    SendQEntries                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    HostName(*)
    StaticConnectIdentifier(*)
    TopWaitEvents(*)
    SidName(*)
    (*) - Please check specific instance for the property value

Log file locations(*):
    (*) - Check specific instance for log file locations.

Database Status:
SUCCESS

DGMGRL> show database dgorcl

Database - dgorcl

Role:               PHYSICAL STANDBY
  Intended State:     APPLY-OFF
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          24 seconds (computed 0 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    orcl1
    orcl2 (apply instance)

Database Status:
SUCCESS

DGMGRL>

此处开始主库操作:主库增加3条记录,这样主库是5条,备库是2条

SQL> 
SQL> insert into test values(3);

1 row created.

SQL> insert into test values(4);

1 row created.

SQL> insert into test values(5);

1 row created.

SQL> commit;

Commit complete.

SQL> create database link expdp_primary connect to jyc identified by jyc using 'pdbdgorcl';

Database link created.

SQL> select db_unique_name from v$database;

DB_UNIQUE_NAME
------------------------------
orcl

SQL> select db_unique_name from v$database@expdp_primary;

DB_UNIQUE_NAME
------------------------------
dgorcl

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0
[oracle@rac1 ~]$ expdp jyc/jyc@pdborcl network_link=expdp_primary directory=dmp schemas=JYC dumpfile=dg_jyc.dmp logfile=dg_jyc.log cluster=n exclude=statistics

Export: Release 19.0.0.0.0 - Production on Wed Feb 16 09:49:45 2022
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
FLASHBACK automatically enabled to preserve database integrity.
Starting "JYC"."SYS_EXPORT_SCHEMA_01":  jyc/********@pdborcl network_link=expdp_primary directory=dmp schemas=JYC dumpfile=dg_jyc.dmp logfile=dg_jyc.log cluster=n exclude=statistics 
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . exported "JYC"."TEST"                                  5.5 KB       2 rows
Master table "JYC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for JYC.SYS_EXPORT_SCHEMA_01 is:
  /oracle/app/oracle/dmp/dg_jyc.dmp
Job "JYC"."SYS_EXPORT_SCHEMA_01" successfully completed at Wed Feb 16 09:50:33 2022 elapsed 0 00:00:39

[oracle@rac1 ~]$ expdp jyc/jyc@pdborcl directory=dmp schemas=JYC dumpfile=pri_jyc.dmp logfile=pri_jyc.log cluster=n exclude=statistics

Export: Release 19.0.0.0.0 - Production on Wed Feb 16 09:50:58 2022
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
FLASHBACK automatically enabled to preserve database integrity.
Starting "JYC"."SYS_EXPORT_SCHEMA_01":  jyc/********@pdborcl directory=dmp schemas=JYC dumpfile=pri_jyc.dmp logfile=pri_jyc.log cluster=n exclude=statistics 
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/DB_LINK
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
. . exported "JYC"."TEST"                                5.093 KB       5 rows
Master table "JYC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for JYC.SYS_EXPORT_SCHEMA_01 is:
  /oracle/app/oracle/dmp/pri_jyc.dmp
Job "JYC"."SYS_EXPORT_SCHEMA_01" successfully completed at Wed Feb 16 09:51:54 2022 elapsed 0 00:00:48

相关参考:

【DG】怎么从Oracle备库导出数据_ITPUB博客

dg备库怎么逻辑导出exp/expdp?相关推荐

  1. 【DG】基于同一个主机建立物理备库和逻辑备库 (四)--添加一个物理dg节点

    [DATAGUARD] 基于同一个主机建立物理备库和逻辑备库 (四)--添加一个物理dg节点 BLOG文档结构图 [DATAGUARD] 基于同一个主机建立物理备库和逻辑备库(一): http://b ...

  2. DG备库-OGG 同步

    备注:  Oracle DG   (主->备库1->备库2) 级联方式 主库: 10.118.242.216         sid_name=sfpay2  备库1: 10.118.24 ...

  3. DG备库执行只读open的时候报错

    10.2.0.4RAC到单机--DG备库执行只读open的时候报错 SQL> alter database open read only2 ; alter database open read ...

  4. oracle怎么增加一个dg备库,如何在单机实现多个dg备库,并切换到其中一个备库...

    一.创建第一个DG备库 1.1 修改主库orcl的参数 1.启动归档 如果没有归档: Sql> startup mount; Sql>alter database archivelog; ...

  5. 【DG】DG备库报ORA-28000: the account is locked的解决办法

    [DG]DG备库报ORA-28000: the account is locked的解决办法 测试用户为lhr 现象:主备库的lhr用户的状态都是OPEN,但是,备库连接的时候报ORA-28000: ...

  6. DG备库磁盘空间满导致无法创建归档

    上周五去某客户那里做数据库巡检.是window 2008系统上10g的一套NC系统的库,已经配置了DG,可是巡检时发现数据库报错: Tue Nov 11 10:13:57 2014 LNS: Stan ...

  7. DG备库delay设置备库延时apply archivelog 但不延时传送归archivelog

    alter database recover managed standby database delay 120 disconnect from session;    延时测试 1,在备库上运行: ...

  8. oracle dg备库关机,Oracle DG 备库 STANDBY 日志传输小结

    1. 日志传输方式 有两种日志传输方式(ARC和LGWR),第一种是采用ARC进程传输日志,其示意图如下: 注:上图来自<大话Oracle RAC> 其大致过程如下: 1)主库:日志先写入 ...

  9. Oracle DG备库出现GAP解决

    一.环境准备 准备Oracle dg环境 主库ip 192.168.1.217 oracle 备库ip 192.168.1.218 dg 二.模拟备库出现GAP 2.1 归档日志存在 备库先关闭日志应 ...

最新文章

  1. 华人“军火专家”——黄仁勋
  2. Nginx+keepalived从入门到集群搭建(手把手教学,建议收藏)
  3. linux和windows文件名称长度限制
  4. window下eclipse搭建C/C++开发环境(超简单无需插件版) .
  5. 一个前端开发人员多年苦心搜集的Chrome开发者工具使用技巧
  6. 电偶溶解氧传感器行业调研报告 - 市场现状分析与发展前景预测(2021-2027年)
  7. java iecapt.exe_java替换url的域名和端口方法
  8. php定时发送生日模块消息_RabbitMQ之消息的可靠性投递
  9. Jrebel实现tomcat热部署,遇到的问题以及解决办法,详解
  10. mysql安装和下载过程_mysql下载与安装过程
  11. 单片机的C语言应用程序设计实训教程,单片机的c语言程序设计实训
  12. 电商公司ERP管理软件与旺店通、第三方仓库以及云仓的贯通解决方案
  13. 那些年 用过的经典App
  14. Vue3 Suspense 组件
  15. ISA防火墙策略配置/服务器发布
  16. MM 委外加工(Subconctracting)流程
  17. C++教程网编程视频
  18. 如何评价亚马逊 Kindle Oasis 电子书阅读器?
  19. 2022年深圳市生态环境专项资金申请指南
  20. 在华为上班工资多高?十多年赚了1000多万!

热门文章

  1. [C#] UI跨执行绪
  2. python 滚动字幕_python 实现字幕动态滚动和等待效果
  3. 百度知道引流有哪些方法?一个互动式的疑问解答
  4. Win10无法拖动最大化窗口
  5. [转]ESMTP的三个认证方式: CRAM-MD5 PLAIN和LOGIN
  6. cdm 图片 转_PowerDesigner之CDM、PDM、SQL之间转换
  7. 程序员应该保持危机感
  8. 一份价值上万的年终总结 —— 自我重构
  9. 《Spring》第二十一篇 事务底层源码解析
  10. 深入解析ThreadLocal源码