Oracle GoldenGate (rac-single)
阿新 • • 發佈:2018-11-09
源端資料庫配置 [[email protected] ~]# su - oracle [[email protected] ~]$ sqlplus / as sysdba SQL> create tablespace goldengate datafile '+DATAFILE' size 1024M; Tablespace created. SQL> create user ggs identified by ggs default tablespace goldengate; User created. SQL> grant dba to ggs; Grant succeeded. SQL> select log_mode from v$database; LOG_MODE ------------------------------------ ARCHIVELOG SQL> alter database force logging; Database altered. SQL> select force_logging from v$database; FORCE_LOGGING ------------------------------ YES SQL> alter database add supplemental log data; Database altered. SQL> col supplemental_log_data_min for a30 SQL> select supplemental_log_data_min from v$database; SUPPLEMENTAL_LOG_DATA_MIN ------------------------------ YES SQL> alter system set enable_goldengate_replication=true; SQL> alter system archive log current;
源端安裝OGG [[email protected] ~]$ vi .bash_profile export OGG_HOME=/u01/app/ogg export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export PATH=$OGG_HOME:$PATH [[email protected] ~]$ source .bash_profile [[email protected] ~]$ mkdir -p /u01/app/ogg [[email protected] ~]$ unzip fbo_ggs_Linux_x64_shiphome [[email protected] ~]$ cd fbo_ggs_Linux_x64_shiphome/Disk1 [[email protected] Disk1]$ ./runInstaller
[[email protected] ~]$ cd /u01/app/ogg [[email protected] ogg]$ ./ggsci GGSCI (amb01) 1> create subdirs Creating subdirectories under current directory /u01/app/ogg Parameter files /u01/app/ogg/dirprm: created Report files /u01/app/ogg/dirrpt: created Checkpoint files /u01/app/ogg/dirchk: created Process status files /u01/app/ogg/dirpcs: created SQL script files /u01/app/ogg/dirsql: created Database definitions files /u01/app/ogg/dirdef: created Extract data files /u01/app/ogg/dirdat: created Temporary files /u01/app/ogg/dirtmp: created Credential store files /u01/app/ogg/dircrd: created Masterkey wallet files /u01/app/ogg/dirwlt: created Dump files /u01/app/ogg/dirdmp: created GGSCI (amb01) 2> edit params mgr PORT 7839 DYNAMICPORTLIST 7840-7939 AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3 PURGEOLDEXTRACTS ./dirdat/*,USECHECKPOINTS, MINKEEPDAYS 7 LAGREPORTHOURS 1 LAGINFOMINUTES 3 LAGCRITICALMINUTES 10 GGSCI (amb01) 3> start mgr Manager started. GGSCI (amb01) 4> info mgr Manager is running (IP port amb01.7839, Process ID 3243). 源端EXTRACT程序組 GGSCI (amb01) 5> dblogin userid ggs,password ggs Successfully logged into database. GGSCI (amb01 as[email protected]) 6> add schematrandata soe 2018-11-09 08:45:58 INFO OGG-01788 SCHEMATRANDATA has been added on schema soe. 2018-11-09 08:45:58 INFO OGG-01976 SCHEMATRANDATA for scheduling columns has been added on schema soe. GGSCI (amb01 as [email protected]) 7> add extract ext_soe, tranlog, begin now, threads 2 EXTRACT added. GGSCI (amb01 as [email protected]) 8> add exttrail ./dirdat/st,extract ext_soe,megabytes 100 EXTTRAIL added. GGSCI (amb01) 2> edit params ext_soe EXTRACT ext_soe DYNAMICRESOLUTION USERID ggs,PASSWORD ggs TRANLOGOPTIONS DBLOGREADER EXTTRAIL ./dirdat/st TABLEEXCLUDE SOE.ORDERENTRY_METADATA TABLE SOE.*; GGSCI (amb01 as [email protected]) 10> start ext_soe Sending START request to MANAGER ... EXTRACT EXT_SOE starting GGSCI (amb01 as [email protected]) 11> info ext_soe EXTRACT EXT_SOE Last Started 2018-11-08 17:05 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:00:03 ago) Process ID 7172 Log Read Checkpoint Oracle Redo Logs 2018-11-09 08:53:58 Thread 1, Seqno 74, RBA 27958272 SCN 0.1517400 (1517400) Log Read Checkpoint Oracle Redo Logs 2018-11-09 08:54:01 Thread 2, Seqno 58, RBA 19046912 SCN 0.1517403 (1517403) 源端PUMP程序組 GGSCI (amb01 as [email protected]) 12> add extract pmp_soe, exttrailsource ./dirdat/st EXTRACT added. GGSCI (amb01 as [email protected]) 13> add rmttrail ./dirdat/rt,EXTRACT pmp_soe,megabytes 100 RMTTRAIL added. GGSCI (amb01 as [email protected]) 14> edit params pmp_soe EXTRACT pmp_soe PASSTHRU RMTHOST 192.168.1.203, MGRPORT 7839, COMPRESS RMTTRAIL ./dirdat/rt TABLE SOE.*; GGSCI (amb01 as [email protected]) 15> start pmp_soe Sending START request to MANAGER ... EXTRACT PMP_SOE starting GGSCI (amb01 as [email protected]) 16> info pmp_soe EXTRACT PMP_SOE Last Started 2018-11-08 17:01 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:00:07 ago) Process ID 6690 Log Read Checkpoint File /u01/app/ogg/dirdat/st000000000 First Record RBA 1382 GGSCI (amb01 as [email protected]) 17> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING EXT_SOE 00:00:00 00:00:01 EXTRACT RUNNING PMP_SOE 00:00:00 00:00:04
源端備份資料庫 [[email protected] ~]$ mkdir /u01/app/oracle/backup [[email protected] ~]$ rman target / RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/backup/%F'; RMAN> RUN { BACKUP INCREMENTAL LEVEL=0 TAG 'FULL_BACKUP' DATABASE FORMAT '/u01/app/oracle/backup//soe_full_incr_%s_%p_%T' PLUS ARCHIVELOG FORMAT '/u01/app/oracle/backup/soe_arch_%s_%p_%T' delete all input; DELETE NOPROMPT OBSOLETE; CROSSCHECK BACKUP; DELETE NOPROMPT EXPIRED BACKUP; } [[email protected] ~]$ sqlplus / as sysdba SQL> select to_char(current_scn) from v$database; TO_CHAR(CURRENT_SCN) ---------------------------------------- 1419545 SQL> alter system archive log current ; System altered. SQL> alter system archive log current ; System altered. SQL> alter system archive log current ; System altered. [[email protected] ~]$ rman target / RMAN> backup archivelog all FORMAT '/u01/app/oracle/backup/soe_arch_%s_%p_%T'; [[email protected] ~]$ cd /u01/app/oracle/backup [[email protected] backup]$ scp * 192.168.1.203:/u01/app/oracle/backup/