亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么理解Oracle數據庫的單向復制

發布時間:2021-11-09 16:03:01 來源:億速云 閱讀:309 作者:iii 欄目:關系型數據庫

這篇文章主要講解了“怎么理解Oracle數據庫的單向復制”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“怎么理解Oracle數據庫的單向復制”吧!

1.       環境需求:

兩臺裝有Oracle軟件的虛擬機服務器,并配置好監聽及安裝好數據庫


Linux

Oracle

OGG

IP

SID

OGG1

CentOS 6.5

11.2.0.4

12.2.0.2

192.168.1.211

ogg

OGG2

CentOS 6.5

11.2.0.4

12.2.0.2

192.168.1.212

ogg

2.       配置準備

2.1   創建操作系統用戶

useradd ogg -g oinstall

新建安裝目錄

[root@ogg1 ~]# mkdir -p /u01/ogg

[root@ogg1 ~]# chown -R ogg.oinstall /u01/ogg

[root@ogg1 ~]# chmod 775 /u01/ogg/

2.2   設置用戶的環境變量,尤其要給它指定lib庫的位置以及ggsci位置:

export PATH

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

export GG_HOME=/u01/ogg

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export PATH=$GG_HOME:$PATH

2.3正式安裝

[root@ogg1 soft]# unzip 122022_fbo_ggs_Linux_x64_shiphome.zip

[ogg@ogg1 ~]$ cd /u01/soft/fbo_ggs_Linux_x64_shiphome/Disk1/

[ogg@ogg1 Disk1]$ ./runInstaller

                   安裝步驟略,將安裝目錄設置為/u01/ogg

3.       復制準備:實現單表復制

檢查相關參數是否開啟

Select LOG_MODE , FORCE_LOGGING, SUPPLEMENTAL_LOG_DATA_min from v$database;

3.1   開啟參數(需開啟歸檔模式和強制歸檔)

SQL> show parameter golde

NAME                                          TYPE        VALUE

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

enable_goldengate_replication              boolean  FALSE

SQL> alter system set enable_goldengate_replication=true;

SQL> select SUPPLEMENTAL_LOG_DATA_min from v$database;

SUPPLEME

--------

NO

SQL> alter database add supplemental log data;

Database altered.

SQL> select SUPPLEMENTAL_LOG_DATA_min from v$database;

SUPPLEME

--------

YES

SQL> alter system archive log current;

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.

Total System Global Area  830930944 bytes

Fixed Size                 2257800 bytes

Variable Size                  536874104 bytes

Database Buffers         289406976 bytes

Redo Buffers                    2392064 bytes

Database mounted.

SQL> alter database force logging;

Database altered.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

System altered.

源端和目標端分別設置

源端:create user ogg_source identified by oracle default tablespace users;
grant alter session to ogg_source;
grant create session to ogg_source;
grant connect to ogg_source;
grant resource to ogg_source;
grant select any dictionary to ogg_source;
grant select any table to ogg_source;
grant flashback any table to ogg_source;
grant alter any table to ogg_source;

目標:create user ogg_target identified by oracle default tablespace users;
grant alter session to ogg_target;
grant create session to ogg_target;
grant connect to ogg_target;
grant resource to ogg_target;
grant select any dictionary to ogg_target;
grant select any table to ogg_target;
grant flashback any table to ogg_target;
grant alter any table to ogg_target;
grant insert any table to ogg_target;
grant update any table to ogg_target;
grant delete any table to ogg_target;

3.2   Ogg配置

問題解決:無法登陸,是oracle_sid設置問題

GGSCI (ogg1) 5> dblogin userid ogg_source ,password oracle

ERROR: Unable to connect to database using user ogg_source. Please check privileges.

Unable to initialize database connection because of error ORA-12162: TNS:net service name is incorrectly specified.

GGSCI (ogg1) 6> exit

[ogg@ogg1 ~]$ export ORACLE_SID=ogg

[ogg@ogg1 ~]$ /u01/ogg/ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419_FBO

Linux, x64, 64bit (optimized), Oracle 11g on Jun 30 2017 14:42:26

Operating system character set identified as UTF-8.

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

GGSCI (ogg1) 1> dblogin userid ogg_source ,password oracle

Successfully logged into database.

1.       配置需要抽取的表或者用戶

Add trandata luc.*

2.       配置全局參數

./GLOBALS 必須大寫

事務配置及檢查點表

3.       配置MGR進程

