Create a namespace and a new user in Oracle

Source: Internet
Author: User

After Oracle is installed, there is a default database. In addition to this default database, we can also create our own database.

To avoid the trouble, you can use the 'database Configuration Assistant 'Wizard to create a Database, an error will occur when creating the tablespace-I spent a few hours here, Dizzy ).

After creating a database, you cannot create tables in the database immediately. You must first create a user for the database and specify a tablespace for the user.

The procedure for creating a database user is as follows:

1. if a database named 'test' has been created, the test directory already exists under the d: \ oracle \ oradata \ directory (Note: My Oracle11g is installed under d: \ oracle, if your Oracle is installed in another directory, the new database directory is under * \ oradata ).

2. Before creating a user, create a tablespace:

The format is: Format: create tablespace table name datafile 'data filename 'size tablespace size;

For example, SQL> create tablespace test_tablespace datafile 'd: \ oracle \ oradata \ test. dbf' size 100 M;

Specifically, 'test _ tablespace' is your custom tablespace name, which can be any name;

'D: \ oracle \ oradata \ test. dbf 'is the storage location of the data file, and the 'test. dbf' file name is also arbitrary;

'Size 100m' indicates the size of the data file, that is, the size of the tablespace.

Delete a namespace

Drop tablespace test including contents and datafiles cascade constraints;

3. Now the tablespace named 'test _ tablespace 'has been created, and the user can be created below:

The format is: Format: create user name identified by password default tablespace table;

For example, SQL> create user testone identified by testone default tablespace test_tablespace;

The default tablespace 'default tablespace' uses the tablespace created above.

4. Authorize the new user:

SQL> grant connect, resource to testone;-grant connect and resource permissions to testone users

SQL> grant dba to testone;-grant the dba permission to the testone user.

OK! The database user has been created. Now you can use this user to create a data table!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.