I decided to stop using H2 for obvious reasons (I have Oracle on production, compatibility mode is a fake). So, I wrote simple test framework which for each test in my application does the following:
Generate random username (in example below it's
Create new user and tablespace:
create tablespace test_user_ts datafile 'test_user_tabspace.dat' size 10M reuse autoextend on next 500K; create temporary tablespace test_user_ts_tmp tempfile 'test_user.tabspace_temp.dat' size 10M reuse autoextend on next 500K; create user test_user identified by test_password default tablespace test_user_ts temporary tablespace test_user_ts_tmp; grant create session to test_user; grant all privileges to test_user;
Populate database with test data.
drop user test_user cascade; drop tablespace test_user_ts_tmp; drop tablespace test_user_ts;
The problem is that stages 1-3 are slow. How can I make them as fast as possible? Is there maybe any way of copying existing db schema to another one?
Db version: Oracle 11g
I have full control over Oracle instance. It runs on a vagrant image on my dev machine.