Edit params mgr

>port 7809

4.       配置Extract腳本

配置參數,使用本地的方式。

Edit params EXT_1

EXTRACT EXT_1
USERID ogg_source, PASSWORD oracle
EXTTRAIL /home/oracle/ogg/ogg_work/dirdat/ss
TABLE N1.*;

添加抽取進程,從數據庫日志中抓取數據。

>  ADD EXTRACT EXT_1, TRANLOG, BEGIN NOW

EXTRACT added.

配置本地隊列,然后啟動

> ADD EXTTRAIL /home/oracle/ogg/ogg_work/dirdat/ss, EXTRACT EXT_1

> start EXT_1

Sending START request to MANAGER ...

EXTRACT EXT_1 starting

配置完成之后,就可以查看是否能夠正常抽取了,可以看到是沒有正常啟動。狀態現在還是STOPPED

> info EXT_1

EXTRACT    EXT_1     Initialized   2016-11-11 16:16   Status STOPPED

Checkpoint Lag       00:00:00 (updated 00:01:22 ago)

Log Read Checkpoint  Oracle Redo Logs

                     2016-11-11 16:16:04  Seqno 0, RBA 0

5.       配置Pump腳本

>  edit params dpump_1

EXTRACT dpump_1

PASSTHRU

RMTHOST 10.127.2.32, MGRPORT 1530

RMTTRAIL  /home/oracle/ogg/ogg_work/dirdat/ss

TABLE n1.*;

> ADD EXTRACT dpump_1,EXTTRAILSOURCE /home/oracle/ogg/ogg_work/dirdat/ss

EXTRACT added.

> ADD RMTTRAIL /home/oracle/ogg/ogg_work/dirdat/ss, EXTRACT dpump_1

RMTTRAIL added.

配置完成之后,啟動PUMP進程。

> start dpump_1

Sending START request to MANAGER ...

EXTRACT DPUMP_1 starting查看DUMP進程的信息如下:

> info dpump_1

EXTRACT    DPUMP_1   Last Started 2016-11-11 16:24   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:04 ago)

Process ID           53479

Log Read Checkpoint  File /home/oracle/ogg/ogg_work/dirdat/ss000000000

                     First Record  RBA 0

6.       配置Application腳本

配置投遞隊列參數,將數據應用到目標庫,這里有個映射關系,就是源庫的n1.*和目標庫的n1.*是對應的。

> edit params rep_1

REPLICAT REP_1

USERID ogg_target, PASSWORD oracle

ASSUMETARGETDEFS

HANDLECOLLISIONS

MAP n1.*,TARGET n1.*; 添加投遞隊列

> ADD REPLICAT REP_1, EXTTRAIL /home/oracle/ogg/ogg_work/dirdat/ss,CHECKPOINTTABLE ogg_target.CHKPTAB

REPLICAT added.

> start REP_1

Sending START request to MANAGER ...

REPLICAT REP_1 starting

啟動成功后的狀態是這樣的。

> INFO REP_1

REPLICAT   REP_1     Last Started 2016-11-11 17:02   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:02 ago)

Process ID           69571

Log Read Checkpoint  File /home/oracle/ogg/ogg_work/dirdat/ss000000000

                     First Record  RBA 0

報錯執行:

BEGIN

     DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(

     grantee => 'ogg_target',

    grant_privileges => true);

     END;

     /

循環插入1-100

begin
for i in 1 .. 100 loop
    insert into  luc.test values (i,’uuu’);
    end loop;

end;

/

插入大量數據測試是否同步:

insert into luc.test select level,level||’obj’ from dual connect by level<500000;

感謝各位的閱讀,以上就是“怎么理解Oracle數據庫的單向復制”的內容了,經過本文的學習后,相信大家對怎么理解Oracle數據庫的單向復制這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

甘孜县| 龙泉市| 宿迁市| 南华县| 华安县| 海林市| 大厂| 治县。| 洞头县| 红桥区| 南川市| 开封市| 正宁县| 广饶县| 平定县| 郧西县| 遵义县| 定襄县| 峡江县| 罗山县| 巧家县| 富宁县| 米林县| 安康市| 渭源县| 白朗县| 保靖县| 普定县| 霍邱县| 瑞安市| 盐池县| 曲松县| 江永县| 永康市| 吉木乃县| 定陶县| 枣阳市| 维西| 犍为县| 巴彦淖尔市| 满城县|