python-cx_Oracle/samples/DropSamples.py
Anthony Tuininga 952580a565 Adjust samples so that they run unchanged against Oracle Cloud databases:
- administrative user is ADMIN on the Oracle Cloud databases and SYSTEM on
  local databases (SYSDBA is not available on the Oracle Cloud database)
- use dbms_session.sleep() instead of dbms_lock.sleep() where possible
- environment variables CX_ORACLE_SAMPLES_SYSDBA_USER and
  CX_ORACLE_SAMPLES_SYSDBA_PASSWORD are replaced with
  CX_ORACLE_SAMPLES_ADMIN_USER and CX_ORACLE_SAMPLES_ADMIN_PASSWORD
- new environment variable CX_ORACLE_SAMPLES_DRCP_CONNECT_STRING used for
  specifying the connect string to use for DRCP usage
2019-11-13 16:43:07 -07:00

27 lines
964 B
Python

#------------------------------------------------------------------------------
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# DropSamples.py
#
# Drops the database objects used for the cx_Oracle samples.
#------------------------------------------------------------------------------
from __future__ import print_function
import cx_Oracle
import SampleEnv
def DropSamples(conn):
print("Dropping sample schemas and edition...")
SampleEnv.RunSqlScript(conn, "DropSamples",
main_user = SampleEnv.GetMainUser(),
edition_user = SampleEnv.GetEditionUser(),
edition_name = SampleEnv.GetEditionName())
if __name__ == "__main__":
conn = cx_Oracle.connect(SampleEnv.GetAdminConnectString())
DropSamples(conn)
print("Done.")