support Oracle flash back; auto-fix metric type; compile ojdbc

This commit is contained in:
yangdsh
2019-11-23 20:21:51 +00:00
committed by Dana Van Aken
parent 5555ead3a3
commit dceee6e0ba
8 changed files with 111 additions and 11 deletions

View File

@@ -0,0 +1,11 @@
#!/bin/sh
# Change log mode
sqlplus / as sysdba <<EOF
shutdown immediate
startup mount
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
quit
EOF

View File

@@ -0,0 +1,33 @@
#!/bin/sh
RESTORE_POINT="$1"
SIZE="$2"
RECOVERY_FILE="$3"
# Make sure the physical directory exists
mkdir -p "$DP_PATH"
# Set recovery file and restore point
sqlplus / as sysdba <<EOF
DECLARE
rfdexists INTEGER;
BEGIN
SELECT COUNT(*) INTO rfdexists FROM V\$RECOVERY_FILE_DEST WHERE name='$RECOVERY_FILE';
IF (rfdexists = 0) then
EXECUTE IMMEDIATE 'ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = $SIZE';
EXECUTE IMMEDIATE 'ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = $RECOVERY_FILE';
END IF;
DBMS_OUTPUT.PUT_LINE(rfdexists);
END;
DECLARE
rpexists INTEGER;
BEGIN
SELECT COUNT(*) INTO rpexists FROM v\\\\\$restore_point WHERE name='$RESTORE_POINT';
IF (rpexists = 0) then
EXECUTE IMMEDIATE 'CREATE RESTORE POINT $RESTORE_POINT GUARANTEE FLASHBACK DATABASE';
END IF;
DBMS_OUTPUT.PUT_LINE(rpexists);
END;
quit
EOF

View File

@@ -0,0 +1,13 @@
#!/bin/sh
RESTORE_POINT="$1"
# Flash back
sqlplus / as sysdba <<EOF
SHUTDOWN IMMEDIATE
STARTUP MOUNT
FLASHBACK DATABASE TO RESTORE POINT $RESTORE_POINT;
ALTER DATABASE OPEN RESETLOGS;
quit
EOF

View File

@@ -0,0 +1,10 @@
#!/bin/sh
RESTORE_POINT="$1"
# Remove RESTORE Point
sqlplus / as sysdba <<EOF
'DROP RESTORE POINT $RESTORE_POINT
quit
EOF