How to start database and Apps

Posted by Sagar Patil

(Release 12)

Login as database user
cd $ORACLE_HOME/appsutil/scripts/<SID_hostname>

./addbctl.sh start <Database Name> : To start Database

./addlnctl.sh start <Listener Name> : To start Listener

Login as apps user “applmgr”

cd $APPLCSF/scripts/<SID_hostname>
./adstrtal.sh apps/<apps_password>

You can stop the application by:
Login as apps user “applmgr”
./adstpall.sh apps/<apps_password>

For stopping listener and database:
./addlnctl.sh stop <listener_name> : Stop the listener

./addbctl.sh stop immediate : would carry “shutdown immediate” at database

================= Release 12 log ==============

[oracle@apps ~]$ . APPSVIS_ebs.env

Start database and listener before starting middle tier

Login as database user , Locate “addbctl.sh” and run this script

[oracle@apps ~]$ ./addbctl.sh

You are running addbctl.sh version 120.1

addbctl.sh: too few arguments specified.

addbctl.sh [start|stop] {normal|immediate|abort}

[oracle@apps ~]$ ./addbctl.sh start

You are running addbctl.sh version 120.1

Starting the database VIS …

SQL*Plus: Release 10.2.0.3.0 – Production on Sat Feb 14 13:07:25 2009

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to an idle instance.
ORACLE instance started.

Total System Global Area 159383552 bytes
Fixed Size 1260600 bytes
Variable Size 88081352 bytes
Database Buffers 58720256 bytes
Redo Buffers 11321344 bytes
Database mounted.
Database opened.
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – Production
With the Partitioning, OLAP and Data Mining options

addbctl.sh: exiting with status 0

2. Start listener

[oracle@apps ~]$ cd /oradb/oracle/VIS/db/tech_st/10.2.0/appsutil/scripts/VIS_apps/
[oracle@apps VIS_apps]$ ./addlnctl.sh start VIS

You are running addlnctl.sh version 120.1

Logfile: /oradb/oracle/VIS/db/tech_st/10.2.0/appsutil/log/VIS_apps/addlnctl.txt

Starting listener process VIS …

addlnctl.sh: exiting with status 0
[oracle@apps VIS_apps]$

Let’s start the middle Tier

[applmgr@apps scripts]$ ./adstrtal.sh apps/apps

You are running adstrtal.sh version 120.13.12000000.3

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/adopmnctl.sh start
script returned:
****************************************************

You are running adopmnctl.sh version 120.4.12000000.3

Starting Oracle Process Manager (OPMN) …

adopmnctl.sh: exiting with status 0

adopmnctl.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adopmnctl.txt for more information …

.end std out.

.end err out.

****************************************************

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/adapcctl.sh start
script returned:
****************************************************

You are running adapcctl.sh version 120.6.12000000.2

Starting OPMN managed Oracle HTTP Server (OHS) instance …

adapcctl.sh: exiting with status 150

adapcctl.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adapcctl.txt for more information …

.end std out.

.end err out.

****************************************************

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/adoacorectl.sh start
script returned:
****************************************************

You are running adoacorectl.sh version 120.11.12000000.2

Starting OPMN managed OACORE OC4J instance …

adoacorectl.sh: exiting with status 204

adoacorectl.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adoacorectl.txt for more information …

.end std out.

.end err out.

****************************************************

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/adformsctl.sh start
script returned:
****************************************************

You are running adformsctl.sh version 120.12.12000000.3

Starting OPMN managed FORMS OC4J instance …

adformsctl.sh: exiting with status 204

adformsctl.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adformsctl.txt for more information …

.end std out.

.end err out.

****************************************************

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/adoafmctl.sh start
script returned:
****************************************************

You are running adoafmctl.sh version 120.6.12000000.2

Starting OPMN managed OAFM OC4J instance …

adoafmctl.sh: exiting with status 204

adoafmctl.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adoafmctl.txt for more information …

.end std out.

.end err out.

****************************************************

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/adalnctl.sh start
script returned:
****************************************************

adalnctl.sh version 120.3

Checking for FNDFS executable.
Starting listener process APPS_VIS.

adalnctl.sh: exiting with status 0

adalnctl.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adalnctl.txt for more information …

.end std out.

.end err out.

****************************************************

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/adcmctl.sh start
script returned:
****************************************************

You are running adcmctl.sh version 120.14

Starting concurrent manager for VIS …
Starting VIS_0214@VIS Internal Concurrent Manager
Default printer is noprint

adcmctl.sh: exiting with status 0

adcmctl.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adcmctl.txt for more information …

.end std out.

.end err out.

****************************************************

Executing service control script:
/orapps/oracle/VIS/inst/apps/VIS_apps/admin/scripts/jtffmctl.sh start
script returned:
****************************************************

You are running jtffmctl.sh version 120.3

Validating Fulfillment patch level via /orapps/oracle/VIS/apps/apps_st/comn/java/classes
Fulfillment patch level validated.
Starting Fulfillment Server for VIS on port 9300 …

jtffmctl.sh: exiting with status 0

.end std out.

.end err out.

****************************************************

adstrtal.sh: Exiting with status 4

adstrtal.sh: check the logfile /orapps/oracle/VIS/inst/apps/VIS_apps/logs/appl/admin/log/adstrtal.log for more information …

(Release 11)

Execute the following script in the sequence shown below
$ORACLE_HOME/appsutil/scripts/VIS_vision/addbctl.sh start

$ORACLE
_HOME/appsutil/scripts/VIS_vision/addlnctl.sh start VIS

/u01/oracle/viscomn/admin/scripts/VIS_vision/adstrtal.sh apps/apps

To stop the services execute the script in the following sequence.
/u01/oracle/viscomn/admin/scripts/VIS_vision/adstpall.sh apps/apps

$ORACLE_HOME/appsutil/scripts/VIS_vision/addlnctl.sh stop VIS

$ORACLE_HOME/appsutil/scripts/VIS_vision/addbctl.sh stop immediate

API to Retrieve runtime Replication Parameters

Posted by Sagar Patil

We often get thousands of replication conflits/errors at current system. A resolution is generally looking at EM console and resolving each error manually.  Please see examples below.

This approach is working well until we have less than some thousands error x’actions at DEFERROR. Anything above that is causing a performance hit. Also DEFERROR /DEFTRANS get highly fragmented adding to the current problem. A solution would be writing a PLSQL API to retrieve runtime parameters as and when needed than using EM console to retrieve millions of rows.

SELECT argcount, schemaname, packagename, procname
FROM defcall WHERE  deferred_tran_id in
(select  deferred_tran_id from deftran where rownum <100)

ARGCOUNT	SCHEMANAME	PACKAGENAME	PROCNAME
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
17	CVD_SYSTEM	VOUCHER	REP_UPDATE
9	CVD_SYSTEM	VOUCHER_EVENT	REP_INSERT
SELECT e.destination, e.deferred_tran_id, e.origin_tran_db, e.origin_tran_id,
  e.start_time, count(e.callno)
