Application testing: using multiple users in Oracle instead of mem H2. How to make it as fast as possible?
1
vote
2
answers
437
views
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:
1. Generate random username (in example below it's
test_user
).
2. 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;
4. Populate database with test data.
5. Run test.
6. Clean up:
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.
Asked by whysoserious
(113 rep)
Dec 29, 2014, 07:56 AM
Last activity: Dec 30, 2014, 12:06 AM
Last activity: Dec 30, 2014, 12:06 AM