#backup full
#read only transactionでDBをbackupし、そのままdropする
#対象モジュール: Admin

Begin;
BeginTimeSpan;
Initialize;
EndTimeSpan;
InitializeSession "";

Command "create area area1 'd:\\dm\\area\\1'";
Command "create table T1(C1 int, C2 nclob)";
Command "alter table T1 set area area1";

Command  "insert into T1 (C1, C2) values (?, ?)" [1, "1"];
Command  "insert into T1 (C1, C2) values (?, ?)" [2, "2"];
Command  "insert into T1 (C1, C2) values (?, ?)" [3, "3"];
Command  "insert into T1 (C1, C2) values (?, ?)" [4, "4"];
Command  "insert into T1 (C1, C2) values (?, ?)" [5, "5"];
Command  "insert into T1 (C1, C2) values (?, ?)" [6, "6"];
Command  "insert into T1 (C1, C2) values (?, ?)" [7, "7"];
Command  "insert into T1 (C1, C2) values (?, ?)" [8, "8"];
Command  "insert into T1 (C1, C2) values (?, ?)" [9, "9"];
Command  "insert into T1 (C1, C2) values (?, ?)" [10, "10"];
Command  "insert into T1 (C1, C2) values (?, ?)" [11, "11"];
Command  "insert into T1 (C1, C2) values (?, ?)" [12, "12"];

# read onlyならば、isolation levelはserializeのみ可能
Command "start transaction read only, using snapshot, isolation level serializable";
# discard snapshotなしはtransactionがread onlyのときのみ可能
Command "start backup full";
Command "end backup";
#rollbackしてもエラーにならないことを確認する
Command "rollback";

# やり直し
Command "start transaction read only, using snapshot, isolation level serializable";
Command "start backup full";
Command "end backup";
#再びcommitする
Command "commit";

# backupは連続して実行可能であることを確認する
Command "start transaction read only, using snapshot, isolation level serializable";
Command "start backup full";
#再びcommitする
#end backupなしにcommitしても、commitの途中でend backupが行われる
#このとき、Admin::EndBackup::EndAllが呼ばれる
Command "commit";

#DBの検査を行う
Command "start transaction read write";
Command "verify database DefaultDB cascade continue";
Command "commit";

Command "drop table T1";
Command "drop area area1";

TerminateSession;

Terminate;
End;