FROM
 sys.deferror e, sys.defcall c WHERE e.deferred_tran_id = c.deferred_tran_id
  GROUP BY e.destination, e.deferred_tran_id, e.origin_tran_db,
  e.origin_tran_id, e.start_time ORDER BY 1
DESTINATION	DEFERRED_TRAN_ID	ORIGIN_TRAN_DB	ORIGIN_TRAN_ID	START_TIME	COUNT(E.CALLNO)CPI_O5CA.O2	105.45.83730	CPI_O5CB.O2	120.23.60368	09/11/2008 20:24:50	3
CPI_O5CA.O2	107.12.84097	CPI_O5CB.O2	121.41.62034	09/11/2008 20:24:51	1
CPI_O5CA.O2	107.13.84100	CPI_O5CB.O2	123.47.50472	09/11/2008 20:24:52	3
CPI_O5CA.O2	108.1.83596	CPI_O5CB.O2	123.42.50472	09/11/2008 20:24:52	1
SELECT error_msg FROM deferror
    WHERE deferred_tran_id = '107.12.84097' AND callno = 2

ERROR_MSG
ORA-01403: no data found
SELECT t.deferred_tran_id, d.dblink, t.start_time, count(c.callno)
               FROM sys.deftran t, sys.defcall c, sys.deftrandest d
            WHERE d.deferred_tran_id = t.deferred_tran_id
           AND c.deferred_tran_id = t.deferred_tran_id
          GROUP BY t.deferred_tran_id, t.start_time, d.dblink ORDER BY 3 desc
Find out the Argument Count and Call number :
select deferred_tran_id, callno, argcount, procname, packagename, schemaname
             from defcall;
Substitute Transaction ID, Argument Number and Call Number to locate parameter for that Call 

DECLARE
       atype       INTEGER;
       csform          NUMBER;
       arg_no      NUMBER;
       callno      NUMBER;
       tid         VARCHAR2(22);
       outval      VARCHAR2(2000);
BEGIN
    arg_no:=1;
    callno:='0';
    tid:='105.45.83730';
    atype:=dbms_defer_query.get_arg_type(callno, arg_no, tid);
    csform:=dbms_defer_query.get_arg_form(callno, arg_no, tid);
    IF atype = 2 THEN
      outval:=to_char(dbms_defer_query.get_number_arg(callno, arg_no, tid));
    ELSIF atype = 96 and
          csform = 1 THEN
      outval:=dbms_defer_query.get_char_arg(callno, arg_no, tid);
    ELSIF atype = 96 and
          csform = 2 THEN
      outval:=translate(dbms_defer_query.get_nchar_arg(callno, arg_no, tid) USING CHAR_CS);
    ELSIF atype= 1 and
          csform = 1 THEN
      outval:=dbms_defer_query.get_varchar2_arg(callno, arg_no, tid);
    ELSIF atype= 1 and
              csform = 2 THEN
      outval:=translate(dbms_defer_query.get_nvarchar2_arg(callno, arg_no, tid) USING CHAR_CS);
    ELSIF atype = 12 THEN
         outval:=to_char(dbms_defer_query.get_date_arg(callno, arg_no, tid), 'DD-MON-YYYY HH24:MI:SS');
    ELSIF atype = 23 THEN
         outval:=rawtohex(dbms_defer_query.get_raw_arg(callno, arg_no, tid));
    ELSIF atype = 11 THEN
         outval:=dbms_defer_query.get_rowid_arg(callno, arg_no, tid);
    ELSE
         outval:='-Binary Value-';
      -- RAISE NO_DATA_FOUND;
    END IF;
    dbms_output.put_line(outval);
END;

Average Amount of Time to Apply Transactions at Remote Sites

Posted by Sagar Patil

SELECT substr(DBLINK,1,25), AVG_LATENCY “Average Latency”
FROM DEFSCHEDULE
WHERE upper(DBLINK) like ‘&1’;

Average latency is the average number of seconds between the first call of a transaction on the current site and the confirmation that the transaction was applied at the remote site. The

SQL> SELECT substr(DBLINK,1,25), AVG_LATENCY “Average Latency”
2 FROM DEFSCHEDULE
3 WHERE upper(DBLINK) like ‘&1’;
Enter value for 1: CPI%
old 3: WHERE upper(DBLINK) like ‘&1’
new 3: WHERE upper(DBLINK) like ‘CPI%’

SUBSTR(DBLINK,1,25) Average Latency
————————- —————
CPI_L1_A.O2
CPI_L1_B.O2 546244624
CPI_L2_A.O2 546860293
CPI_L2_B.O2 546860298

Delete MASTER Node: Rollback ADD_NEW_MASTERS Procedure

Posted by Sagar Patil

I am trying to add a new master database into existing replication cluster using API DBMS_REPCAT.ADD_MASTER_DATABASE. The system returned error : ORA-23493: “REPC.US.ORACLE.COM” is not a new site for extension request “57C8B3C5C100528AE0440060B0C193C6”

Full Rrror : ERROR at line 1:
ORA-23493: “REPC.US.ORACLE.COM” is not a new site for extension request
“57A6AC50B2801525E0440060B0C193C6”
ORA-01403: no data found
ORA-06512: at “SYS.DBMS_REPCAT_ADD_MASTER”, line 2640
ORA-06512: at “SYS.DBMS_REPCAT”, line 1200
ORA-06512: at line 2

Please see post “add-a-new-node-using-add-master-database-group-quiescing-method

repA>select * from dba_repextensions;

.Master
Definition
EXTENSION_ID REQUEST Site?. EXP REPCATLOG_ID
——————————– ————— ———- — ————
EXTENSION_STA FLASHBACK_SCN BRE BRE PERCENTAGE_FOR_CATCHUP_MDEF
————- ————- — — —————————
CYCLE_SECONDS_MDEF PERCENTAGE_FOR_CATCHUP_NEW CYCLE_SECONDS_NEW
—————— ————————– —————–
57C8B3C5C100528AE0440060B0C193C6 ADD_NEW_MASTERS REPA.US.OR NO 17
ACLE.COM
INSTANTIATING 384340 NO NO 80
60 80 60

repB> select * from dba_repextensions;

.Master
Definition
EXTENSION_ID REQUEST Site?. EXP REPCATLOG_ID
——————————– ————— ———- — ————
EXTENSION_STA FLASHBACK_SCN BRE BRE PERCENTAGE_FOR_CATCHUP_MDEF
————- ————- — — —————————
CYCLE_SECONDS_MDEF PERCENTAGE_FOR_CATCHUP_NEW CYCLE_SECONDS_NEW
—————— ————————– —————–
57C8B3C5C100528AE0440060B0C193C6 ADD_NEW_MASTERS REPA.US.OR 15
ACLE.COM
INSTANTIATING NO NO 80
60 80 60

repC> select * from dba_repextensions;

no rows selected

Solution: BEGIN
DBMS_REPCAT.UNDO_ADD_NEW_MASTERS_REQUEST ( extension_id => ’57C8B3C5C100528AE0440060B0C193C6′ , drop_contents => FALSE);
END;

now

repA>select * from dba_repextensions;

no rows selected

repB>select * from dba_repextensions;

no rows selected

repC>select * from dba_repextensions;

no rows selected

