Establishment of database user, establishment of table space, compilation of data

Source: Internet
Author: User
Tags dba

//Table space Create Smallfile tablespace"Zuoye" DataFile ' D:\ORACLE\11G\ORADATA\ORCL\ZUOYE. DBF 'SIZE 100M autoextend on NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT auto//table Empty Space for room repair add alter tablespace"Zuoye" ADD datafile ' D:\ORACLE\11G\ORADATA\ORCL\ZUOYE1. DBF 'SIZE 100M autoextend on NEXT 100M MAXSIZE unlimited//Create user--Create the user create user Zuoye//User nameIdentified by "123654789"//Password  defaultTablespace Zuoye//Table SpaceTemporary tablespace TEMP;//Temporary table Space--grant/Revoke Role Privileges Grant connect to Zuoye; //Grant Connect permissionGrant DBA to Zuoye;//Grant DBA Authority//Column contents--Create tablecreate table T_hq_zyl ("Bianh" number notNULL,  "Xingm" VARCHAR2 (Ten) notNULL,  "XINGB" numberdefault1 notNULL,  "NIANL" number notNULL,  "Jiatzz" VARCHAR2 (50),  "Xins" numberdefault0 notNULL,  "GONGZSJ" number notNULL);//Comment--ADD comments to the columns comment on column t_hq_zyl."Bianh" isId; Comment on column t_hq_zyl."XINGM" isName; Comment on column t_hq_zyl."XINGB" is' Gender: male-1; female-2; '; Comment on column t_hq_zyl."Nianl" isAge; Comment on column t_hq_zyl."Jiatzz" is' Home Address '; Comment on column t_hq_zyl."Xins" isSalary; Comment on column t_hq_zyl."GONGZSJ" is' Working hours ';//check, constraint--create/recreate CHECK constraints ALTER TABLE T_hq_zy add constraint check_bianh check (Bianh!=Bianh); ALTER TABLE T_hq_zy add constraint check_nianl CHECK (nianl>20 and Nianl<50ALTER TABLE T_hq_zy add constraint check_xingb CHECK (xingb= 1 or XINGB = 2);

You need to create a tablespace before creating a user.

Be careful to add the suffix name of the tablespace file when creating the Tablespace! For example: Biaokongjian. Dbf.. DBF is a file suffix that needs attention

Creation of database users, creation of table spaces, editing of data

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.