Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

A begginer question: How to get directly a sub-object in pl/sql

itshakNov 14 2019 — edited Nov 17 2019

Hi,

I'm using a Oracle 18.7 DB version.

I don't success to get directly the sub-object "department" from the next example.

I received the error:

ORA-30625: method dispatch on NULL SELF argument is disallowed

I think that something is wrong when I writed the syntax

declare

j clob :=

'{

  "departments":

    {

      "department":{

        "department_name":"DEV",

        "department_no":70,

        "employees":[

          {

            "employee_number":9000,

            "employee_name":"JONES",

            "salary":1000

          },

          {

            "employee_number":9001,

            "employee_name":"SMITH",

            "salary":2000

          }

        ]

      }

    }

}';

  j2  JSON_OBJECT_T;

  j3    JSON_OBJECT_T;

begin

  j2 := JSON_OBJECT_T( j );

  j3 := j2.get_object( 'departments.department' ); -- j2.get_object( '$.departments.department' );

  dbms_output.put_line( j3.to_string );

--  dbms_output.put_line( j3.get_string( 'department_name' ) );

end;

/

Thanks on advance for every one that cal helps me.

Isaac

p.d.

My true target is to get the value of the "department_name" but I need to perform it in two steps:

1) Get the Object parent

2) Get the child value

Comments

Ivica Arsov

Hi,

I didn't understand your process, but anyway why don't you just open the standby database in read only mode (active data guard) ?

Anar Godjaev

hi,

You use active DataGuard? Secondary Database (Standby database) in read only mode?

Can you please paste here: (Standby Database)

SQL>select open_mode from v$database;

And

SQL> set linesize 1000

SQL> set pagesize 100

SQL>

SQL> select name, value from v$dataguard_Stats;

Thank you

saurabh

you database version information is important.

yes you can do this. some important points to remeber.

1. before shutdown of the dr defer the log_archive_dest for standby to stop archive shipping to the standby.

2. after shuttting down the DR copy the datafile and controlfile as well.

3. After your testing is completed.

4. REMANE  PROD_bak to PROD and then start the standby dataabse. The database which you have open if not required then delete all the file before renaming.


mrmessin

You can open a standby database read only, no issues there keep in mind that archive log apply will stop while the database is read only unless you use the active dataguard option, but depending on version of the database it may not be available.

See Oracle documentation I got all this from there:

http://docs.oracle.com/cd/B10501_01/server.920/a96653/manage_ps.htm


To open a standby database for read-only access when it is currently shut down:

  1. Start the Oracle instance for the standby database without mounting it:

          SQL> STARTUP NOMOUNT;

  1. Mount the standby database:

          SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

  1. Open the database for read-only access:

          SQL> ALTER DATABASE OPEN READ ONLY;

To open a standby database for read-only access when it is currently performing managed recovery:

     Cancel log apply services:

          SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

     Open the database for read-only access:

          SQL> ALTER DATABASE OPEN READ ONLY;

Now to put the database back to physical standby and apply the logs

To change the standby database from being open for read-only access to performing managed recovery:

     Terminate all active user sessions on the standby database, a shutdown works very well here

          SQL> shutdown immediate;

     Restart log apply services:

          SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Anar Godjaev

HI again,

Please check step by step in Secondary (Standby Database)

SQL> set linesize 1000

SQL> set pagesize 100

SQL>

SQL> select name, value from v$dataguard_Stats;  -- is ok then check below step:

For example: in Standby database:

NAME                      VALUE

------------------------- --------------------------------------------------

transport lag             +00 00:00:00

apply lag                 +00 00:00:00

apply finish time         +00 00:00:00.000

estimated startup time    21

------------------------------------------------------------------------------

Next Step in Secondary database:

          SQL> STARTUP NOMOUNT;

          SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

          SQL> ALTER DATABASE OPEN READ ONLY;

And starying again MRP process in Secondary database:

STARTUP NOMOUNT

ALTER DATABASE MOUNT STANDBY DATABASE;

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Thank you

unknown-1052419

Thanks ALL,

DB 11.2.0.1

Supposing I will not hold-off or disrupt the standby db process since I am afraid that disaster strikes while it is paused off.

But instead I will create another reporting db  out of the standby because the standby server has not so much load on it.

Is this possible with RMAN? Creating a duplicate db out of the standby?

saratpvv

Why not - You can create duplicate db - Till now you haven't posted your db version..?

unknown-1052419

My db is 11.2.0.1

saurabh

As your database is of 11g version. You can take advantage of snapshot standby.

unknown-1052419

I searched google about snapshot db but it so complicated.

It says I need to configure DGBROKER which also complicated by its name.

Can I create snapshot db without using dgbroker?

Thanks,

saurabh
Answer
Marked as Answer by unknown-1052419 · Sep 27 2020
unknown-1052419

Thanks Saur

1 - 12

Post Details

Added on Nov 14 2019
6 comments
773 views