Replication SQL Scripts

Posted by Sagar Patil

Count of Objects replicated in Database

SELECT   base_sname “OWNER”, COUNT (UNIQUE base_oname) NUMBER_OF_OBJECTS
FROM   REPCAT$_GENERATED
GROUP BY   base_sname;

List number of replicated objects with corresponding groups

SELECT   gname Replication_Group, COUNT ( * ) NUMBER_OF_TABLES
FROM   REPCAT$_REPOBJECT
WHERE   TYPE = 2
GROUP BY   gname
ORDER BY   1;                                                              — List number of replicated objects

SELECT   COUNT ( * ) NUMBER_OF_OBJECTS, TYPE TYPE_OF_OBJECT
FROM   REPCAT$_REPOBJECT
GROUP BY   TYPE;

List replication Group and Object Name

SELECT   gname Replication_Group, oname OBJECT_NAME
FROM   REPCAT$_REPOBJECT
WHERE   TYPE = 2
ORDER BY   1

Can I locate which tables, indexes and other objects are replicated?

SELECT   BASE_TYPE “Type of Object”,
COUNT (UNIQUE base_oname) NUMBER_OF_OBJECTS
FROM   REPCAT$_GENERATED
WHERE   BASE_TYPE = &1
GROUP BY   base_type;

where BASE_TYPE 1 INDEX
2 TABLE
4 VIEW
5 SYNONYM
6 SEQUENCE
7 PROCEDURE
8 FUNCTION
9 PACKAGE
10 PACKAGE BODY
12 TRIGGER
13 TYPE
14 TYPE BODY
32 INDEX TYPE

What is a size in MB of each replicated object?

SELECT   Segment_Name TABLE_NAME, ROUND (SUM (bytes) / 1000000) Size_In_MB
FROM   dba_segments
WHERE   segment_name IN (  SELECT   UNIQUE oname FROM REPCAT$_REPOBJECT)
GROUP BY   segment_name
ORDER BY   2 DESC;

Push Replication Group to NORMAL Status in an Exceptional Case

Posted by Sagar Patil

The dbms_repcat.resume_master_activity() package has an override parameter that defaults to FALSE. This parameter can be set to TRUE to allow the
group to become normal even if there are pending admin requests in DBA_REPCATLOG for this group.

This override should ONLY be used in extreme emergency situations, and ONLY when the ramifications and resolution of operating the replicated environment when those pending admin requests have not been applied are fully understood and acceptable. This parameter should not be used until you have contacted Oracle Support Services and addressed the situation. Use of this parameter can result in an invalidation of your replication environment, requiring the environment to be rebuild and / or resynchronised.

Monitoring the Deferred Transactions Queue

Posted by Sagar Patil
  • Listing the Number of Deferred Transactions for Each Destination Master Site
  • Determining the Next Start Time and Interval for the Push Jobs
  • Determining the Total Number of Transactions Queued for Propagation

1. Listing the Number of Deferred Transactions for Each Destination Master Site

CONNECT repadmin/repadmin@repA

COLUMN DEST HEADING ‘Destination’ FORMAT A45
COLUMN TRANS HEADING ‘Def Trans’ FORMAT 9999

SELECT DBLINK DEST, COUNT(*) TRANS
FROM DEFTRANDEST D
GROUP BY DBLINK;

Destination Def Trans
——————————————— ———
repA 1

2. Determining the Next Start Time and Interval for the Push Jobs

CONNECT repadmin/repadmin@repA.WORLD

COLUMN JOB HEADING ‘Job ID’ FORMAT 999999
COLUMN DBLINK HEADING ‘Destination’ FORMAT A22
COLUMN next_start HEADING ‘Next Start’
COLUMN INTERVAL HEADING ‘Interval’ FORMAT A25

SELECT JOB,
DBLINK,
TO_CHAR(NEXT_DATE, ‘DD-MON-YYYY HH:MI:SS AM’) next_start,
INTERVAL
FROM DEFSCHEDULE
WHERE DBLINK != (SELECT GLOBAL_NAME FROM GLOBAL_NAME)
AND JOB IS NOT NULL
ORDER BY 1;

3. Determining the Total Number of Transactions Queued for Propagation

Run the following query to display the total number of transactions in the deferred transaction queue that are waiting to be propagated:

repA>sqlplus repadmin/repadmin@repA

SELECT COUNT(DISTINCT DEFERRED_TRAN_ID) “Transactions Queued”
FROM DEFTRANDEST;

Oracle Advanced Replication :Monitoring Administrative Requests

Posted by Sagar Patil

1. Listing General Information About Administrative Requests at the Master
2. Determining the Cause of Administrative Request Errors at the Master
3. Listing Information About the Job that Executes Administrative Requests at the Master

Listing General Information About Administrative Requests at the Master

COLUMN ID HEADING ‘Admin|Request|ID’ FORMAT 999999
COLUMN REQUEST HEADING ‘Request’ FORMAT A25
COLUMN STATUS HEADING ‘Status’ FORMAT A15
COLUMN MASTER HEADING ‘Master|Site’ FORMAT A25

SELECT ID, REQUEST, STATUS, MASTER FROM DBA_REPCATLOG;

Determining the Cause of Administrative Request Errors at the Master

COLUMN ID HEADING ‘Admin|Request|ID’ FORMAT 999999
COLUMN REQUEST HEADING ‘Request’ FORMAT A30
COLUMN ERRNUM HEADING ‘Error|Number’ FORMAT 999999
COLUMN MESSAGE HEADING ‘Error|Message’ FORMAT A32

SELECT ID, REQUEST, ERRNUM, MESSAGE
FROM DBA_REPCATLOG WHERE STATUS = ‘ERROR’;

Listing Information About the Job that Executes Administrative Requests at the Master

You can query the DBA_JOBS data dictionary view to list the following information about this job.

The DBMS_REPCAT.DO_DEFERRED_REPCAT_ADMIN porcedure executes the local outstanding deferred administrative procedures for the specified master group at the current master site, or (with assistance from job queues) for all master sites.

COLUMN JOB HEADING ‘Job ID’ FORMAT 999999
COLUMN PRIV_USER HEADING ‘Privilege|Schema’ FORMAT A10
COLUMN BROKEN HEADING ‘Broken?’ FORMAT A7
COLUMN next_start HEADING ‘Next Start’
COLUMN INTERVAL HEADING ‘Interval’ FORMAT A20

SELECT JOB,
PRIV_USER,
BROKEN,
TO_CHAR(NEXT_DATE,’DD.MM.YYYY:HH:MI:SS AM’) next_start,
INTERVAL
FROM DBA_JOBS
WHERE WHAT LIKE ‘%dbms_repcat.do_deferred_repcat_admin%’
ORDER BY 1;

List General Information About Master Groups & replication activity

Posted by Sagar Patil

You can retrieve following details :

  • The number of unpropagated deferred transaction-destination pairs. Each deferred transaction can have multiple destinations to which it will be propagated, and each destination is a single deferred transaction-destination pair.
  • The number of deferred transaction errors (error transactions) for each master group
  • The number of administrative requests for each master group
  • The number of administrative request errors for each master group

