1.进入cmd命令窗口,连接oracle数据库
sqlplus/assysdba
createuserc##scottidentifiedbytiger
3.为用户授权
grantconnect,resource,unlimitedtablespacetoc##scottcontainer=all;
4.设置用户使用的表空间
alteruserc##scottdefaulttablespaceusers;
temporarytablespacetemp;
connectc##scott/tiger
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