加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle12c如何创建练习用户scott

发布时间:2020-12-12 14:59:20 所属栏目:百科 来源:网络整理
导读:1.进入cmd命令窗口,连接oracle数据库 sqlplus/ as sysdba 2.创建c##scott用户(这里创建的用户为:c##scott,密码为:tiger) create user c##scottidentified by tiger 3.为用户授权 grant connect ,resource,unlimitedtablespace to c##scottcontainer= all ;


  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;

  • (编辑:李大同)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

      推荐文章
        热点阅读