SELECT G.GNAME,
NVL(T.CNT1, 0) deftran,
NVL(IE.CNT2, 0) deftranerror,
NVL(A.CNT3, 0) adminreq,
NVL(B.CNT4, 0) adminreqerror
FROM
(SELECT DISTINCT GNAME FROM DBA_REPGROUP WHERE MASTER=’Y’) G,
(SELECT DISTINCT RO.GNAME, COUNT(DISTINCT D.DEFERRED_TRAN_ID) CNT1
FROM DBA_REPOBJECT RO, DEFCALL D, DEFTRANDEST TD
WHERE RO.SNAME = D.SCHEMANAME
AND RO.ONAME = D.PACKAGENAME
AND RO.TYPE IN (‘TABLE’, ‘PACKAGE’, ‘MATERIALIZED VIEW’)
AND TD.DEFERRED_TRAN_ID = D.DEFERRED_TRAN_ID
GROUP BY RO.GNAME ) T,
(SELECT DISTINCT RO.GNAME, COUNT(DISTINCT E.DEFERRED_TRAN_ID) CNT2
FROM DBA_REPOBJECT RO, DEFCALL D, DEFERROR E
WHERE RO.SNAME = D.SCHEMANAME
AND RO.ONAME = D.PACKAGENAME
AND RO.TYPE IN (‘TABLE’, ‘PACKAGE’, ‘MATERIALIZED VIEW’)
AND E.DEFERRED_TRAN_ID = D.DEFERRED_TRAN_ID
AND E.CALLNO = D.CALLNO
GROUP BY RO.GNAME ) IE,
(SELECT GNAME, COUNT(*) CNT3 FROM DBA_REPCATLOG GROUP BY GNAME) A,
(SELECT GNAME, COUNT(*) CNT4 FROM DBA_REPCATLOG
WHERE STATUS = ‘ERROR’
GROUP BY GNAME) B WHERE G.GNAME = IE.GNAME (+)
AND G.GNAME = T.GNAME (+)
AND G.GNAME = A.GNAME (+)
AND G.GNAME = B.GNAME (+) ORDER BY G.GNAME;

Oracle Advanced Replication | Listing the Master Sites Participating in a Master Group

Posted by Sagar Patil

COLUMN GNAME HEADING ‘Master Group’ FORMAT A20
COLUMN DBLINK HEADING ‘Sites’ FORMAT A25
COLUMN MASTERDEF HEADING ‘Master|Definition|Site?’ FORMAT A10

SELECT GNAME, DBLINK, MASTERDEF
FROM DBA_REPSITES
WHERE MASTER = ‘Y’
AND GNAME NOT IN (SELECT GNAME FROM DBA_REPSITES WHERE SNAPMASTER = ‘Y’)
ORDER BY GNAME;

Dynamic Replication Views

Posted by Sagar Patil

DBA_REPCATLOG describes the status for all asynchronous administrative requests and all error messages in the database.

DBA_REPCOLUMN describes the replicated columns for all the tables in the database.

DBA_REPCOLUMN_GROUP describes the column groups for all the tables in the database.

DBA_REPCONFLICT describes the conflict resolution method for all the tables in the database on which a conflict resolution method has been defined.

DBA_REPDDL contains the DDL for each replicated object in the database.

DBA_REPGENOBJECTS describes each object in the database that was generated to support replication.

DBA_REPGROUP describes all of the replication groups in the database that are being replicated

DBA_REPGROUP_PRIVILEGES contains information about the users who are registered for privileges in all the replication groups in the database.

DBA_REPGROUPED_COLUMN describes all of the columns that make up the column groups for each table in the database.

DBA_REPKEY_COLUMNS The replication key column(s) is an alternate column or group of columns, instead of the primary key, used to determine which columns of a table to compare when using row-level replication. You can set the replication key columns using the SET_COLUMNS procedure in the DBMS_REPCAT package.

DBA_REPOBJECT contains information about the objects in each replication group in the database.

DBA_REPPARAMETER_COLUMN contains information about the columns that are used to resolve conflicts for each replicated table in the database.

DBA_REPPRIORITY contains the value and priority level of each priority group member in each priority group in the database.

DBA_REPPRIORITY_GROUP describes the priority group or site priority group defined for each replication group in the database.

DBA_REPPROP indicates the technique used to propagate operations on each replicated object to the same object at another master site. This view shows all objects in the database.

DBA_REPRESOL_STATS_CONTROL describes statistics collection for conflict resolutions for all replicated tables in the database.

DBA_REPRESOLUTION indicates the methods used to resolve update, uniqueness, or delete conflicts for each table in the database that is replicated using row-level replication for a given schema.

DBA_REPRESOLUTION_METHOD lists all of the conflict resolution methods available in the database.

DBA_REPRESOLUTION_STATISTICS lists information about successfully resolved update, uniqueness, and delete conflicts for all replicated tables in the database.

DBA_REPSITES lists the members of each replication group in the database.

Oracle Advanced Replication | Remove or Delete Master Site from a Master Group

Posted by Sagar Patil

Executed At: Master Definition Site

Replication Status: Quiesced

Step 1 Connect to the master definition site as the replication administrator.

CONNECT repadmin/repadmin@repA.world

Make sure the site you want to drop is not Master definition site for any replication group.

SELECT GNAME, DBLINK, MASTERDEF
FROM DBA_REPSITES
WHERE MASTER = 'Y'
AND GNAME NOT IN (SELECT GNAME FROM DBA_REPSITES WHERE SNAPMASTER = 'Y')
ORDER BY GNAME,3;

GNAME                          DBLINK     MASTERDEF
O5_A-B_ALL                     repA       N
O5_A-B_ALL                     repAA      N
O5_A-B_ALL                     repAAA     N
O5_A-B_ALL                     repB       N
O5_A-B_ALL                     repBB      N
O5_A-B_ALL                     repBBB     Y

O5_BROKER_A-B                  repA       N
O5_BROKER_A-B                  repAA      N
O5_BROKER_A-B                  repAAA     Y

Following SQL could be used to confirm number of replication groups was part of repAA  Master

SELECT GNAME, DBLINK, MASTERDEF
FROM DBA_REPSITES
WHERE MASTER = 'Y' AND
DBLINK = ‘repAA’
AND GNAME NOT IN (SELECT GNAME FROM DBA_REPSITES WHERE SNAPMASTER = 'Y')
ORDER BY GNAME,3;

Step 2 If the replication status is normal for the master group, then locate MASTER defn Site & change the status to quiesced.

BEGIN
DBMS_REPCAT.SUSPEND_MASTER_ACTIVITY (gname => ‘&1’);
END;

Enter value for 1: O5_A-B_ALL

Step 3 Remove the master site using the REMOVE_MASTER_DATABASES procedure.

BEGIN
DBMS_REPCAT.REMOVE_MASTER_DATABASES (
gname => ‘O5_A-B_ALL’,
master_list => 'repA.world');
END;

You should wait until the DBA_REPCATLOG view is empty.

Execute following SELECT statement in another SQL*Plus session to monitor the DBA_REPCATLOG view:

