源端 OS:Red Hat Enterprise Linux Server release 5.5 (Tikanga) ORACLE:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production shareplex目錄:/oradata/shareplex 目的端: OS:Red Hat Enterprise Linux Server release 5.8
源端
OS:Red Hat Enterprise Linux Server release 5.5 (Tikanga)
ORACLE:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
shareplex目錄:/oradata/shareplex
目的端:
OS:Red Hat Enterprise Linux Server release 5.8 (Tikanga)
ORACLE:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
shareplex目錄:/data/shareplex
shareplex軟件:SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tar
解壓后:SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tpm
1)創建SPLEX用戶及設置歸檔模式
A 、源端與目標端--創建用戶及授權(注意系統時間):
create user splex identified by splex default tablespace users;----最好為SPLEX用戶單獨創建一個表空間
grant dba,connect,resource to splex;---SPLEX必須有DBA權限
源端必須處于歸檔模式
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 7
Next log sequence to archive 9
Current log sequence 9
alter database add supplemental log data (primary key,unique index) columns;
目標端創建需同步進去的數據(注意在目標端創建好源端默認表空間及數據表空間)
create user test identified by test default tablespace TBS_DATA01;
grant connect,resource,unlimited tablespace to test;
2) 安裝shareplex
源端
$ ./SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tpm
Unpacking ..................................................................
..........................................................................
..........................................................................
..........................................................................
SharePlex for Oracle installation program:
SharePlex Version: 7.6.1
Supported Oracle Version: 10gR2
Build platform: rh-40-amd64
Target platform: rh-40-amd64
Please enter the product directory location? /oradata/shareplex/prodir
Please enter the variable data directory location? /oradata/shareplex/vardir
Please specify the SharePlex Admin group (select a number):
1. [oinstall]
2. dba
3. oper
?
Please wait while the installer obtains Oracle information ..
Please enter the ORACLE_SID that corresponds to this installation? [hrdb]
Please enter the ORACLE_HOME directory that corresponds to this ORACLE_SID? [/opt/app/oracle/product/10.2.0/db_1]
Please enter the TCP/IP port number for SharePlex communications? [2100] 2200
Preparing to install SharePlex for Oracle v. 7.6.1:
User: oracle
Admin Group: oinstall
Product Directory: /oradata/shareplex/prodir
Variable Data Directory: /oradata/shareplex/vardir
ORACLE_SID: hrdb
ORACLE_HOME: /opt/app/oracle/product/10.2.0/db_1
Proceed with installation? [yes]
Installing ................................................................
.........................................................................
....................................................................
Setting file ownerships ...................................................
.........................................................................
........
Setting file permissions ..................................................
.........................................................................
.........
Do you have a valid SharePlex for Oracle v. 7.6.1 license? [yes]
Please enter the License key? XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Please enter the customer name associated with this license key? YYYYYYYYYYYYYYYYYYYYYYYYYYY
SharePlex for Oracle v. 7.6.1 license validation successful:
Customer Name: YYYYYYYYYYYYYYYYYYYYYYYYYYY
License Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Product Name: SharePlex for Oracle - RAC
License Key Type: "Perpetual Key"
NOTE: You can upgrade this license key or add license keys for additional machines
by executing utility /oradata/shareplex/prodir/install/splex_add_key.
Installation log saved to: /home/oracle/.shareplex/INSTALL-SharePlex-7.6.1-1106130040.log
SharePlex for Oracle v. 7.6.1 installation successful.
$ ./ora_setup
Welcome to the Oracle SharePlex setup process.
This process creates tables and user accounts needed to run
Oracle SharePlex replication.
Please note the following:
** In response to prompts, a carriage return will choose the default
given in brackets. If there is no default, a reply must be entered.
** To exit the program while the program is waiting for input, use the
CTRL-C key sequence.
This sequences can be entered by holding down the CONTROL key and
pressing the C key.
Enter the Oracle SID for which SharePlex should be installed [hrdb] :
In order to create the SharePlex tables and user account, we must
connect to the database as a DBA user
Enter a DBA user name : system
Enter password for the DBA account, which will not echo :
注意:RAC環境下,此處輸入oracle數據庫system帳戶的口令,但應當在口令的后面加上@TNS_ALIAS,然后回車;
注意:RAC環境下,此處輸入OracleSharePlex用戶的口令,但應當在口令的后面加上@TNS_ALIAS, 然后回車;
3)目標端安裝shareplex
安裝shareplex過程中./SharePlex-7.6.1-b27-oracle100-rh-40-amd64-m64.tpm及./ora_setup類似,不同
之外在于
Oracle ASM detected. Enable SharePlex ASM support? [y] :
SharePlex ASM support enabled.
(備注:如在源端或目標端都有安裝過shareplex,則記得清除SPLEX用戶capture或post信息,則在啟動前記得以下操作:
./ora_cleansp splexhr/splexhr
)
3) 源端操作
A 、啟動shareplex
[oracle@hrdb bin]$ ./sp_cop -u2200 &
[1] 25839
[oracle@hrdb bin]$
*******************************************************
* SharePlex for Oracle Startup
* 10 Quest Software, Inc.
* ALL RIGHTS RESERVED.
* Protected by U.S. Patents: 7,461,103 and 7,065,538
* Version: 7.6.1.27-m64-oracle100
* VarDir : /oradata/shareplex/vardir
* Port : 2200
*******************************************************
B 、進入控制臺
[oracle@hrdb bin]$ ./sp_ctrl
*******************************************************
* SharePlex for Oracle Command Utility
* 10 Quest Software, Inc.
* ALL RIGHTS RESERVED.
* Protected by U.S. Patents: 7,461,103 and 7,065,538
*******************************************************
C 、添加配置文件
sp_ctrl (hrdb:2200)> list config
File Name State Datasource
-------------------------------------------------- ---------- ---------------
ORA_config Inactive o.SOURCE_SID
Last Modified At: 13-Jun-11 00:43 Size: 151
sp_ctrl (hrdb:2200)> copy config ORA_config to hr_config
sp_ctrl (hrdb:2200)> view config hr_config
datasource:o.hrdb
#source tables target tables routing map
splex.demo_src splex.demo_dest 10.1.2.18@o.backupdb
expand TEST.% TEST.% 10.1.2.18@o.backupdb
4)目標端操作
$./sp_cop -u2200 &
$./sp_ctrl
sp_ctrl (backupdb:2200)> status
Brief Status for backupdb
Process State PID Running Since
--------------- ------------------------------ -------- --------------------
Cop Running 26483 31-Jul-12 09:31:06
Cmd & Ctrl Running 26485 31-Jul-12 09:31:14
There are no active configuration files
sp_ctrl (backupdb:2200)> stop post
5)源端
sp_ctrl (hrdb:2200)> activate config hr_config
Not all tables activated successfully
源端-導出數據(這里使用SCN來保證 一致性):
SQL> set num 50expdp system/XXXX DIRECTORY=DUMP_DIR DUMPFILE=20120730_HR.dmp FLASHBACK_SCN=165290627611 SCHEMAS=test LOGFILE=20120730_HR.log
或用EXP方式
6) 目標端
impdp system/oracle DIRECTORY=DUMP_DIR DUMPFILE=20120730_HR.dmp SCHEMAS=test LOGFILE=impdp_2012730_HR.log
或用IMP方式
禁用查找相關JOB
select job_name from dba_scheduler_jobs where OWNER='TEST';
禁用觸發器
select 'alter trigger '||owner||'.'||object_name||' disable'
from dba_objects
where object_type='TRIGGER' and owner='TEST';
查找外鍵及約束
select 'alter table '||t.owner||'.'||t.table_name||' disable constraint '||t.constraint_name||';'
From dba_constraints t
where owner='TEST' and constraint_type='R';
sp_ctrl (backupdb:2200)> qstatus
Queues Statistics for backupdb
Name: hrdb (o.hrdb-o.backupdb) (MTPost queue)
Number of messages: 207 (Age 0 min; Size 0 mb)
Backlog (messages): 207 (Age 0 min)
sp_ctrl (backupdb:2200)>reconcile queue hrdb for o.hrdb-o.backupdb scn 165290627611
sp_ctrl (backupdb:2200)>start post
(
清除源端或目標端下隊列記錄信息:
$ ./ora_cleansp splexhr/splexhr
在CONFIG文件配置錯誤的情況下已經activate時,需deactivate config后再行編輯激活;否則,有可能激活CONFIG后,一直HANG住
***********************************
注意在RAC環境下:
1、如果兩個節點的實例名字不一樣,就必須在Oracle10g RAC的兩個節點的tnsnames.ora文件中都建立一個TNS別名,然后在/etc/oratab文件中添加如下入口:
splex:/oracle/product/db/10.2:N
其中splex為新建的TNS別名;ORACLE_HOME為Oracle的HOME目錄的全路徑2、如果RAC中各個節點的ORACLE_HOME不同,應該在兩個節點上oracle用戶下創建相同符號連接指向示本地的ORACLE_HOME 。然后編輯oratab文件,將文件中的路徑改成符號連接。
# ln -s /local_ORACLE_HOME /$ORACLE_HOME
編輯 oratab file : SID:/pathname_to_symbolic_link:N
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com