oracle12c如何创建练习用户scott

前端之家收集整理的这篇文章主要介绍了oracle12c如何创建练习用户scott前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


  1. 1.进入cmd命令窗口,连接oracle数据库

  2. sqlplus/assysdba

  3. 2.创建c##scott用户(这里创建的用户为:c##scott,密码为:tiger)

  4. createuserc##scottidentifiedbytiger

  5. 3.为用户授权

  6. grantconnect,resource,unlimitedtablespacetoc##scottcontainer=all;

save_snippets.png




[sql]view plaincopy

在CODE上查看代码片

派生到我的代码片

  1. 4.设置用户使用的表空间

  2. alteruserc##scottdefaulttablespaceusers;

  3. temporarytablespacetemp;

  4. 5.使用c##scott用户登录

  5. connectc##scott/tiger

  6. 6.显示当前登录用户

  7. showuser


使用sql Developer创建连接,并使用c##scott用户登录


将以下创建表及其插入表中数据的sql语句执行。记得最后commit;语句

[sql]

  • DROPTABLEDEPT;

  • CREATETABLEDEPT

  • (DEPTNONUMBER(2)CONSTRAINTPK_DEPTPRIMARYKEY,

  • DNAMEVARCHAR2(14),

  • LOCVARCHAR2(13));

  • TABLEEMP;

  • TABLEEMP

  • (EMPNONUMBER(4)CONSTRAINTPK_EMPENAMEVARCHAR2(10),

  • JOBVARCHAR2(9),

  • MGRNUMBER(4),

  • HIREDATEDATE,

  • SALNUMBER(7,2),

  • COMMNUMBER(7,

  • DEPTNONUMBER(2)CONSTRAINTFK_DEPTNOREFERENCESDEPT);

  • INSERTINTODEPTVALUES

  • (10,'ACCOUNTING','NEWYORK');

  • VALUES(20,'RESEARCH','DALLAS');

  • VALUES

  • (30,'SALES','CHICAGO');

  • VALUES

  • (40,'OPERATIONS','BOSTON');

  • INTOEMPVALUES

  • (7369,'SMITH','CLERK',7902,to_date('17-12-1980','dd-mm-yyyy'),800,NULL,20);

  • VALUES

  • (7499,'ALLEN','SALESMAN',7698,to_date('20-2-1981',1600,300,30);

  • VALUES

  • (7521,'WARD',to_date('22-2-1981',1250,500,153);font-weight:bold;background-color:inherit;">VALUES

  • (7566,'JONES','MANAGER',7839,to_date('2-4-1981',2975,153);font-weight:bold;background-color:inherit;">VALUES

  • (7654,'MARTIN',to_date('28-9-1981',1400,153);font-weight:bold;background-color:inherit;">VALUES

  • (7698,'BLAKE',to_date('1-5-1981',2850,153);font-weight:bold;background-color:inherit;">VALUES

  • (7782,'CLARK',to_date('9-6-1981',2450,10);

  • VALUES

  • (7788,'SCOTT','ANALYST',7566,to_date('13-JUL-87')-85,3000,153);font-weight:bold;background-color:inherit;">VALUES

  • (7839,'KING','PRESIDENT',to_date('17-11-1981',5000,153);font-weight:bold;background-color:inherit;">VALUES

  • (7844,'TURNER',to_date('8-9-1981',1500,153);font-weight:bold;background-color:inherit;">VALUES

  • (7876,'ADAMS',7788,to_date('13-JUL-87')-51,1100,153);font-weight:bold;background-color:inherit;">VALUES

  • (7900,'JAMES',to_date('3-12-1981',950,153);font-weight:bold;background-color:inherit;">VALUES

  • (7902,'FORD',153);font-weight:bold;background-color:inherit;">VALUES

  • (7934,'MILLER',7782,to_date('23-1-1982',1300,153);font-weight:bold;background-color:inherit;">TABLEBONUS;

  • TABLEBONUS

  • (

  • ENAMEVARCHAR2(10),

  • SALNUMBER,

  • COMMNUMBER

  • );

  • TABLESALGRADE;

  • TABLESALGRADE

  • (GRADENUMBER,

  • LOSALNUMBER,

  • HISALNUMBER);

  • INTOSALGRADEVALUES(1,700,1200);

  • VALUES(2,1201,1400);

  • VALUES(3,1401,2000);

  • VALUES(4,2001,3000);

  • VALUES(5,3001,9999);

  • COMMIT;

  • 原文链接:https://www.f2er.com/oracle/209419.html

    猜你在找的Oracle相关文章