SELECT * FROM DBA_REPCATLOG WHERE GNAME = ‘HR_REPG’
BEGIN
DBMS_REPCAT.RESUME_MASTER_ACTIVITY (
gname => ‘O5_A-B_ALL’);
END;

Here we have dropped site repA successfully.

Imagine you now want to add same node at later stage. Under this case you need to remove all replication groups and a replication support created for those tables.

For all groups execute SQL> execute dbms_repcat.drop_master_repgroup(‘&1’);
Enter value for 1: O5_A-B_ALL

PL/SQL procedure successfully completed.

If you want to remove complete replication support then look at this post

Oracle Advanced Replication – Administration Tasks (Concepts/no SQL)

Posted by Sagar Patil
  1. Suspending Master Activity
  2. Resume Master Activity
  3. Applying Administration Tasks
  4. Applying Transactions
  5. Removing Transactions
  6. Removing Errors
  7. Drop Replication Object

Suspending Master Activity
Whenever some administration tasks needs to be taken, such as adding an object to a replication group, you must suspend master activity for the nominated group. This will put the group on the master and master definition site into QUIESCED mode. At this stage, only SELECT statements are allowed on the objects within the group. Any other DML or DDL statements will generate ORA-23311 or ORA-23326.

ORA-23311 object group “name” is quiesced
Cause: SUSPEND_MASTER_ACTIVITY has been called before the object group has resumed normal operation.
Action: If a RESUME_MASTER_ACTIVITY request is pending, wait until it completes, and then reinvoke SUSPEND_MASTER_ACTIVITY.
ORA-23326 the system is being quiesced
Cause: A deferred remote procedure call operation was attempted while the database was quiesced.
Action: Resume database activity with the DBMS_REPCAT.RESUME_MASTER_ACTIVITY call.

For example, exec dbms_repcat.suspend_master_activity(‘BILLING_RUN’);
You must issue this command only on the master DEFINITION site. All master sites involved in the group will be QUIESCED accordingly.

Resume Master Activity
Once administration tasks are completed, ie, there is nothing in the DBA_REPCATLOG, you may put the database back into normal mode. Again, this command must only be entered at the master DEFINITION site. For example: exec dbms_repcat.resume_master_activity(‘BILLING_RUN’);

Applying Administration Tasks
Administration tasks are queued in DBA_REPCATLOG. The job dbms_repcat.do_deferred_repcat_admin(‘”ACME”‘, FALSE); at both the master and master definition site should apply all these requests. You may choose to execute this manually, or run the job.

Applying Transactions
Transactions are queued in DEFTRAN. Each transaction has one or more corresponding DEFCALL. For a simple one-way replication, you should not have any transactions in the master site! Otherwise you need to add some conflict resolution rules. In our example setup, ACME is only using simple one-way replication.

The job sys.dbms_defer_sys.execute will apply these transactions. Again, you can wait for the job to automatically execute, or run it manually. While it is running, you should see the number of DEFCALL and DEFTRAN decrease as transactions are applied.

Removing Transactions
If transactions in the DEFTRAN are no longer required, use the command DBMS_DEFER_SYS.DELETE_TRAN to remove the given transaction. For example, if you added a replication object to a group, and removed it later on, the transactions associated with these groups may still be left in DEFTRAN. Use DBMS_DEFER_SYS.DELETE_TRAN to remove then.

In drastic situations, you can delete them from SYSTEM.DEF$_CALL. Deleting a call will remove the corresponding entry in SYSTEM.DEF$_TRAN.

Removing Errors
Errors in administration tasks, such as adding groups, are found in DBA_REPCATLOG. This view also holds admin tasks that are still pending. For example:

SELECT ONAME, REQUEST, MESSAGE
FROM dba_repcatlog WHERE status = ‘ERROR’

Once transactions are submitted, any errors are logged in the DEFERROR view. There is a procedure to reapply the error, DBMS_DEFER_SYS.EXECUTE_ERROR. Or you can delete the error using DBMS_DEFER_SYS.DELETE_ERROR. As a last resort, you can remove errors by deleting entries from the table SYSTEM.DEF$_ERROR.

Drop Replication Object
When an object no loner needs to be part of replication group, use the DBMS_REPCAT.DROP_MASTER_REPOBJECT package. For example:

exec dbms_repcat.drop_master_repobject(-
sname => ‘ACME’,oname => ‘PARENTPARTICIPANT’,type => ‘TABLE’,drop_objects=>false);

Oracle Advanced Replication | Relocating Master Definition Site

Posted by Sagar Patil

I have a live 4 node 4 way cluster between repA,repAA,repB & repBB instances. The node repA is Master which I want to move to repAA.

Database Release : 9.2.0.8 On HP UNIX

All Master Sites Are Available

DBMS_REPCAT.RELOCATE_MASTERDEF  was running for more than 2 hours

Observation :

  • Locate which DBMS jobs are running in system
  • “select /*+ RULE */ what from dba_jobs where job in( select /*+ RULE */  job  from dba_jobs_running)”
  • dbms_repcat.do_deferred_repcat_admin(‘”O5_A-B”‘, FALSE);
  • Observed SQLPLUS/TOAD session showing following SQL waiting for ENQUEUE Latch.SELECT  MASTER  FROM SYSTEM.repcat$_repcat WHERE sname = :b1 AND gowner = :b2  FOR UPDATEI wasted half a day to notice that  “Not all dbms_repcat procedures have an auto-commit“ as described at Note:1026571.6A commit after DBMS_REPCAT.RELOCATE_MASTERDEF solved my problem.repA>SELECT gname, substr(dblink,1,20),masterdef “Is MasterDefinition Site”
    FROM dba_repsites WHERE
    gname in(‘O1_A-B_ALL’,’O1_ERROR_A-B’)
    order by 3 desc;

    GNAME SUBSTR(DBLINK,1,20) I
    —————————— ——————– –
    O1_ERROR_A-B REPA.US.ORACLE.COM Y
    O1_A-B_ALL REPA.US.ORACLE.COM Y
    O1_ERROR_A-B REPB.US.ORACLE.COM N
    O1_A-B_ALL REPB.US.ORACLE.COM N
    O1_A-B_ALL REPBB.US.ORACLE.COM N
    O1_A-B_ALL REPAA.US.ORACLE.COM N
    O1_ERROR_A-B REPAA.US.ORACLE.COM N
    O1_ERROR_A-B REPBB.US.ORACLE.COM N

    repA>show user
    USER is “REPADMIN”
    repA>BEGIN
    DBMS_REPCAT.RELOCATE_MASTERDEF (
    gname => ‘O1_ERROR_A-B’,
    old_masterdef => ‘repA’,
    new_masterdef => ‘repAA’,
    notify_masters => TRUE,
    include_old_masterdef => TRUE);
    END;
    /

    COMMIT;

    /

    PL/SQL procedure successfully completed.

    repA>SELECT gname, substr(dblink,1,20),masterdef “Is MasterDefinition Site”
    FROM dba_repsites WHERE
    gname in(‘O1_A-B_ALL’,’O1_ERROR_A-B’)
    order by 3 desc;

    GNAME SUBSTR(DBLINK,1,20) I
    —————————— ——————– –
    O1_ERROR_A-B REPAA.US.ORACLE.COM Y
    O1_A-B_ALL REPA.US.ORACLE.COM Y
    O1_ERROR_A-B REPA.US.ORACLE.COM N
    O1_A-B_ALL REPB.US.ORACLE.COM N
    O1_A-B_ALL REPBB.US.ORACLE.COM N
    O1_A-B_ALL REPAA.US.ORACLE.COM N
    O1_ERROR_A-B REPBB.US.ORACLE.COM N
    O1_ERROR_A-B REPB.US.ORACLE.COM N

    8 rows selected.

    Relocate the master definition site Master Definition site Available

    BEGIN
    DBMS_REPCAT.RELOCATE_MASTERDEF (
    gname => ‘hr_repg’,
    old_masterdef => ‘orc1.world’,
    new_masterdef => ‘orc2.world’,
    notify_masters = > TRUE,
    include_old_masterdef => TRUE);
    END;

    Relocate the master definition site The Old Master Definition Site Not Available

    BEGIN
    DBMS_REPCAT.RELOCATE_MASTERDEF (
    gname => ‘hr_repg’,
    old_masterdef => ‘orc1.world’,
    new_masterdef => ‘orc2.world’,
    notify_masters = > TRUE,
    include_old_masterdef => FALSE);
    END;

    Reference :

    DBMS_REPCAT.RELOCATE_MASTERDEF (
    gname IN VARCHAR2,
    old_masterdef IN VARCHAR2,
    new_masterdef IN VARCHAR2,
    notify_masters IN BOOLEAN : = TRUE,
    include_old_masterdef IN BOOLEAN : = TRUE)

    gname The name of the object group whose master definition your want to relocate.

    old_masterdef The fully qualified database name of the current master definition site.

    new_masterdef The fully qualified database name of the existing master site that you want to make the new master definition site.

    notify_masters If NOTIFY_MASTERS is TRUE, the procedure synchronously multicasts the change to all masters (including OLD_MASTERDEF only if INCLUDE_OLD_MASTERDEF is TRUE). If any master does not make the change, rollback the changes at all masters.

    include_old_masterdef If NOTIFY_MASTERS is TRUE and INCLUDE_OLD_MASTERDEF is also TRUE, the old master definition site is also notified of the change.

