CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle DBMS_DRS
Version 11.1
 
General
Note: 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.
Source $ORACLE_HOME/rdbms/admin/dbmsdrs.sql
First Available 9.0.1
Dependencies
DBMS_DG
Exceptions bad_request (ORA-16508)
Security Model Owned by SYS with no privileges granted to any role
 
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
 
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
Overload 2 dbms_drs.do_control(indoc IN VARCHAR2) RETURN INTEGER;
See Demos
 
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 (new in 11g)
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
 
GETMIV
Undocumented dbms_drs.GetMiv(
oMiv     OUT BINARY_INTEGER,
oVersion OUT BINARY_INTEGER);
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. This function is equivalent to calling 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
 
GET_RESPONSE_RAW
Get Result (non-blocking) - designed for solving NLS problem. Get the result of a non-blocking command. If the command hasn't finished, the answer will be NULL. If the piece is beyond the end of the document the answer will be NULL. dbms_drs.get_response_raw(rid IN INTEGER, piece IN INTEGER)
RETURN RAW;
TBD
 
INITIATE_FS_FAILOVER (new in 11g?)
Undocumented dbms_drs.initiate_fs_failover(
condstr IN  VARCHAR2,
status  OUT BINARY_INTEGER);
TBD
 
PING (oFoCond new to 11g)

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 (iFoCond new to 11g)

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 with DBMS_LOCK.SLEEP
dbms_drs.sleep(seconds IN NUMBER);
BEGIN
  dbms_drs.sleep(10);
END;
/
 
STATECHANGERECORDED
Undocumented dbms_drs.statechangerecorded(
iObid    IN BINARY_INTEGER, 
iVersion IN BINARY_INTEGER);
TBD
 
Demo

Non-Blocking Demo
blocking
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
DGMGRL
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [81 users online]    © 2010 psoug.org