1.前言
在Oracle12c中,已经没有了scott这一实例用户。Oracle学习者们可以通过新建hr用户或是新建scott用户,来完成对Oracle的学习。
2.具体流程
登录系统用户
conn / as sysdba;
删除已有的用户(可选)
DROP USER c##scott cascade;
新建用户,授予权限,连接
CREATE USER c##scott identified by TIGER ;
GRANT CREATE SEQUENCE to c##scott ;
GRANT UNLIMITED TABLESPACE to c##scott ;
GRANT CREATE SESSION to c##scott ;
GRANT CREATE SYNONYM to c##scott ;
GRANT ALTER SESSION to c##scott;
GRANT CREATE DATABASE LINK to c##scott;
GRANT CREATE VIEW to c##scott;
GRANT CREATE TABLE to c##scott;
ALTER USER c##scott DEFAULT TABLESPACE USERS;
ALTER USER c##scott TEMPORARY TABLESPACE TEMP;
CONNECT c##scott/TIGER
- 新建表格并添加数据
-- DEPT表格
CREATE TABLE DEPT
(DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,
DNAME VARCHAR2(14) ,
LOC VARCHAR2(13) ) ;