Add new Node without Quiescing (RMAN SCN Method)

Posted by Sagar Patil

Task: We have a working setup of 4 node 4 way replication cluster built on Advanced/MultiMaster replication. 2 nodes out of these 4 nodes should be moved to a different physical location without a downtime.

Solution : Add 2 more nodes into system and run a 6 node 6 way replication for some time. Once things are stable, remove 2 nodes from cluster.

Please see Metalink NOTE:296473.1 metalink.oracle.com/CSP/ui/flash.html#tab=Home(page=Home&id=fli2gm32()),(page=KBNavigator&id=fli3rubg(viewingMode=1141&&userQuery=Adding%20Master%20Sites&searchControl=1146))

Step 1 at Each New Master Site

Setup replication at the first site if replication is not already existing

Pre-requisite

  • The replication administrator at each new master site
  • A scheduled link from each existing master site to each new master site
  • A scheduled link from each new master site to each existing master site
  • A schedule purge job at each new master site

Step 2 at Master Definition Site

Take RMAN backup of the database including the archive logs of master definition database.

Step 3. Run the SPECIFY_NEW_MASTERS procedure on the first site

repA>begin
DBMS_REPCAT.SPECIFY_NEW_MASTERS (‘scott_repg’,’REPC.US.ORACLE.COM’);
end;

This procedure specifies the master sites you intend to add to an existing replication group without quiescing the group. This procedure must be run at the master definition site of the specified master group.

If necessary, this procedure creates an extension_id that tracks the process of adding new master sites to a master group. You use this extension_id in the other procedures that you run at various stages in the process. You can view information about the extension_id in the DBA_REPSITES_NEW and DBA_REPEXTENSIONS data dictionary views.

DBMS_REPCAT.SPECIFY_NEW_MASTERS (
gname IN VARCHAR2,
{ master_list IN VARCHAR2
| master_table IN DBMS_UTILITY.DBLINK_ARRAY});

Step 4 Execute the ADD_NEW_MASTERS procedure on master definition site

repA> VARIABLE masterdef_flashback_scn NUMBER;
VARIABLE extension_id VARCHAR2(32);
begin
DBMS_REPCAT.ADD_NEW_MASTERS (
export_required => false,
available_master_list => null,
masterdef_flashback_scn => :masterdef_flashback_scn,
extension_id => :extension_id,
break_trans_to_masterdef => false,
break_trans_to_new_masters => false,
percentage_for_catchup_mdef => 80,
cycle_seconds_mdef => 60,
percentage_for_catchup_new => 80,
cycle_seconds_new => 60);
end;

repA>print masterdef_flashback_scn;

MASTERDEF_FLASHBACK_SCN
———————–
1666794

repA>print extension_id ;

EXTENSION_ID
——————————–
57A6AC50B2801525E0440060B0C193C6

repA>select sname, master, status from sys.dba_repcat;

SNAME M STATUS
—————————— – ———
SCOTT_REPG Y QUIESCED

This procedure adds the master sites in the DBA_REPSITES_NEW data dictionary view to the master groups specified when the SPECIFY_NEW_MASTERS procedure was run. Information about these new master sites are added to the replication catalog at all available master sites.

Caution: After running this procedure, do not disable or enable propagation of the deferred transactions queue until after the new master sites are added. The DBA_REPEXTENSIONS data dictionary view must be clear before you disable or enable propagation. You can use the Replication Management tool or the SET_DISABLED procedure in the DBMS_DEFER_SYS package to disable or enable propagation.

Note:

  • This step will provide the extension_id and the flashback_scn.
  • The flashback_scn is need to duplicate the database in the next step.
  • The extension_id can be used to find out if the steps are proceeding correctly.
  • You can query the dba_repsites_new and dba_repextensions at both the sites with this extension_id

We need to use system change number (SCN) returned by the masterdef_flashback_scn parameter for the FLASHBACK_SCN export parameter. At this point Master defn site will start building up transactions for new master site.

Step 5. Create a duplicate database until the flashback_scn returned in the above step using RMAN.

RMAN>DUPLICATE TARGET DATABASE TO repC UNTIL SCN 1666794;

We are using disk to disk replication so File transfer between sites and Resync disks to a new master site.

Step 6. Change the global name of the new database

ALTER DATABASE RENAME GLOBAL_NAME TO repC;

Step 7. Create database links between the two database as per the replicaton requirement

Step 8. Execute the PREPARE_INSTANTIATED_MASTER procedure on the new master site (new database)

Note:
This procedure enables the propagation of deferred transactions from other prepared new master sites and existing master sites to the invocation master site. This procedure also enables the propagation of deferred transactions from the invocation master site to the other new master sites and existing master sites.

begin
DBMS_REPCAT.PREPARE_INSTANTIATED_MASTER (
extension_id => :extension_id);
end;

extension_id value returned from ADD_NEW_MASTERS is used here.

