Você está na página 1de 5

The following steps are required to configure the CDC option for Oracle through LogMiner Grant required

uired Oracle privileges. Enable ARCHIVELOG mode. Enable global minimal supplement logging. Configure Oracle LogMiner. Copy the Oracle catalog to the archived redo logs.

Configuring Oracle for LogMiner CDC This section describes steps for configuring Oracle for LogMiner CDC. For sample SQL and DDL, refer to the oracapt.sql file. Step 1. Specify an Archive Log Destination Edit the init.ora file to specify the archive log destination and file-name format. Alternatively, if we use a server parameter file (spfile), issue the following SQL statements to indicate the archive log destination: CONNECT SYS/sys_pwd AS SYSDBA; ALTER SYSTEM SET log_archive_dest_1 = 'location=/oracle_path/arch' SCOPE=SPFILE; Step 2. Enable ARCHIVELOG Mode For CDC, Oracle must be running in ARCHIVELOG mode. By default, ARCHIVELOG mode is not enabled. To enable ARCHIVELOG mode, issue the following statements: SHUTDOWN IMMEDIATE; STARTUP MOUNT; ALTER DATABASE ARCHIVELOG; ALTER DATABASE OPEN; SHUTDOWN IMMEDIATE; STARTUP; Tip: Back up our database after both SHUTDOWN commands. If we use the Oracle init.ora initialization parameter file, we must edit the appropriate parameters in this file to identify the archive log destination and file name format. If we use a server parameter file (spfile), we must execute some ALTER SYSTEM SET SQL. Step 3. Stop and Restart the Oracle Database If we changed the ARCHIVELOG mode, we must stop and restart the Oracle instance for our change to take effect.

Step 4. Grant User Privileges Required for Oracle LogMiner CDC To define Oracle user that can run powerexchange Oracle real time CDC, use the following Create User statement. We can use any Oracle user that has the authority to run the following CREATE USER and GRANT statements. For example a user with the DBA role CREATE USER ORACAPT PROFILE DEFAULT IDENTIFIED BY oracapt ACCOUNT UNLOCK; GRANT CONNECT TO ORACAPT To extract change data from Oracle redo logs, a CDC user must have specific Oracle system and object privileges. We can either use an existing user (above user ORACAPT) who has the required authority as the CDC user, or create a user and grant the required privileges to that user. The following table identifies the minimum system privileges that Oracle CDC users must have: Note : We have to give privilege to the user ORACAPT System Privilege Granted ALTER ANY TABLE Oracle Release All Description Required for users that create capture registrations and allow PowerExchange to automatically run the DDL that is generated for creating a supplemental log group at registration completion.

CONNECT

ALL

Required for users who extract Oracle CDC data in real time and run PowerExchange Logger tasks. Note: With Oracle 10g and later, users need only the CREATE SESSION

privilege on the CONNECT role.


LOCK ANY TABLE All If we specify GENRLOCK=Y in the ORCL CAPI_CONNECTION statement of the dbmover.cfg file, we must either grant the LOCK ANY TABLE system privilege or grant the SELECT object privilege on each table that is registered for change data capture. Required for users who extract Oracle CDC data in real time and for PowerExchange Logger tasks.

SELECT ANY TRANSACTION

10g and later

The following table identifies the minimum object privileges that Oracle CDC users must have: Note : We have to give privilege to the user ORACAPT Object Name Object Privilege PUBLIC.V$ARCHIVED_LOG SELECT PUBLIC.V$DATABASE SELECT PUBLIC.V$INSTANCE SELECT PUBLIC.V$LOGMNR_CONTENTS SELECT PUBLIC.V$NLS_PARAMETERS SELECT PUBLIC.V$PARAMETER SELECT PUBLIC.V$TRANSACTION SELECT SYS.DBA_LOG_GROUPS SELECT SYS.DBA_LOG_GROUP_COLUMNS SELECT SYS.DBMS_FLASHBACK EXECUTE SYS.DBMS_LOGMNR EXECUTE SYS.DBMS_LOGMNR_D EXECUTE Commit all changes that we have made up to this point. Step 5. Configuring Oracle Minimal Global Supplemental Logging PowerExchange requires Oracle to use minimal global supplemental logging for Oracle LogMiner to properly handle chained rows. To enable minimal global supplemental logging, log in to the Oracle database and execute the following SQL statement

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; COMMIT; If we do not know whether minimal global supplemental logging has been enabled for our database, we can still execute this ALTER statement. The statement has no effect if minimal supplemental logging is active. Step 6. Create a Table Space for Oracle LogMiner Use Create a table space exclusively for Oracle LogMiner use. Do this step only if we did not previously configure LogMiner for use with other Oracle features such as logical standby databases, Oracle Streams, or native Oracle change capture processes. This step prevents the SYSTEM table space (in Oracle 9i) or SYSAUX table space (in Oracle 10g or later) from becoming full and causing service problems during PowerExchange CDC To create the LogMiner table space, To create the table space, issue the following DDL: CREATE TABLESPACE "LOGMNRTS" NOLOGGING DATAFILE '/oracle_path/datafilename.ora' SIZE 50M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 100M EXTENT MANAGEMENT LOCAL; Specify NOLOGGING if we use Oracle LogMiner only for PowerExchange CDC and an occasional query. Change NOLOGGING to LOGGING if we use any of the following Oracle features: logical standby databases, OracleStreams, or native Oracle change capture processes. For the DATAFILE value, specify a file name based on wer local Oracle database file naming standards for the data files that comprise this table space. 2. Enter the following command: EXECUTE SYS.DBMS_LOGMNR_D.SET_TABLESPACE('LOGMNRTS'); If this statement fails with the ORA_01353 message, see the Oracle DOC id: 194281.1 for an explanation of this might occur. If we are sure that this situation does not apply to us and bouncing our Oracle instance does not help we can login in to oracle as user sys and execute $ORACLE_HOME/rdbms/admin/dbmslmd.sql . This will recreates the LogMiner environment and should allow us to execute the above SET_TABLESPACE command. Note: Extreme caution should be used when executing dbmslmd.sql 3. To recompile the SYS.DBMS_LOGMNR_D package, enter the following command: ALTER PACKAGE SYS.DBMS_LOGMNR_D COMPILE BODY; Tip: LogMiner opens a number of cursors internally to handle its processing. When we configure LogMiner for the first time, we might receive messages that

state number of open cursors exceeded. We can increase the maximum number of open cursors to handle the extra LogMiner processing. Step 7. Copy the Oracle Catalog to the Archived Logs PowerExchange CDC requires a copy of the Oracle online catalog in the Oracle archived redo logs to determine the point from which to restart change data extractions. PowerExchange reads the last catalog copy in the archived logs, even if we specified ONLINECAT=Y in theORCL CAPI_CONNECTION statement. We should copy the catalog on a routine basis to minimize CDC restart times. To copy the catalog, issue the following command in an SQL*Plus session: begin SYS.DBMS_LOGMNR_D.BUILD( options => sys.dbms_logmnr_d.store_in_redo_logs); end;

Você também pode gostar