Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

When migrating data pumps, you usually import and export by user, so you need to verify that non-system users exist in the current database!

Query the OPEN user status in the database:

select username,account_status,created,PROFILE from dba_users where account_status='OPEN' order by created;
Copy the code

In the above SQL query results, non-system users can be filtered according to the created field!

View roles in the database:

select * from dba_roles;
Copy the code

SQL > create user;

select 'create user ' || t.username || ' identified by values ' || chr(39) ||
       u.password || chr(39) || ' default tablespace ' ||
       t.default_tablespace || ' profile ' || p.name || ' Temporary TABLESPACE '|| TEMPORARY_TABLESPACE  ||'; ' create_user_withoutpass
  from dba_users t, sys.user$ u, sys.profname$ p, sys.user_astatus_map m
 where t.user_id = u.user#
   and u.resource$ = p.profile#
   and u.astatus = m.status#
   and t. username in ('User names to be created, separated by commas');
Copy the code

User authorization:

select 'GRANT connect,resource,unlimited tablespace,DBA to ' ||username|| '; ' from dba_users where username in ('User names to be created, separated by commas');
Copy the code

📢 Note: If you are using EXPDP, you do not need to create a user and authorization!


This is the end of sharing ~

If you think the article is helpful to you, please like it, favorites it, pay attention to it, comment on it, and support it four times with one button. Your support is the biggest motivation for my creation.

❤️ technical exchange can follow the public number: Lucifer think twice before you do ❤️