Now this method is not without drawback and “The master definition site must be the same for all of the master groups”.

————– CASE STUDY- USING DISK REPLICATION INSTEAD OF RMAN NO SCN BASED RECOVERY ——————-

We have a really large database which needs to be attached into 4 way replication cluster. We could use rman but it is going to take more time to backup and restore database so we decided on the DISK replication which could copy Tera bytes in matter of hours than days.

I have 2 DB instances repA ad repB , built with 2 way replication using http://www.oracledbasupport.co.uk/2008/09/11/how-to-setup-master-sites-in-multimaster-replication/

Pre-requisite

  • The replication administrator at each new master site
  • A scheduled link from each existing master site to each new master site
  • A scheduled link from each new master site to each existing master site
  • A schedule purge job at each new master site

repA>begin
DBMS_REPCAT.SPECIFY_NEW_MASTERS (‘scott_repg’,’REPC.US.ORACLE.COM’);
end;

Since we need a master Defn site to build new instance repC, I took offline backup of repA. Before I backed up repA, I put the scott_repg into QUISCED condition.

repA>select sname, master, status from sys.dba_repcat;

SNAME M STATUS
—————————— – ———
SCOTT_REPG Y QUIESCED

repA> VARIABLE masterdef_flashback_scn NUMBER;
VARIABLE extension_id VARCHAR2(32);
begin
DBMS_REPCAT.ADD_NEW_MASTERS (
export_required => false,
available_master_list => null,
masterdef_flashback_scn => :masterdef_flashback_scn,
extension_id => :extension_id,
break_trans_to_masterdef => false,
break_trans_to_new_masters => false,
percentage_for_catchup_mdef => 80,
cycle_seconds_mdef => 60,
percentage_for_catchup_new => 80,
cycle_seconds_new => 60);
end;

repA>print masterdef_flashback_scn;

MASTERDEF_FLASHBACK_SCN
———————–
1666794

repA>print extension_id ;

EXTENSION_ID
——————————–
57A6AC50B2801525E0440060B0C193C6

I copied repA as repC and changed database sid as repC. – “ALTER DATABASE RENAME GLOBAL_NAME TO repC;”

repC> begin
DBMS_REPCAT.PREPARE_INSTANTIATED_MASTER (
extension_id => ’57A6AC50B2801525E0440060B0C193C6′);
end;

After executing above API I could see repA,repB,repC present at repa,repb but repC wouldn’t update like repA. Please see image below for details.

repA>select extension_id, request, masterdef, extension_status,flashback_scn from dba_repextensions;

.Master
Definition
EXTENSION_ID REQUEST Site?. EXTENSION_STA
——————————– ————— ———- ————-
FLASHBACK_SCN
————-
57A6AC50B2801525E0440060B0C193C6 ADD_NEW_MASTERS REPA.US.OR INSTANTIATING
ACLE.COM
1666794

The system is in INSTANTIATING status for last 12 hours.

I can see at one of internal view “select * from dba_repextensions” a flashback_SCN captured and I am sure it is tracked while building up x’actions at master defn. I built test setup for 2 tables with 10 rows and the system is not responding for last 12 hours. It seems gone into some sort of endless loop not sure why. None of the Oracle alrtlog have any detailed information.

repA>SELECT DBLINK DEST, COUNT(*) TRANS
FROM DEFTRANDEST D
GROUP BY DBLINK; 2 3

no rows selected

repA>SELECT COUNT(DISTINCT DEFERRED_TRAN_ID) “Transactions Queued” FROM DEFTRANDEST;

Transactions Queued
——————-
0

Why ? This sould happen.

If you see above documents you will know I really didn’t carry a SCN based recovery. Also before the backup wastaken scott_repg was put into QUIESCED mode. No x’actions were allowed though.

I can see at one of internal view “select * from dba_repextensions” a flashback_SCN captured and I am sure it is tracked while building up x’actions at master defn. I built test setup for 2 tables with 10 rows and the system is not responding for last 1 hour. It seems gone into some sort of endless loop not sure why. None of the Oracle alrtlog have any detailed information.

I tried getting scott_repg out of QUIESCED mode but didn’t work.

repA>select sname, master, status from sys.dba_repcat;

SNAME M STATUS
—————————— – ———
SCOTT_REPG Y QUIESCED

repA> BEGIN DBMS_REPCAT.RESUME_MASTER_ACTIVITY (gname => 'scott_repg'); END;<pre>

PL/SQL procedure successfully completed.

repA>select sname, master, status from sys.dba_repcat;

SNAME M STATUS
—————————— – ———
SCOTT_REPG Y QUIESCED

SELECT GNAME, DBLINK, MASTERDEF
FROM DBA_REPSITES
WHERE MASTER = ‘Y’
AND GNAME NOT IN (SELECT GNAME FROM DBA_REPSITES WHERE SNAPMASTER = ‘Y’)
ORDER BY GNAME; returns

————– CASE STUDY- USING SCN BASED RECOVERY with DISK REPLICATION ——————-

Make sure the replicated clustered Databases repA,repB are in ARCHIVELOG mode.

Use posts http://www.oracledbasupport.co.uk/enable-archivelog-put-database-into-archive-mode/ & http://www.oracledbasupport.co.uk/how-to-setup-2-way-multimaster-replication/

repB>select sname, master, status from sys.dba_repcat;

SNAME M STATUS
—————————— – ———
SCOTT_REPG Y NORMAL

repA>conn system/repa@repa
Connected.
repA>create public database link repc using ‘repc’;

Database link created.

repA>conn repadmin/repadmin@repa
Connected.
repA>create database link repc connect to repadmin identified by repadmin;

repA>conn system/repb@repb
Connected.
repA>create public database link repc using ‘repc’;

Database link created.

repA>conn repadmin/repadmin@repb
Connected.
repA>create database link repc connect to repadmin identified by repadmin;

repB>select db_link from dba_db_links;

DB_LINK
——————————————————————————–
REPA.US.ORACLE.COM
REPC.US.ORACLE.COM
REPA.US.ORACLE.COM
REPC.US.ORACLE.COM

repA>SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
————
ARCHIVELOG

repA>begin
DBMS_REPCAT.SPECIFY_NEW_MASTERS (‘scott_repg’,’REPC’);
end;

repA & repB>select sname, master, status from sys.dba_repcat;

SNAME                          M STATUS
—————————— – ———
SCOTT_REPG                     Y NORMAL

repA> VARIABLE masterdef_flashback_scn NUMBER;
VARIABLE extension_id VARCHAR2(32);
begin
DBMS_REPCAT.ADD_NEW_MASTERS (
export_required => false,
available_master_list => null,
masterdef_flashback_scn => :masterdef_flashback_scn,
extension_id => :extension_id,
break_trans_to_masterdef => false,
break_trans_to_new_masters => false,
percentage_for_catchup_mdef => 80,
cycle_seconds_mdef => 60,
percentage_for_catchup_new => 80,
cycle_seconds_new => 60);
end;

repA>print masterdef_flashback_scn;

MASTERDEF_FLASHBACK_SCN
———————–
232079

repA>print extension_id ;

