Oracle DBMS_DRS
Version 12.1.0.1

General Information
Library Note Morgan's Library Page Footer
The Library is currently in the process of being upgraded from Oracle Database Version 11.2.0.3 to 12.1.0.1. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition) and may contain references to CDBs, PDBs, and other objects you may not be familiar with such as CDB_OBJECTS_AE: Welcome to 12c.
Purpose This package contains procedures used in the DR Server (Hot Standby). There are two forms of each major function; one is a blocking procedure, which does not return until the command is completed. The other is a non-blocking function which returns with a request identifier which may be used to return the result of the command.
AUTHID DEFINER
Dependencies
DBMS_DG    
Documented No
Exceptions
Error Code Reason
ORA-16508 bad_request
First Available 9.0.1
Security Model Owned by SYS with EXECUTE granted to the SYSDG and OEM_MONITOR roles
Source $ORACLE_HOME/rdbms/admin/dbmsdrs.sql
Subprograms
 
CANCEL_REQUEST
Cancel Request (blocking) dbms_drs.cancel_request(rid IN INTEGER);
TBD
 
DELETE_REQUEST
Delete Request (blocking) dbms_drs.delete_request(rid IN INTEGER);
See Demos Below
 
DG_BROKER_INFO
Get Data Guard Broker Information dbms_drs.dg_broker_info(info_name IN VARCHAR2) RETURN VARCHAR2;
TBD
 
DO_CONTROL
Control blocking API
Obsolete: Use DO_CONTROL_RAW

Overload 1
dbms_drs.do_control(
indoc      IN     VARCHAR2,
outdoc        OUT VARCHAR2,
request_id IN OUT INTEGER,
piece      IN     INTEGER,
context    IN     VARCHAR2 DEFAULT NULL);
See Demos Below
Overload 2 dbms_drs.do_control(indoc IN VARCHAR2) RETURN INTEGER;
See Demos Below
 
DO_CONTROL_RAW
Control blocking API - designed for solving NLS problem. Send DG Broker control request. It is blocking call.

Overload 1
dbms_drs.do_control_raw(
indoc      IN     RAW,
outdoc        OUT RAW,
request_id IN OUT INTEGER,
piece      IN     INTEGER,
context    IN     VARCHAR2 DEFAULT NULL,
client_id  IN     INTEGER  DEFAULT 0);
TBD
Overload 2 dbms_drs.do_control_raw(indoc IN RAW) RETURN INTEGER;
TBD
 
DUMP_META
DUMP data guard broker metadata file content into a readable text file dbms_drs.dump_meta(options IN INTEGER,metafile IN VARCHAR2, dumpfile IN VARCHAR2);
TBD
 
FS_FAILOVER_FOR_HC_COND
Undocumented
Overload 1
dbms_drs.fs_failover_for_hc_cond(hc_cond IN BINARY_INTEGER, status OUT BINARY_INTEGER);
TBD
Overload 2 dbms_drs.fs_failover_for_hc_cond(hc_cond IN BINARY_INTEGER) RETURN BOOLEAN;
TBD
 
GET_PROPERTY
Get a named property. This function is equivalent to using getid to return the object id, followed by a <do_monitor><property> request. dbms_drs.get_property(
site_name     IN VARCHAR2,
resource_name IN VARCHAR2,
property_name IN VARCHAR2)
RETURN VARCHAR2;
TBD
 
GET_PROPERTY_OBJ
Get a named property. Equivalent to a <DO_MONITOR><PROPERTY> request and parsing the resulting string. dbms_drs.get_property_obj(object_id IN INTEGER, property_name IN VARCHAR2)
RETURN VARCHAR2;
TBD
 
GET_RESPONSE
Get Result (non-blocking) - OBSOLETE, for test use only dbms_drs.get_response(rid IN INTEGER, piece IN INTEGER) RETURN VARCHAR2;
See Demos Below
 
GET_RESPONSE_RAW
Get the result of a non-blocking command. If the command hasn't finished or the piece is beyond the end of the document returns NULL. dbms_drs.get_response_raw(rid IN INTEGER, piece IN INTEGER)
RETURN RAW;
TBD
 
INITIATE_FS_FAILOVER
Undocumented dbms_drs.initiate_fs_failover(condstr IN VARCHAR2, status OUT BINARY_INTEGER);
TBD
 
PING
Undocumented dbms_drs.Ping(
iObid    IN  BINARY_INTEGER,
iVersion IN  BINARY_INTEGER,
iFlags   IN  BINARY_INTEGER,
iMiv     IN  BINARY_INTEGER,
oVersion OUT BINARY_INTEGER,
oFlags   OUT BINARY_INTEGER,
oFoCond  OUT VARCHAR2,
oStatus  OUT BINARY_INTEGER);
TBD
 
READYTOFAILOVER
Undocumented dbms_drs.ReadyToFailover(
iObid    IN  BINARY_INTEGER,
iVersion IN  BINARY_INTEGER,
iFlags   IN  BINARY_INTEGER,
iMiv     IN  BINARY_INTEGER,
iFoCond  IN  VARCHAR2,
oStatus  OUT BINARY_INTEGER);
TBD
 
SLEEP
Suspends the session for a given period of time. Seems to be identical to DBMS_LOCK.SLEEP dbms_drs.sleep(seconds IN INTEGER);
BEGIN
  dbms_drs.sleep(10);
END;
/
 
STATECHANGERECORDED
Undocumented dbms_drs.statechangerecorded(iObid IN BINARY_INTEGER, iVersion IN BINARY_INTEGER);
TBD
 
Demos
Non-Blocking Demo set serveroutput on

DECLARE
 rid    INTEGER;
 indoc  VARCHAR2(4000);
 outdoc VARCHAR2(4000);
 p      INTEGER;
BEGIN
  indoc:='<dummy>foo</dummy>';
  rid := dbms_drs.do_control(indoc);
  dbms_output.put_line('Request_id = '|| rid);

  outdoc := NULL;
  p := 1;
  WHILE (outdoc is null) LOOP
    dbms_drs.sleep(0.2);

    outdoc := dbms_drs.get_response(rid, p);
  END LOOP;

  dbms_output.put_line(outdoc);

  BEGIN
    WHILE (outdoc IS NOT NULL)  LOOP
      p := p+1;
      outdoc := dbms_drs.get_response(rid,p);

      dbms_output.put_line(outdoc);
    END LOOP;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      NULL;
  END;
  dbms_drs.delete_request(rid);
END;
/
Blocking Demo set serveroutput on

DECLARE
 rid    INTEGER;
 indoc  VARCHAR2(4000);
 outdoc VARCHAR2(4000);
 p      INTEGER;
BEGIN
  p:=1;
  indoc:='<dummy>foo</dummy>';
  dbms_drs.do_control(indoc, outdoc, rid, p);
  dbms_output.put_line(outdoc);

  p := 2;
  WHILE (rid IS NOT NULL) LOOP
    dbms_drs.do_control(indoc, outdoc, rid, p);
    dbms_output.put_line(outdoc);
    p := p+1;
  END LOOP;
END;
/

Related Topics
Data Guard
DBMS_DG
DGMGRL
Packages

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2014 Daniel A. Morgan All Rights Reserved