oracle11g – How to create a database user for oracle 11g on windows 8?

oracle11g – How to create a database user for oracle 11g on windows 8?

I dont use Windows 8, but I guess that it must have some kind of a command prompt (you know, a program that lets you perform text-based (command-line) functions; its window is black with white letters. Once opened, the cursor blinks at the prompt, waiting for your commands). Try to find it, run it.

Then youll be able to connect to your database (you do have it installed, right?) as

C:> sqlplus sys/your_sys_password@database as sysdba

Youll be connected as SYS (be careful! It is a powerful user and its misuse might break your database! Id suggest you to create another user, for example mydba, grant it DBA role and let it perform DBA actions).

If youre unsure of what your tablespaces are, run

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USER_DATA
APEX
APEX_9695076087226093

7 rows selected.

SQL>

as youll need at least two of them. Now create your new user:

SQL> create user mike identified by lion
  2  default tablespace user_data
  3  temporary tablespace temp
  4  profile default
  5  quota unlimited on user_data;

User created.

SQL> grant create session to mike;

Grant succeeded.

SQL>

Granting create session, itll be able to connect to the database, but wont be able to do anything else, so youd have to grant it some more privileges (such as create table, create view, create procedure etc.).

SQL> connect mike/lion@orcl
Connected.
SQL> create table test (id number);
create table test (id number)
*
ERROR at line 1:
ORA-01031: insufficient privileges


SQL>

oracle11g – How to create a database user for oracle 11g on windows 8?

Leave a Reply

Your email address will not be published. Required fields are marked *