It is important to shutdown the oracle database gracefully. Otherwise, you may have a corrupted database. By using python programming and cx_Oracle, it is easy stop database safely. I have been using this code for over 4 years on my Oracle 10g under Windows Server and did not have any problem as far as I know :).
Starting database is trivial as can be seen.
# encoding: utf-8 """ @license: MIT """ import subprocess import cx_Oracle USERNAME = "USERNAME" PASSWORD = "PASSWORD" DATABASE_NAME = "PROD" SERVICE_NAME = 'OracleServicePROD' IP_ADDRESS = "192.168.1.X" def start_oracle(): res = subprocess.Popen('net start ' + SERVICE_NAME, stdout=subprocess.PIPE) return_code = res.wait() return_txt = res.stdout.read() def stop_oracle(): conn = cx_Oracle.connect(USERNAME + "/" + PASSWORD + "@" + IP_ADDRESS + "/" + DATABASE_NAME, mode=cx_Oracle.SYSDBA) conn.shutdown(mode=cx_Oracle.DBSHUTDOWN_TRANSACTIONAL) conn.shutdown(mode=cx_Oracle.DBSHUTDOWN_FINAL) res = subprocess.Popen('net stop ' + SERVICE_NAME, stdout=subprocess.PIPE) return_code = res.wait() return_txt = res.stdout.read()