EXTENSION_ID
——————————–
582FD00C0B00208CE0440060B0C193C6
repA>select sname, master, status from sys.dba_repcat;

SNAME                          M STATUS
—————————— – ———
SCOTT_REPG                     Y NORMAL
SQL> conn / as sysdba
Connected.
SQL> alter system switch logfile;

System altered.

repA>SELECT GNAME, substr(DBLINK,1,20), MASTERDEF
FROM DBA_REPSITES
WHERE MASTER = ‘Y’
AND GNAME NOT IN (SELECT GNAME FROM DBA_REPSITES WHERE SNAPMASTER = ‘Y’)
ORDER BY GNAME;

.Master
Definition
GNAME .Sites. Site?.
—————————— ————————- ———-
SCOTT_REPG REPA.US.ORACLE.COM Y
SCOTT_REPG REPB.US.ORACLE.COM N
SCOTT_REPG REPC.US.ORACLE.COM N

repB>SELECT GNAME, DBLINK, MASTERDEF
FROM DBA_REPSITES
WHERE MASTER = ‘Y’
AND GNAME NOT IN (SELECT GNAME FROM DBA_REPSITES WHERE SNAPMASTER = ‘Y’)
ORDER BY GNAME;

.Master
Definition
GNAME .Sites. Site?.
—————————— ————————- ———-
SCOTT_REPG REPB.US.ORACLE.COM N
SCOTT_REPG REPA.US.ORACLE.COM Y
SCOTT_REPG REPC.US.ORACLE.COM N

repA>select extension_id, request, masterdef, extension_status,flashback_scn from dba_repextensions;

EXTENSION_ID                     REQUEST
——————————– —————
MASTERDEF
——————————————————————————–
EXTENSION_STA FLASHBACK_SCN
————- ————-
582FD00C0B00208CE0440060B0C193C6 ADD_NEW_MASTERS
REPA.US.ORACLE.COM
INSTANTIATING        232079

repB>select extension_id, request, masterdef, extension_status,flashback_scn from dba_repextensions;

EXTENSION_ID                     REQUEST
——————————– —————
MASTERDEF
——————————————————————————–
EXTENSION_STA FLASHBACK_SCN
————- ————-
582FD00C0B00208CE0440060B0C193C6 ADD_NEW_MASTERS
REPA.US.ORACLE.COM
INSTANTIATING

repA>SELECT COUNT(*) FROM DBA_REPCATLOG;

COUNT(*)
———-
1

repB>SELECT COUNT(*) FROM DBA_REPCATLOG;

COUNT(*)
———-
0
repA>select substr(extension_id,1,35),gname,substr(DBlink,1,20), full_instantiation  from DBA_REPSITES_NEW;

SUBSTR(EXTENSION_ID,1,35)        GNAME
——————————– ——————————
SUBSTR(DBLINK,1,20)  F
——————– –
582FD00C0B00208CE0440060B0C193C6 SCOTT_REPG
REPC.US.ORACLE.COM   Y

repB>select substr(extension_id,1,35),gname,substr(DBlink,1,20), full_instantiation  from DBA_REPSITES_NEW;

SUBSTR(EXTENSION_ID,1,35)        GNAME
——————————– ——————————
SUBSTR(DBLINK,1,20)  F
——————– –
582FD00C0B00208CE0440060B0C193C6 SCOTT_REPG
REPC.US.ORACLE.COM   Y

All master sites instantiated with object-level export/import must be accessible at this time. Their new replication groups are added in the quiesced state. Master sites instantiated through full database export/import or through changed-based recovery do not need to be accessible.

repA> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
repA is now shutdown and copied as repC

repA> cp -Rf  repA repC
I willnow carry a SCN based recovery of database for SCN returned  232079

SQL> STARTUP NOMOUNT pfile=’/opt/oracle/admin/repC/pfile/initrepC.ora’;
ORACLE instance started.

Total System Global Area  320562952 bytes
Fixed Size                   734984 bytes
Variable Size             285212672 bytes
Database Buffers           33554432 bytes
Redo Buffers                1060864 bytes
SQL> CREATE CONTROLFILE reuse DATABASE “repA” NORESETLOGS  ARCHIVELOG
MAXLOGFILES 50  2
3      MAXLOGMEMBERS 5
4      MAXDATAFILES 100
5      MAXINSTANCES 1
6      MAXLOGHISTORY 113
LOGFILE
7    GROUP 1 ‘/opt/oracle/oradata/repC/redo01.log’  SIZE 100M,  8
9    GROUP 2 ‘/opt/oracle/oradata/repC/redo02.log’  SIZE 100M,
GROUP 3 ‘/opt/oracle/oradata/repC/redo03.log’  SIZE 100M 10
DATAFILE
11    ‘/opt/oracle/oradata/repC/system01.dbf’,
12    ‘/opt/oracle/oradata/repC/undotbs01.dbf’, 13
14    ‘/opt/oracle/oradata/repC/drsys01.dbf’,
‘/opt/oracle/oradata/repC/example01.dbf’,
15    ‘/opt/oracle/oradata/repC/indx01.dbf’, 16
‘/opt/oracle/oradata/repC/odm01.dbf’, 17
18    ‘/opt/oracle/oradata/repC/tools01.dbf’,
‘/opt/oracle/oradata/repC/users01.dbf’,
19    ‘/opt/oracle/oradata/repC/xdb01.dbf’
20  CHARACTER SET WE8ISO8859P1
21  ; 22

Control file created.

repC> select first_change#-1 from v$log where status=’CURRENT’;

no rows selected

repC>  recover database until CHANGE 232079;
Media recovery complete.

Let’s drop the DB link at new repC instance and build links at repC to repA

SQL> drop database link REPC;
drop database link REPC
*
ERROR at line 1:
ORA-02082: a loopback database link must have a connection qualifier

repC>  alter database rename global_name to test;

Database altered.

repC> drop public database link repc;

Database link dropped.

repC>  alter database rename global_name to repC;

Database altered.

SQL> create public database link repa using ‘repa’;

Database link created.

SQL> conn repadmin/repadmin@repc
Connected.
SQL> create database link repa connect to repadmin identified by repadmin;

repC>select count(*) from tab@repb;

COUNT(*)
———-
0

repC>select count(*) from tab@repa;

COUNT(*)
———-
0
repC>EXECUTE Dbms_Repcat.Drop_Master_Repgroup(‘scott_repg’);

PL/SQL procedure successfully completed.
repC>BEGIN
DBMS_REPCAT.PREPARE_INSTANTIATED_MASTER (
extension_id  => ‘582FD00C0B00208CE0440060B0C193C6’);
END;
/  2    3    4    5
BEGIN
*
ERROR at line 1:
ORA-23493: “REPC.US.ORACLE.COM” is not a new site for extension request
“582FD00C0B00208CE0440060B0C193C6”
ORA-01403: no data found
ORA-06512: at “SYS.DBMS_REPCAT_ADD_MASTER”, line 2640
ORA-06512: at “SYS.DBMS_REPCAT”, line 1200
ORA-06512: at line 2

Opened up a TAR with Oracle Support and looking for a resolution.

Top of Page

Top menu