This question is related to creating and initialising test and development databases for an application that has the database running on LUW (linux-unix-windows)
On oracle, we have
- an os user (on linux) called
oracle
, - an admin oracle user called
sys
orsystem
- a fixed predefined oracle user that is the application object
owner, let’s call itappowner
- an oracle user that is the application user, ie has limited
previleges on the objects owned by appowner, let’s call it
appuser
whenever there is a need to initialise the database, ie to start from scratch, we first connect to oracle using sys
or system
oracle user and then issue this command:
DROP USER appowner CASCADE;
and then we go about recreating the user and the objects it owns from scratch. We also grant some previliges to appuser
on the objects created by appowner
The application always logs in as appuser
rather than appowner
unless there are any administrative tasks to be performed on the database.
Now we are porting this application to db2, and this is where we are flummoxed.
For starters, db2 creates these os users, which are also db2 users:
dasusr1
db2inst1
db2fenc1
How do these three users map to sys
/system
, appowner
and appuser
?
I believe dasusr1
is the rough equivalent of sys
/system
,
db2inst1
is the rough equivalent of appowner
, and
db2fenc1
is the rough equivalent of appuser
(please correct me if I’m wrong, and I fully appreciate that the mapping will not be exact)
That being the case, if I have to remove all objects owned by db2inst1
, do I login as dasusr1
and drop the user db2inst1
?
There isn’t really a one to one mapping between the oracle users and db2 users, because
db2inst1
can create multiple databases whereasappuser
is mapped to one database in oracle- within a db2 database, there can be multiple schemas, whereas in oracle, one users maps to one schema
So it’s a little confusing. It would help if someone with experience in porting applications from oracle to db2 could throw some light on the equivalence between the db2 and oracle users, which would finally lead to finding out the db2 equivalent for oracle drop user cascade.