Okay, I get it.
If the question is "will that compile" the answer is yes.
why?
Oracle "is a" Database
This means at any point, a Database object *might* be an Oracle object (but it *might* not be, the point is that it *could* be). The same way that all objects have the Object class as a supertype.
a simpler example:
At 1, we can assign
String to Object because String "is a" Object (just like Oracke "is a" Database in your example). At 2, all the compiler knows is that we are casting an Object to an Integer. Integer "is a" Object, so this case *might* work (we know in this case that it won't work, but that's beside the point). The cast is the programmer telling the compiler "I know the type really is Integer, even though you think it's just Object". The compilter looks at Integer and sees that it has Object as a supertype and thus an Integer can be stored in an Object reference.
Here's an example where it won't work:
This time, I've set the time of something to String (1). When the compiler looks at 2, it knows that an Integer could never be stored in a String (Integer is *not* a String because it does not have String as a supertype).
A good programmer will guard their casts (and possibly try/catch exceptions) as follows:
At execution, this program will output "something is not an Integer" because the if statement at 1 will validate the cast *before* it is executed. The instanceof operator will evaluate to true if the object on the left has the object on the right as a type or supertype. In this case, the String instance does not have Integer as a sypertype and so the if statement will be false (and run the else block).
This facility (of being able to cast down an object hierarchy) is a necessary* feature and you, as a programmer, have to know that (1) it can compile even if it is obviously wrong and that (2) there are ways to prevent and guard against bad casts (instanceof cast guarding is common).
* necessary, for example, because collections (like List, Vector, etc) used to only return Objects from get methods (with generics, they can return a specific type). You would, at some point, have to cast down from the Object to make the result useful - but you chould guard your casts.
Hope that helps.