JDBC Connection on Current Primary Database After Switchover: ORA-01033 encountered
And that is why we use role-based services instead of the default service derived from instance_name and db_unique_name.

If your primary database is called PROD_DB (db_unique_name), there will be  service with that name at the primary site, and that service will be available even after a failover or switchover. The listener receives your request, sees that you are requesting to connect using the service PROD_DB, and forwards your request to the instance(s) that provide that service. The instance is in MOUNT stage, and you receive ORA-01033.

Create the role based service at both sites (replace -db and -service values with your current ones):

srvctl add service -db ORCL -service myservice -role primary
srvctl start service -db ORCL -service myservice -role primary


The start step will fail at the standby site, and the service remains in INTERMEDIATE state, but that is normal.

With this, the service is automatically relocated (stopped at old primary and started at new primary) when you perform a role transition with Data Guard broker. 

And use this service for connecting:

(DESCRIPTION_LIST=
    (LOAD_BALANCE=off)
    (FAILOVER=on)

    (DESCRIPTION=
        (ADDRESS_LIST=
            (LOAD_BALANCE=on)
            (ADDRESS=(PROTOCOL=tcp)(HOST=PROD_DB_1)(PORT=1521))
            (ADDRESS=(PROTOCOL=tcp)(HOST=PROD_DB_2)(PORT=1521))
        )
        (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=myservice))
    )

    (DESCRIPTION=
        (ADDRESS_LIST=
            (LOAD_BALANCE=on)
            (ADDRESS=(PROTOCOL=tcp)(HOST=DR_DB_1)(PORT=1521))
            (ADDRESS=(PROTOCOL=tcp)(HOST=DR_DB_2)(PORT=1521))
        )
        (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=myservice))
    )

)


When you try to connect using the service myservice, and your client tries the first entry (old primary, currently standby), the listener refuses the connection as there will be no myservice service running at that site, and your client tries the next available address.