Added oracle crash reporting - Dongsheng

This commit is contained in:
arifiorino 2019-12-03 03:20:47 +00:00 committed by Dana Van Aken
parent 0dff040012
commit 99a9c3318e
2 changed files with 17 additions and 1 deletions

View File

@ -111,7 +111,20 @@ def restart_database():
sudo('pg_ctl -D {} -w -t 600 restart -m fast'.format(
dconf.PG_DATADIR), user=dconf.ADMIN_USER, capture=False)
elif dconf.DB_TYPE == 'oracle':
run_sql_script('restartOracle.sh')
db_log_path = os.path.join(os.path.split(dconf.DB_CONF)[0], 'startup.log')
local_log_path = os.path.join(dconf.LOG_DIR, 'startup.log')
local_logs_path = os.path.join(dconf.LOG_DIR, 'startups.log')
run_sql_script('restartOracle.sh', db_log_path)
get(db_log_path, local_log_path)
with open(local_log_path, 'r') as fin, open(local_logs_path, 'a') as fout:
lines = fin.readlines()
for line in lines:
if line.startswith('ORACLE instance started.'):
return True
if not line.startswith('SQL>'):
fout.write(line)
fout.write('\n')
return False
else:
raise Exception("Database Type {} Not Implemented !".format(dconf.DB_TYPE))
return True

View File

@ -1,8 +1,11 @@
#!/bin/sh
LOGFILE="$1"
sqlplus / as sysdba <<EOF
shutdown immediate
spool $LOGFILE
startup
spool off
quit
EOF