Maison > Article > base de données > GG搭建 源单实例---到目标RAC环境 11.2.3版本 单向同步(XX公司
GG搭建 源单实例---到目标RAC环境 11.2.3版本 单向同步 目的 完成后本 Oracle 按示例 (OBE) 教程中,您将能够保持两个异构数据库同步使用 Oracle GoldenGate (OGG) ; 在这种情况下 Linux Oracle 11gR2 数据库到 11gR2 Exadata 数据库。 在本课中,您将学会
GG搭建 源单实例---到目标RAC环境 11.2.3版本 单向同步完成后本 Oracle 按示例 (OBE) 教程中,您将能够保持两个异构数据库同步使用 Oracle GoldenGate (OGG) ;在这种情况下 Linux Oracle 11gR2 数据库到 11gR2 Exadata 数据库。
在本课中,您将学会如何:
大约 2 个小时
Oracle GoldenGate Exadata 上的: 从 Oracle 11gR2 向 Oracle 11gR2 复制
Oracle GoldenGate 提供异构数据库的非常快速复制,通过读取事务日志并写入一个或多个目标数据库所做的更改。在典型环境中涉及以下五个过程:
图所示的配置 (使用在目标系统上创建远程跟踪一个主要提取过程。建议您使用进程从远程跟踪的更改将应用为目标 RAC 数据库。它是不必要的源 host01 Linux 也不是 64 位。
总之,环境是:
主机名 | 屏幕颜色 | OS | 硬件 | 数据库 | SID | OGG 源/目标 | 主控制台 |
---|---|---|---|---|---|---|---|
host01 | 红色 | Linux 64 位 | 单个 CPU 的 PC | Oracle 11gR2 | orcl | 源 | 两个 |
qr01db02 (Node02) | 黄色 | Linux 64 位 | Exadata 数据库节点 | Oracle 11gR2 RAC | dbm2 | 目标 | GGSCI |
qr01db01 (Node01) | 绿色 | Linux 64 位 | Exadata 数据库节点 | Oracle 11gR2 RAC | dbm1 | 目标 | SQL * 加上 |
这个实验室的先决条件包括以下内容:
/home/user/
目标/首页/用户/目录。这是可从Oracle
软件交付云.记住有两个主机: host01 和 host02 ;和每个主机有三种环境提示: OS、 GGSCI 和 SQL。这让六个不同的地方,在其中您可以键入 !请尝试一定要额外小心你在哪个位置中输入的命令。错误的上下文中的错误的命令是最常见的错误。
要执行这一课,GoldenGate 应用程序必须安装在源和目标系统上。安装包括一个示例数据库和脚本来生成初始数据,以及随后的更新操作。源表和目标表创建和加载与初始数据。GoldenGate 管理器进程也会启动以便其他进程可能会配置和启动。源的定义是最后,生成和转移到目标系统。
对于经审核表,提取过程配置捕获变更数据直接从财资市场发展委员会审核跟踪,并将所做的更改存储在称为 GoldenGate 本地径数据队列。
一旦表已最初加载数据,提取过程捕获的所有操作,建议您使用进程配置为捕获的操作传递到目标数据库。
文本颜色和字体的方向和在此屏幕中应解释如下:
请输入./ ggsci启动的命令行解释器。
在初始欢迎横幅之后, 你可以在输入命令GGSCI (host01) 1 >提示符。
选择你想要的版本之后, 单击继续以开始下载。
请输入您的用户 id/密码的提示符。
编辑/etc目录中的hosts文件。
在初始加载后将HandleCollisions参数更改为NoHandleCollisions 。
文件和过程的命名约定可以不管为你或你的公司工作。这里是这个 OBE 中使用的示例约定:
pxxxxhh.ext
地点:
本练习的目标是:
.profile
或.bash_profile
或相当于准备操作系统 (OS) 的环境变量。tnsping
为未来 sqlplus 连接进行测试。您键入的命令将在蓝色的等宽字体。系统的反应将会在black monospaced font.
您将配置.profile
为环境变量和主机别名的/etc/hosts
文件。你会做这三个的所有主机上: 源和两个目标节点。您现有的配置文件可能会对他们有行,这一步更侧重于要向其中添加的行。
使用您选择的编辑器,并且检查目标主机节点 1 上的配置文件的初始状态。ORACLE_BASE, ORACLE_HOME, OGG_HOME
,和LD_LIBRARY_PATH
添加变量。正如他们离开其他线条。
Exadata-节点 1 (目标) |
[oracle@qr01db01 ~]$<span class="_obe_sff"> vi .bash_profile </span> 1 <span class="_obe_rev"># .bash_profile </span> 2 <span class="_obe_rev"> </span> 3 <span class="_obe_rev"># Get the aliases and functions </span> 4 <span class="_obe_rev">if [ -f ~/.bashrc ]; then </span> 5 <span class="_obe_rev"> . ~/.bashrc </span> 6 <span class="_obe_rev">fi </span> 7 <span class="_obe_rev"> </span> 8 <span class="_obe_rev"># User specific environment and startup programs </span> 9 <span class="_obe_rev"> </span> 10 <span class="_obe_rev">PATH=$PATH:$HOME/bin </span> 11 <span class="_obe_rev"> </span> 12 <span class="_obe_rev">export PATH </span> 13 <span class="_obe_rev">export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 </span> 14 <span class="_obe_rev">export ORACLE_SID=dbm1 </span> 15 <span class="_obe_rev">ORAENV_ASK=NO;. /usr/local/bin/oraenv > /dev/null 2 16 <span class="_obe_rev">alias gogrid='export ORACLE_HOME=/u01/app/11.2.0/grid;export ORACLE_SID=+ASM1;. /usr/local/bin/oraenv > /dev/null 2 17 <span class="_obe_rev">alias godb='export ORACLE_HOME=/u01/app/oracle/product/11.2.0 /dbhome_1;export ORACLE_SID=dbm1;. /usr/local/bin/oraenv > /d ev/null 2 [oracle@qr01db01 ~]$<span class="_obe_sff"> vi .bash_profile </span> 1 <span class="_obe_rev"># .bash_profile </span> 2 <span class="_obe_rev"> </span> 3 <span class="_obe_rev"># Get the aliases and functions </span> 4 <span class="_obe_rev">if [ -f ~/.bashrc ]; then </span> 5 <span class="_obe_rev"> . ~/.bashrc </span> 6 <span class="_obe_rev">fi </span> 7 <span class="_obe_rev"> </span> 8 <span class="_obe_rev"># User specific environment and startup programs </span> 9 <span class="_obe_rev"> </span> 10 <span class="_obe_rev">PATH=$PATH:$HOME/bin </span> 11 <span class="_obe_rev"> </span> 12 <span class="_obe_rev">export PATH </span> 13 <span class="_obe_sfb">export ORACLE_BASE=/u01/app/oracle </span> 14 <span class="_obe_sfb">export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 </span> 15 <span class="_obe_sfb">export OGG_HOME=$ORACLE_BASE/ogg </span> 16 <span class="_obe_sfb">export LD_LIBRARY_PATH=$ORACLE_HOME/lib </span> 17 <span class="_obe_rev">export ORACLE_SID=dbm1 </span> 18 <span class="_obe_rev">ORAENV_ASK=NO;. /usr/local/bin/oraenv > /dev/null 2 19 <span class="_obe_rev">alias gogrid='export ORACLE_HOME=/u01/app/11.2.0/grid;export ORACLE_SID=+ASM1;. /usr/local/bin/oraenv > /dev/null 2 20 <span class="_obe_rev">alias godb='export ORACLE_HOME=/u01/app/oracle/product/11.2.0 /dbhome_1;export ORACLE_SID=dbm1;. /usr/local/bin/oraenv > /d ev/null 2 [oracle@qr01db02 ~]$ </span></span></span></span></span></span> |
The alias gogrid
and alias godb
have been added for another demo, they are not part of the default profile. They make it easier to switch between the Grid Infrastructure and DB environments. Note that the aliases each span several
lines. Be mindful to not introduce extra returns on those lines.
Switch user to root
and edit the /etc/hosts
file to append an alias for host01. Use the proper IP address for your environment.
Exadata - Node 1 (target) |
[oracle@qr01db02 ~]$<span class="_obe_sff"> su - root </span> Password: [root@qr01db02 ~]#<span class="_obe_sff"> vi /etc/hosts </span> <span class="_obe_rev">127.0.0.1 localhost.localdomain localhost </span> <span class="_obe_rev"> </span> <span class="_obe_rev"> <em>(...rest of file not shown, too many possibilities...)</em> </span> [root@qr01db02 ~]#<span class="_obe_sff"> tail -1 /etc/hosts </span> 192.0.2.16 host01.example.com host01 [root@qr01db02 ~]#<span class="_obe_sff"> exit </span> [oracle@qr01db02 ~]$ |
The tail
command assumes you appended the host01 address to the end of the file. Exit out of root
when you are done editing.
Do the exact same thing for the other target node 2. The lines are not shown, they are the same for qr01db<strong>01</strong>
and qr01db<strong>02</strong>
.
Exadata - Node 2 (target) |
[oracle@qr01db02 ~]$<span class="_obe_sff"> vi .bash_profile </span> <em>(REPEAT ON OTHER QR01db02)</em> [oracle@qr01db02 ~]$<span class="_obe_sff"> su - root </span> [root@qr01db02 ~]#<span class="_obe_sff"> vi /etc/hosts </span> <em>(REPEAT ON OTHER QR01db02)</em> [root@qr01db02 ~]#<span class="_obe_sff"> exit </span> [oracle@qr01db02 ~]$ |
The two nodes should have identical profiles and very similar /etc/hosts
.
Do the same thing for the source host. There may be slight difference in where things are installed, but you are defining the same four environment variables: ORACLE_BASE, ORACLE_HOME, OGG_HOME
, and LD_LIBRARY_PATH
. The /etc/hosts
points
to the Exadata address.
Host01 - Linux (source) |
[oracle@host01 ~]$<span class="_obe_sff"> vi .bash_profile </span> <span class="_obe_rev"># .bash_profile </span> <span class="_obe_rev"> </span> <span class="_obe_rev"># Get the aliases and functions </span> <span class="_obe_rev">if [ -f ~/.bashrc ]; then </span> <span class="_obe_rev"> . ~/.bashrc </span> <span class="_obe_rev">fi </span> <span class="_obe_rev"> </span> <span class="_obe_rev"># User specific environment and startup programs </span> <span class="_obe_sfb">ORACLE_BASE=/u01/app/oracle </span> <span class="_obe_sfb">ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_home1 </span> <span class="_obe_sfb">OGG_HOME=$ORACLE_BASE/ogg </span> <span class="_obe_rev">ORACLE_SID=orcl </span> <span class="_obe_rev">PATH=$PATH:$HOME/bin:$ORACLE_HOME:$ORACLE_HOME/bin </span> <span class="_obe_rev">LD_LIBRARY_PATH=$ORACLE_HOME/lib </span> <span class="_obe_rev"> </span> <span class="_obe_rev">export PATH LD_LIBRARY_PATH </span> <span class="_obe_sfb">export ORACLE_HOME ORACLE_BASE ORACLE_SID OGG_HOME </span> [oracle@host01 ~]$<span class="_obe_sff"> su - root </span> Password: [root@host01 ~]#<span class="_obe_sff"> vi /etc/hosts </span> <span class="_obe_rev">127.0.0.1 localhost.localdomain localhost </span> <span class="_obe_rev"> </span> <span class="_obe_rev"> <em>(...rest of file not shown, too many possibilities...)</em> </span> [root@host01 ~]#<span class="_obe_sff"> tail -1 /etc/hosts </span> 192.0.2.99 qr01-vip.example.com qr01-vip [root@host01 ~]#<span class="_obe_sff"> exit </span> [oracle@host01 ~]$ |
This time the /etc/hosts
addition is for an application "vip" address on Exadata that gets defined in the next step. For now, just enter that line on faith.
This completes preparing the OS environment variables.
The application Virtual IP (VIP) is part of Cluster Ready Services (CRS). It is used to define a single new address shared by multiple nodes. The purpose is for the source to point to a single target address regardless of which target node is handling it. This is similar to the Single Client Access Name (SCAN) address feature of Real Application Clusters (RAC), except that SCAN is only for use by the database, whereas VIP can be used by any application (in this example, GoldenGate).
On target node 2, perform the following tasks as root
or oracle
as indicated. You create the VIP as root
, but you run it as oracle
. The VIP address must be any unused address in the subnet
configured as the public network for the cluster. The example uses 192.0.2.99 because the grep
returns the 192.0.2.0
subnet, so .99 is unused in that subnet. It needs to match the /etc/hosts
file
on the source in the previous step.
Exadata - Node 2 (target) |
[oracle@qr01db02 ogg]$<span class="_obe_sff"> su - root </span> Password: [root@qr01db02 ~]#<span class="_obe_sff"> cd /u01/app/11.2.0/grid/bin </span> [root@qr01db02 bin]#<span class="_obe_sff"> ./crsctl stat res -p | grep -ie .network -ie subnet | grep -ie name -ie subnet </span> NAME=ora.net1.network USR_ORA_SUBNET=192.0.2.0 [root@qr01db02 bin]#<span class="_obe_sff"> ./appvipcfg create -network=1 -ip=192.0.2.99 -vipname=gg_vip_trg -user=root </span> Production Copyright 2007, 2008, Oracle.All rights reserved 2013-02-27 14:06:52: Creating Resource Type 2013-02-27 14:06:52: Executing /u01/app/11.2.0/grid/bin/crsctl add type app.appvip_net1.type -basetype ora.cluster_vip_net1.type -file /u01/app/11.2.0/grid/crs/template/appvip.type 2013-02-27 14:06:52: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl add type app.appvip_net1.type -basetype ora.cluster_vip_net1.type -file /u01/app/11.2.0/grid/crs/template/appvip.type 2013-02-27 14:06:55: Create the Resource 2013-02-27 14:06:55: Executing /u01/app/11.2.0/grid/bin/crsctl add resource gg_v ip_trg -type app.appvip_net1.type -attr "USR_ORA_VIP=192.0.2.99,START_DEPENDEN CIES=hard(ora.net1.network) pullup(ora.net1.network),STOP_DEPENDENCIES=hard(or a.net1.network),ACL='owner:root:rwx,pgrp:root:r-x,other::r--,user:root:r-x',HO STING_MEMBERS=qr01db02.example.com,APPSVIP_FAILBACK=" 2013-02-27 14:06:55: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl add resource gg_vip_trg -type app.appvip_net1.type -attr "USR_ORA_VIP=192.0.2.99,START_DEPE NDENCIES=hard(ora.net1.network) pullup(ora.net1.network),STOP_DEPENDENCIES=har d(ora.net1.network),ACL='owner:root:rwx,pgrp:root:r-x,other::r--,user:root:r-x ',HOSTING_MEMBERS=qr01db02.example.com,APPSVIP_FAILBACK=" [root@qr01db02 bin]#<span class="_obe_sff"> ./crsctl setperm resource gg_vip_trg -u user:oracle:r-x </span> [root@qr01db02 bin]#<span class="_obe_sff"> exit </span> [oracle@qr01db02 ogg]$<span class="_obe_sff"> cd /u01/app/11.2.0/grid/bin </span> [oracle@qr01db02 bin]$<span class="_obe_sff"> ./crsctl start resource gg_vip_trg </span> CRS-2672: Attempting to start 'gg_vip_trg' on 'qr01db01' CRS-2676: Start of 'gg_vip_trg' on 'qr01db01' succeeded [oracle@qr01db02 bin]$<span class="_obe_sff"> ./crsctl status resource gg_vip_trg </span> NAME=gg_vip_trg TYPE=app.appvip_net1.type TARGET=ONLINE STATE=ONLINE on qr01db01 [oracle@qr01db02 bin]$ |
You are looking for a STATE=ONLINE
to indicate success. A VIP is tied to one (and only one) IP address. In the case of an application VIP, you define it once (on any cluster node) and by default it can run on any cluster node.
This completes configuring the application VIP address.
使用ping
和tnsping
,以确保这两个主机可以到达对方。
请确保源可以达到的目标通过应用程序的 VIP 地址。
Host01-Linux (源) |
[oracle@host01 ogg]$ <span class="_obe_sff">ping qr01-vip </span> PING qr01-vip.example.com (192.0.2.99) 56(84) bytes of data. 64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=1 ttl=64 time=0.145 ms 64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=2 ttl=64 time=0.143 ms 64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=3 ttl=64 time=0.107 ms 64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=4 ttl=64 time=0.109 ms ^C --- qr01-vip.example.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.107/0.126/0.145/0.018 ms [oracle@host01 ogg]$ |
后几个成功 ping,取消使用 Ctrl + c。
请确保目标节点 2 可以访问使用tnsping
的数据库。这些别名从tnsnames.ora
将稍后使用的sqlplus
.
Exadata-节点 2 (目标) |
[oracle@qr01db02 ~]$<span class="_obe_sff"> more $ORACLE_HOME/network/admin/tnsnames.ora </span> # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome _1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. DBM = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = qr01-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbm.example.com) ) ) [oracle@qr01db02 ~]$<span class="_obe_sff"> tnsping dbm </span> TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 06-MAR-2013 13:45 Copyright (c) 1997, 2010, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = qr01-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbm.example.com))) OK (0 msec) [oracle@qr01db02 ~]$<span class="_obe_sff"> tnsping dbm1 </span> TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 06-MAR-2013 13:45 Copyright (c) 1997, 2010, Oracle. All rights reserved. Used parameter files: TNS-03505: Failed to resolve name [oracle@qr01db02 ~]$ |
"不合格"的tnsping
显示你不能到dbm1
,如单个实例的tnsping
,但你可以到群集数据库sqlplus user/pswd@dbm
。你能弄明白你在说到通过使用哪个实例sqlplus>
显示参数
instance_name。您可以通过设置和导出访问特定实例ORACLE_SID=dbm1
或其他一些特定的实例名称。
请确保目标节点 1 可以访问同一数据库使用相同的tnsname
.
Exadata-节点 1 (目标) |
[oracle@qr01db01 ~]$<span class="_obe_sff"> tnsping dbm </span> TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 06-MAR-2013 13:45 Copyright (c) 1997, 2010, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = qr01-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbm.example.com))) OK (0 msec) [oracle@qr01db01 ~]$ |
请注意这两个 RAC qr01-scan
指向实例 (这两个节点)。
这将完成测试数据库和 IP 连通性。
下面一节是差不多无论你使用的 Exadata 或 RAC 或只是一个单一的节点。
在源 host01 上创建 OGG 管理员oggadm1
。
Host01-Linux (源) |
[oracle@host01 ~]$<span class="_obe_sff"> sqlplus / as sysdba </span> SQL*Plus: Release 11.2.0.3.0 Production on Wed Feb 27 10:08:24 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL><span class="_obe_sff"> set sqlprompt 'host01_SQL> ' </span> host01_SQL><span class="_obe_sff"> SELECT log_mode, force_logging, supplemental_log_data_min FROM v$database; </span> LOG_MODE FOR SUPPLEME ------------ --- -------- ARCHIVELOG YES YES host01_SQL><span class="_obe_sff"> CREATE USER oggadm1 IDENTIFIED BY pswd1a; </span> User created. host01_SQL><span class="_obe_sff"> GRANT dba TO oggadm1; </span> Grant succeeded. host01_SQL><span class="_obe_sff"> EXEC DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE ('OGGADM1','capture',TRUE); </span> PL/SQL procedure successfully completed. host01_SQL> |
如果SELECT
返回ARCHIVELOG YES YES
然后没有进一步修改数据库需要。如果SELECT
返回NOARCHIVELOG NO NO
,然后请参阅如何更改,并在源数据库上执行的下一步骤。
默认情况下数据库处于NOARCHIVELOG
和force_logging=NO
。Goldengate 需要ARCHIVELOG
和force_logging=YES
。要改变这种下来需要要被关闭的数据库 (这两个节点)
!。第一次关闭目标节点 2。
Exadata-节点 2 (目标) |
[oracle@qr01db02 ~]$<span class="_obe_sff"> sqlplus / as sysdba </span> SQL*Plus: Release 11.2.0.2.0 Production on Wed Feb 27 09:59:04 2013 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL><span class="_obe_sff"> set sqlprompt 'qr01db_SQL> ' </span> qr01db_SQL><span class="_obe_sff"> SELECT log_mode, force_logging, supplemental_log_data_min FROM v$database; </span> LOG_MODE FOR SUPPLEME ------------ --- -------- NOARCHIVELOG NO NO qr01db_SQL><span class="_obe_sff"> shutdown immediate </span> Database closed. Database dismounted. ORACLE instance shut down. qr01db_SQL> |
set sqlprompt
的使用是可选的但它可以帮助您保持笔直的屏幕连接到哪个函数。
关闭目标节点 1。改变数据库和系统所需。
Exadata-节点 1 (目标) |
[oracle@qr01db01 ~]$<span class="_obe_sff"> sqlplus / as sysdba </span> SQL*Plus: Release 11.2.0.2.0 Production on Wed Feb 27 09:56:12 2013 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL><span class="_obe_sff"> set sqlprompt 'qr01db_SQL> ' </span> qr01db_SQL><span class="_obe_sff"> SELECT log_mode, force_logging, supplemental_log_data_min FROM v$database; </span> LOG_MODE FOR SUPPLEME ------------ --- -------- NOARCHIVELOG NO NO qr01db_SQL><span class="_obe_sff"> shutdown immediate </span> Database closed. Database dismounted. ORACLE instance shut down. qr01db_SQL><span class="_obe_sff"> startup mount </span> ORACLE instance started. Total System Global Area 939495424 bytes Fixed Size 2232088 bytes Variable Size 637534440 bytes Database Buffers 293601280 bytes Redo Buffers 6127616 bytes Database mounted. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE ARCHIVELOG; </span> ALTER DATABASE ARCHIVELOG * ERROR at line 1: ORA-01126: database must be mounted in this instance and not open in any instance qr01db_SQL><span class="_obe_sff"> ALTER DATABASE ARCHIVELOG; </span> Database altered. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE OPEN; </span> Database altered. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; </span> Database altered. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE FORCE LOGGING; </span> Database altered. qr01db_SQL><span class="_obe_sff"> ALTER SYSTEM SWITCH LOGFILE; </span> System altered. qr01db_SQL><span class="_obe_sff"> SELECT log_mode, force_logging, supplemental_log_data_min FROM v$database; </span> LOG_MODE FOR SUPPLEME ------------ --- -------- ARCHIVELOG YES YES qr01db_SQL><span class="_obe_sff"> COMMIT; </span> Commit complete. qr01db_SQL><span class="_obe_sff"> shutdown immediate </span> Database closed. Database dismounted. ORACLE instance shut down. qr01db_SQL> |
请注意ERROR ORA-01126
屏幕中间的。这是你看到的如果你忘了第一次关闭其他节点。离开目标节点 1 暂时关闭。
目标节点 2 上执行类似的步骤。
Exadata-节点 2 (目标) |
ORACLE instance shut down. SQL><span class="_obe_sff"> set sqlprompt 'qr01db_SQL> ' </span> qr01db_SQL><span class="_obe_sff"> startup mount </span> ORACLE instance started. Total System Global Area 939495424 bytes Fixed Size 2232088 bytes Variable Size 641728744 bytes Database Buffers 289406976 bytes Redo Buffers 6127616 bytes Database mounted. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE ARCHIVELOG; </span> Database altered. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE OPEN; </span> Database altered. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; </span> Database altered. qr01db_SQL><span class="_obe_sff"> ALTER DATABASE FORCE LOGGING; </span> ALTER DATABASE FORCE LOGGING * ERROR at line 1: ORA-12920: database is already in force logging mode qr01db_SQL><span class="_obe_sff"> ALTER SYSTEM SWITCH LOGFILE; </span> System altered. qr01db_SQL><span class="_obe_sff"> SELECT log_mode, force_logging, supplemental_log_data_min FROM v$database; </span> LOG_MODE FOR SUPPLEME ------------ --- -------- ARCHIVELOG YES YES qr01db_SQL> |
有意思的是,要注意哪些东西适用于 (有两个实例) 的实例,以及哪些东西应用到数据库 (那里是只有一个数据库)。例如,每个实例必须设置为ALTER DATABASE ADD SUPPLEMENTAL LOG DATA
,但单个数据库已经在FORCE LOGGING
从先前的实例。
当你成功时,SELECT
将返回ARCHIVELOG YES YES
.
现在,数据库发生更改,请将它启动。节点 2 已在运行,现在在节点 1 上启动的数据库。为 Exadata (此用户是可访问的节点 dbm1 或 dbm2) 创建 OGG 架构管理员用户。
Exadata-节点 1 (目标) |
ORACLE instance shut down. qr01db_SQL><span class="_obe_sff"> startup </span> ORACLE instance started. Total System Global Area 939495424 bytes Fixed Size 2232088 bytes Variable Size 637534440 bytes Database Buffers 293601280 bytes Redo Buffers 6127616 bytes Database mounted. Database opened. qr01db_SQL><span class="_obe_sff"> sho parameter name </span> NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string db_name string dbm db_unique_name string dbm global_names boolean FALSE instance_name string dbm1 lock_name_space string log_file_name_convert string processor_group_name string service_names string dbm.example.com qr01db_SQL><span class="_obe_sff"> CREATE USER oggadm2 IDENTIFIED BY pswd2a; </span> User created. qr01db_SQL><span class="_obe_sff"> GRANT dba TO oggadm2; </span> Grant succeeded. qr01db_SQL><span class="_obe_sff"> EXEC DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE ('OGGADM2','capture',TRUE); </span> PL/SQL procedure successfully completed. qr01db_SQL><span class="_obe_sff"> exit </span> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options [oracle@qr01db01 ~]$ |
OGG 的管理员授予 DBA 可能是大材小用,但很方便此示例。您可能会授予权限少在生产环境中。
此时,处理完事情,需要单独配置的两个节点。从现在开始,您可以选择对所有sqlplus
操作使用只是节点 1。
这样就完成了准备 Oracle GoldenGate 的数据库。
创建两个表空间 (一个大和一个小),持有两个DBFS。两个表空间将稍后有缓存的不同特性。
不论在目标节点 1 或 2 的目标节点上执行此步骤,它所有去到相同的共享的存储空间。dbfs_ogg_big
为选取的大小可能会在生产环境中的大得多。他们需要大得足以容纳所有跟踪文件。dbfs_ogg_small
为选取的大小可能会有关的权利。所有在小
DBFS 正在将是非常微小的检查点文件。
Exadata-节点 2 (目标) |
qr01db_SQL><span class="_obe_sff"> CREATE bigfile TABLESPACE dbfs_ogg_big datafile '+DBFS_DG' SIZE 100M autoextend ON NEXT 10M MAXSIZE 200M LOGGING EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO; </span> Tablespace created. qr01db_SQL><span class="_obe_sff"> CREATE bigfile TABLESPACE dbfs_ogg_small datafile '+DBFS_DG' SIZE 10M autoextend ON NEXT 1M MAXSIZE 20M LOGGING EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO; </span> Tablespace created. qr01db_SQL><span class="_obe_sff"> SELECT tablespace_name, logging, bigfile FROM dba_tablespaces WHERE tablespace_name like 'DBFS%'; </span> TABLESPACE_NAME LOGGING BIG --------------------------- --------- --- DBFS_OGG_BIG LOGGING YES DBFS_OGG_SMALL LOGGING YES qr01db_SQL><span class="_obe_sff"> SELECT table_name, segment_name, cache, logging FROM dba_lobs WHERE tablespace_name like 'DBFS%'; </span> no rows selected qr01db_SQL><span class="_obe_sff"> CREATE USER dbfs_user IDENTIFIED BY dbfs_pswd DEFAULT TABLESPACE dbfs_ogg_big QUOTA UNLIMITED ON dbfs_ogg_big QUOTA UNLIMITED ON dbfs_ogg_small; </span> User created. qr01db_SQL><span class="_obe_sff"> GRANT create session, create table, create view, create procedure, dbfs_role TO dbfs_user; </span> Grant succeeded. qr01db_SQL><span class="_obe_sff"> exit </span> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options [oracle@qr01db02 ~]$ |
请注意第二个SELECT
显示没有 Lob 尚存在。这将会改变下, 一步。
这样就完成了准备 DBFS 的数据库。关于 DBFS 的详细信息,请参阅大型对象 (Lob)文档.
这样就完成了准备环境。
本练习的目标是:
它是重要的是要运行的脚本将在客户端启动时 (步骤 2.3.1 和 2.3.2 步) 中指定的同一用户身份在此案例dbfs_user
。当运行 SQL @dbfs
脚本,确保他们有没有额外的换行符在参数中 (即使它们显示在示例中的换行符)。
Exadata-节点 2 (目标) |
[oracle@qr01db02 ~]$<span class="_obe_sff"> cd $ORACLE_HOME/rdbms/admin </span> [oracle@qr01db02 admin]$<span class="_obe_sff"> sqlplus dbfs_user/dbfs_pswd </span> SQL*Plus: Release 11.2.0.2.0 Production on Wed Feb 27 10:37:45 2013 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options qr01db_SQL><span class="_obe_sff"> @dbfs_create_filesystem_advanced.sql dbfs_ogg_big dbfs_big nocompress nodeduplicate noencrypt non-partition </span> qr01db_SQL> Rem qr01db_SQL> Rem $Header: rdbms/admin/dbfs_create_filesystem_advanced.sql /main/4 2010/04/14 13:21:30 weizhang Exp $ qr01db_SQL> Rem qr01db_SQL> Rem dbfs_create_filesystem.sql qr01db_SQL> Rem qr01db_SQL> Rem Copyright (c) 2009, 2010, Oracle and/or its affiliates. qr01db_SQL> Rem All rights reserved. qr01db_SQL> Rem qr01db_SQL> Rem NAME qr01db_SQL> Rem dbfs_create_filesystem_advanced.sql - DBFS create filesystem qr01db_SQL> Rem qr01db_SQL> Rem DESCRIPTION qr01db_SQL> Rem DBFS create filesystem script qr01db_SQL> Rem Usage: sqlplus @dbfs_create_filesystem_advanced.sql qr01db_SQL> Rem <tablespace_name> <filesystem_name> qr01db_SQL> Rem <compress-high compress-medium nocompress> qr01db_SQL> Rem <deduplicate nodeduplicate> <encrypt noencrypt> qr01db_SQL> Rem <non-partition partition partition-by-itemname qr01db_sql> Rem partition-by-guid, partition-by-path> qr01db_SQL> Rem qr01db_SQL> Rem NOTES qr01db_SQL> Rem qr01db_SQL> Rem MODIFIED (MM/DD/YY) qr01db_SQL> Rem weizhang 03/11/10 - bug 9220947: tidy up qr01db_SQL> Rem weizhang 06/12/09 - Package name change qr01db_SQL> Rem weizhang 04/06/09 - Created qr01db_SQL> Rem qr01db_SQL> qr01db_SQL> SET ECHO OFF No errors. -------- CREATE STORE: begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS_DBFS_BIG', tbl_name => 'T_DBFS_BIG', tbl_tbs => 'dbfs_ogg_big', lob_tbs => 'dbfs_ogg_big', do_partition => false, partition_key => 1, do_compress => false, compression => '', do_dedup => false, do_encrypt => false); end; -------- REGISTER STORE: begin dbms_dbfs_content.registerStore(store_name=> 'FS_DBFS_BIG', provider_name => 'sample1', provider_package => 'dbms_dbfs_sfs'); end; -------- MOUNT STORE: begin dbms_dbfs_content.mountStore(store_name=>'FS_DBFS_BIG', store_mount=>'dbfs_big'); end; -------- CHMOD STORE: declare m integer; begin m := dbms_fuse.fs_chmod('/dbfs_big', 16895); end; No errors. qr01db_SQL><span class="_obe_sff"> @dbfs_create_filesystem_advanced.sql dbfs_ogg_small dbfs_sm nocompress nodeduplicate noencrypt non-partition </span> No errors. -------- CREATE STORE: begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS_DBFS_SM', tbl_name => 'T_DBFS_SM', tbl_tbs => 'dbfs_ogg_small', lob_tbs => 'dbfs_ogg_small', do_partition => false, partition_key => 1, do_compress => false, compression => '', do_dedup => false, do_encrypt => false); end; -------- REGISTER STORE: begin dbms_dbfs_content.registerStore(store_name=> 'FS_DBFS_SM', provider_name => 'sample1', provider_package => 'dbms_dbfs_sfs'); end; -------- MOUNT STORE: begin dbms_dbfs_content.mountStore(store_name=>'FS_DBFS_SM', store_mount=>'dbfs_sm'); end; -------- CHMOD STORE: declare m integer; begin m := dbms_fuse.fs_chmod('/dbfs_sm', 16895); end; No errors. qr01db_SQL><span class="_obe_sff"> conn / as sysdba </span> Connected. qr01db_SQL><span class="_obe_sff"> SELECT tablespace_name, file_name FROM dba_data_files WHERE tablespace_name LIKE 'DBFS%'; </span> TABLESPACE_NAME FILE_NAME --------------- -------------------------------------------------- DBFS_OGG_BIG +DBFS_DG/dbm/datafile/dbfs_ogg_big.256.808464609 DBFS_OGG_SMALL +DBFS_DG/dbm/datafile/dbfs_ogg_small.257.808464635 qr01db_SQL><span class="_obe_sff"> SELECT table_name, segment_name, cache, logging FROM dba_lobs WHERE tablespace_name like 'DBFS%'; </span> TABLE_NAME SEGMENT_NAME CACHE LOGGING ----------------------- --------------------------- --------- ------- T_DBFS_BIG LOB_SFS$_FST_1 NO YES T_DBFS_SM LOB_SFS$_FST_11 NO YES qr01db_SQL><span class="_obe_sff"> ALTER TABLE dbfs_user.T_DBFS_SM MODIFY LOB (FILEDATA) (CACHE LOGGING); </span> qr01db_SQL><span class="_obe_sff"> SELECT table_name, segment_name, cache, logging FROM dba_lobs WHERE tablespace_name like 'DBFS%'; </span> TABLE_NAME SEGMENT_NAME CACHE LOGGING ----------------------- --------------------------- --------- ------- T_DBFS_BIG LOB_SFS$_FST_1 NO YES T_DBFS_SM LOB_SFS$_FST_11 YES YES qr01db_SQL><span class="_obe_sff"> exit </span> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options [oracle@qr01db02 admin]$ </non-partition></encrypt></deduplicate></compress-high></filesystem_name></tablespace_name> |
ALTER TABLE
变化较小的 DBFS 使用缓存。这是为小小的检查点的表很有用。没有缓存的更大的 DBFS 默认,更好地适合顺序阅读和写作,所使用的轨迹文件。
这样就完成了创建 DBFS LOB 的表。
DBFS 住在共享存储单元格上。
你可以找到任何地方的 DBFS,公约 》 下/mnt
.
Exadata-节点 2 (目标) |
[oracle@qr01db02 ~]$<span class="_obe_sff"> su - root </span> Password: [root@qr01db02 ~]#<span class="_obe_sff"> cd /mnt </span> [root@qr01db02 mnt]#<span class="_obe_sff"> mkdir DBFS </span> [root@qr01db02 mnt]#<span class="_obe_sff"> ll </span> total 4 drwxr-xr-x 2 root root 4096 Feb 27 10:34 DBFS [root@qr01db02 mnt]#<span class="_obe_sff"> chown oracle:oinstall DBFS/ </span> [root@qr01db02 mnt]#<span class="_obe_sff"> ll </span> total 4 drwxr-xr-x 2 oracle oinstall 4096 Feb 27 10:34 DBFS [root@qr01db02 mnt]#<span class="_obe_sff"> exit </span> [oracle@qr01db02 ~]$ |
您需要将root
来创建它,但然后更改回oracle
的所有权.
即使 DBFS 本身是在共享存储上,装入点需要在两个节点上定义。
Exadata-节点 1 (目标) |
[oracle@qr01db01 ~]$<span class="_obe_sff"> su - root </span> Password: [root@qr01db01 ~]#<span class="_obe_sff"> cd /mnt </span> [root@qr01db01 mnt]#<span class="_obe_sff"> mkdir DBFS </span> [root@qr01db01 mnt]#<span class="_obe_sff"> ll </span> total 4 drwxr-xr-x 2 root root 4096 Feb 27 10:34 DBFS [root@qr01db01 mnt]#<span class="_obe_sff"> chown oracle:oinstall DBFS/ </span> [root@qr01db01 mnt]#<span class="_obe_sff"> ll </span> total 4 drwxr-xr-x 2 oracle oinstall 4096 Feb 27 10:34 DBFS [root@qr01db01 mnt]#<span class="_obe_sff"> exit </span> [oracle@qr01db01 ~]$ |
这应该是所有 Exadata 节点上完全相同。
这样就完成了创建挂载点和目录结构。
虽然这些 DBFS 客户端启动手动作为概念证明的一部分,在生产中将定义这作为一种自动重新启动资源。
dbfs_user
匹配步 2.1.1 中定义脚本的用户。Exadata 目标节点 2 上启动 DBFS 客户端。不要按输入在键入的nohup
命令,都应该在一个逻辑行。然而,它的答复后,"appending
output to nohup.out
",您不必按 Enter,再把控制返回给操作系统提示符。
Exadata-节点 2 (目标) |
[oracle@qr01db02 ~]$<span class="_obe_sff"> cd ~ </span> [oracle@qr01db02 ~]$<span class="_obe_sff"> echo dbfs_pswd > passwd.txt </span> [oracle@qr01db02 ~]$<span class="_obe_sff"> nohup $ORACLE_HOME/bin/dbfs_client dbfs_user@dbm -o allow_other,direct_io /mnt/DBFS [1] 5670 [oracle@qr01db02 ~]$ nohup: appending output to `nohup.out' [oracle@qr01db02 ~]$<span class="_obe_sff"> ll /mnt/DBFS/ </span> total 0 drwxrwxrwx 3 root root 0 Feb 27 10:39 dbfs_big drwxrwxrwx 3 root root 0 Feb 27 10:40 dbfs_sm [oracle@qr01db02 ~]$<span class="_obe_sff"> df -k </span> Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda2 8022104 2639960 4968072 35% / /dev/xvda1 101086 130</span> |