[1.7.x] Made sure cursor.close() does not complain if cursor is already closed on Oracle

Refs #22483

Backport of 53d97e4fe3 from master
[1.7.x] Fixed #22498 -- constraint name was not quoted in FK creation SQL

Backport of 843613add4 from master