Oracle creates table spaces using Sqlplus

Source: Internet
Author: User

One, open the Command Line window, enter the following command: Sqlplus/nolog Enter, the prompt sql> will appear;
At this time input Conn/as SYSDBA general can login, if failed, you can try to use Conn Sys/sys user's password as SYSDBA to retry

Second, to see where the current database files are generally placed: input: select name from V$datafile;
NAME
--------------------------------------------------------------------------------
D:\oracle\oradata\orcl\system01.dbf

D:\oracle\oradata\orcl\undotbs01.dbf

D:\oracle\oradata\orcl\cwmlite01.dbf

D:\oracle\oradata\orcl\drsys01.dbf

D:\oracle\oradata\orcl\indx01.dbf

D:\oracle\oradata\orcl\tools01.dbf

Your data file is placed in the D:\oracle\/oradata\orcl\ directory.

To start creating a database tablespace, the command format is as follows:
Create tablespace table space name datafile ' corresponding filename ' size;
Examples are as follows:
Create tablespace wbppcs datafile ' D:\oracle\oradata\orcl\wbppcs.dbf ' size 3000m;
3000m refers to 3000MB

Four, start creating the user, the command format is as follows:
Create user username identified by password default tablespace user which tablespace to use;
To modify a user's permissions:
Grant role 1, role 2 to user name;
Examples are as follows:
Create user wbppcs identified by wbppcs123 default Tablespace wbppcs;
Grant DBA, connect to Wbppcs;

V. Granting of rights
1, the default ordinary user Scott is not unlocked by default, cannot do that use, the new user does not have any permissions, must be granted permissions
/* Administrator Authorization */
Grant Create session to zhangsan;//Grant Zhangsan user permission to create session, that is, login permission
Grant Unlimited session to zhangsan;//grants Zhangsan user permission to use tablespaces
Grant CREATE table to zhangsan;//grants permissions for creating tables
Grante drop table to zhangsan;//grant permission to delete tables
Grant Insert table to zhangsan;//permissions for inserting tables
Grant Update table to zhangsan;//permissions to modify tables
Grant all to public;//this is more important, grant all permissions (all) for all users (public)
2, Oralce on the rights management more rigorous, ordinary users are also the default can not access each other, need to authorize each other
/*oralce more rigorous rights management, ordinary users are also the default can not access each other * *
Grant SELECT on TableName to zhangsan;//Grant Zhangsan user permission to view the specified table
Grant drop on TableName to zhangsan;//granting permission to delete table
Grant insert on TableName to zhangsan;//permission to be inserted
Grant update on TableName to zhangsan;//granting permission to modify tables
Grant Insert (ID) on tablename to Zhangsan;
Grant Update (ID) on TableName to zhangsan;//grants insert and Modify permissions to specific fields of the specified table, note that only the INSERT and update
Grant alert all table to zhangsan;//grants Zhangsan user alert permission to any table
V. Revocation of Rights
Basic syntax with GRANT, keyword revoke
Vi. Viewing permissions
SELECT * from user_sys_privs;//View all permissions for the current user
SELECT * from user_tab_privs;//View the user's permissions on the table
Vii. Table of users of the action table
/* need to precede the table name with the user name, as follows */
SELECT * FROM Zhangsan.tablename
Viii. Transfer of rights
That is, user a grants permission to B,b to grant the permission of the operation to C again, with the following command:
Grant alert table on TableName to Zhangsan with admin option;//keyword with admin option
Grant alert table on TableName to Zhangsan with Grant option;//keyword with GRANT option effect similar to admin
Nine, the role
A role is a collection of permissions that can grant a role to a user
Create role myrole;//creating roles
Grant create session to myrole;//grants permission to create session Myrole
Grant Myrole to zhangsan;//the role of Zhangsan user Myrole
Drop role myrole; remove roles
/* But some permissions are not granted to the role, such as unlimited tablespace and the Any keyword */

Oracle creates table spaces using Sqlplus

Related Article

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.