Oracle creates table spaces, creates users, and authorizes

Source: Internet
Author: User

Oracle creates table spaces, creates users, and authorizes

After Oracle is installed, there is a default database in which we can create our own database, in addition to the default database.

To avoid the hassle, you can create a database with the ' Database Configuration Assistant ' wizard (this step must be created, because it's not done well and will make an error when creating the Tablespace-I've been here for hours, dizzy).

After you create a database, you cannot immediately build a table in the database, you must first create the user for the database, and specify a tablespace for the user.

The following are the specific procedures for creating a database User:

1. If a database named ' Test ' has been built now, the test directory already exists in the D:\oracle\oradata\ directory (note: My oracle11g is installed under D:\oracle, if your Oracle is installed in a different directory, Then your new database directory is in the *\oradata\ directory.

2. Before creating a user, create a tablespace:

The format is: Format: Create tablespace table name datafile ' data file name ' size table space;

such as: sql> create tablespace test_tablespace datafile ' d:\oracle\oradata\test\test.dbf ' size 100M;

Where ' Test_tablespace ' is your custom table space name, can be arbitrarily named;

' D:\ORACLE\ORADATA\TEST\TEST.DBF ' is the location of the data file, ' test.dbf ' file name is also arbitrary fetch;

' Size 100M ' Specifies the size of the data file, which is the size of the table space.

Delete a namespace

DROP tablespace test including CONTENTS and Datafiles CASCADE CONSTRAINTS;

3. Now that the table space named ' Test_tablespace ' has been built, the user can be created below:

The format is: Format: Create user username identified by password default Tablespace table space table;

Example: sql> create user Testone identified by testone default Tablespace test_tablespace;

The default tablespace, ' default Tablespace ', uses the table space created above.

4. Then grant to the newly created user:

Sql> Grant Connect,resource to Testone; – Indicates that Connect,resource permissions are granted to Testone users

Sql> Grant DBA to Testone; – Indicates that the grant of DBA authority to the Testone user has been granted successfully.

Ok! Database user creation is complete, and now you can create a data table with that user!

==========================================================================================

After Oracle is installed, there is a default database in which we can create our own database, in addition to the default database.

For beginners, to avoid trouble, you can create a database with the ' Database Configuration Assistant ' Wizard.

After you create a database, you cannot immediately build a table in the database, you must first create the user for the database, and specify a tablespace for the user.

Relationship: A large data is divided into several table space, create a few users and then specify the corresponding table space and authorization, so that users can independently operate their own resources, and often user login into the table space in their own new table AH and so on objects, non-interference.

The following are the specific procedures for creating a database User:

1. If a database named ' newdb ' has been built now

The newdb directory already exists in the D:\app\Administrator\oradata\ directory (note: My oracle11g is installed under D, if your Oracle is installed in a different directory, your new database directory is in the *:\app\ Administrator\oradata\ directory).

2. Create a temporary tablespace before creating the user, and the default temp table space is temp if not created.

sql> CREATE Temporary tablespace db_temp

Tempfile ' D:\app\Administrator\oradata\NewDB\DB_TEMP. DBF '

SIZE 32M

Autoextend on

NEXT 32M masize UNLIMITED

EXTENT MANAGEMENT LOCAL;

3. Create the data table space before creating the user, and the default persistent tablespace is system if not created.

sql> CREATE tablespace Db_data

LOGGING

DataFile ' D:\app\Administrator\oradata\NewDB\DB_DATA. DBF '

SIZE 32M

Autoextend on

NEXT 32M MAXSIZE UNLIMITED

EXTENT MANAGEMENT LOCAL;

where ' db_data ' and ' db_temp ' are your custom data table space names and temporary tablespace names that can be named arbitrarily; ' D:\app\Administrator\oradata\NewDB\DB_DATA. DBF ' is the location where the data files are stored, ' db_data. DBF ' filename is also arbitrary; ' Size 32M ' Specifies the size of the data file, which is the size of the table space.

4. Now that the table space named ' Db_data ' has been built, the user can be created below:

Sql> CREATE USER NewUser identified by BD123

Account UNLOCK

DEFAULT tablespace Db_data

Temporary tablespace db_temp;

The default tablespace, ' default Tablespace ', uses the table space name created above: Db_data.

Temporary tablespace ' temporary tablespace ' uses the temporary tablespace name created above: Db_temp.

5. Then grant to the newly created user:

Sql> GRANT Connect,resource to NewUser; --Means to grant Connect,resource permissions to news users

Sql> GRANT DBA to NewUser; --Means to grant DBA authority to NewUser users

Authorization is successful.

Ok! Database user creation is complete, and now you can create a data table with that user!

Summary: Creating a user typically has four steps:

First step: Create a temporary table space

Step Two: Create a data table space

Step three: Create a user and make a table space

Fourth step: Grant permissions to the user

Original link: http://www.cnblogs.com/qfb620/p/4578954.html

Oracle creates table spaces, creates users, and authorizes

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.