Chinaunix首页 | 论坛 | 博客
  • 博客访问: 77337
  • 博文数量: 9
  • 博客积分: 133
  • 博客等级: 二等列兵
  • 技术积分: 115
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-08 14:53
文章分类

全部博文(9)

文章存档

2011年(5)

2010年(4)

分类: Oracle

2010-11-11 18:58:50

一般安装Oracle之后,如果scott用户无法登录,则需要以system用户登录,然后解锁即可
  1. SQL> ALTER user scott account UNLOCK
  2. SQL> ALTER user scott IDENTIFIED BY tiger;淇?敼scott鐢ㄦ埛瀵嗙爜
可是发现速成版中根本就没有scott用户,自然也就无法解锁,这应该是需要运行soctt.sql文件,从$ORACLE_HOME/rdbms/admin
文件夹中寻找,发现也并没有scott.sql文件。
这可能是由于express版本中本来就不带有该文件的缘故,可以从其他版本中复制,soctt.sql文件内容如下,可以复制,运行即可
  1. Rem Copyright (c) 1990 BY Oracle Corporation
  2. Rem NAME
  3. REM UTLSAMPL.SQL
  4. Rem FUNCTION
  5. Rem NOTES
  6. Rem MODIFIED
  7. Rem gdudey 06/28/95 - Modified FOR desktop seed DATABASE
  8. Rem glumpkin 10/21/92 - Renamed FROM SQLBLD.SQL
  9. Rem blinden 07/27/92 - Added PRIMARY AND FOREIGN KEYS TO EMP AND DEPT
  10. Rem rlim 04/29/91 - CHANGE char TO varchar2
  11. Rem mmoore 04/08/91 - USE unlimited tablespace priv
  12. Rem pritto 04/04/91 - CHANGE SYSDATE TO 13-JUL-87
  13. Rem Mendels 12/07/90 - bug 30123;add to_date calls so LANGUAGE independent
  14. Rem
  15. rem
  16. rem $Header: utlsampl.sql 7020100.1 94/09/23 22:14:24 cli Generic <base> $ sqlbld.sql
  17. rem
  18. SET TERMOUT OFF
  19. SET ECHO OFF

  20. rem CONGDON Invoked IN RDBMS at build time. 29-DEC-1988
  21. rem OATES: Created: 16-Feb-83

  22. GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO SCOTT IDENTIFIED BY TIGER;
  23. ALTER USER SCOTT DEFAULT TABLESPACE USERS;
  24. ALTER USER SCOTT TEMPORARY TABLESPACE TEMP;
  25. CONNECT SCOTT/TIGER
  26. DROP TABLE DEPT;
  27. CREATE TABLE DEPT
  28.               (DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,
  29. DNAME VARCHAR2(14) ,
  30. LOC VARCHAR2(13) ) ;
  31. DROP TABLE EMP;
  32. CREATE TABLE EMP
  33.               (EMPNO NUMBER(4) CONSTRAINT PK_EMP PRIMARY KEY,
  34. ENAME VARCHAR2(10),
  35. JOB VARCHAR2(9),
  36. MGR NUMBER(4),
  37. HIREDATE DATE,
  38. SAL NUMBER(7,2),
  39. COMM NUMBER(7,2),
  40. DEPTNO NUMBER(2) CONSTRAINT FK_DEPTNO REFERENCES DEPT);
  41. INSERT INTO DEPT VALUES
  42. (10, 'ACCOUNTING ', 'NEW YORK ');
  43. INSERT INTO DEPT VALUES (20, 'RESEARCH ', 'DALLAS ');
  44. INSERT INTO DEPT VALUES
  45. (30, 'SALES ', 'CHICAGO ');
  46. INSERT INTO DEPT VALUES
  47. (40, 'OPERATIONS ', 'BOSTON ');
  48. INSERT INTO EMP VALUES
  49. (7369, 'SMITH ', 'CLERK ',7902,to_date( '17-12-1980 ', 'dd-mm-yyyy '),800,NULL,20);
  50. INSERT INTO EMP VALUES
  51. (7499, 'ALLEN ', 'SALESMAN ',7698,to_date( '20-2-1981 ', 'dd-mm-yyyy '),1600,300,30);
  52. INSERT INTO EMP VALUES
  53. (7521, 'WARD ', 'SALESMAN ',7698,to_date( '22-2-1981 ', 'dd-mm-yyyy '),1250,500,30);
  54. INSERT INTO EMP VALUES
  55. (7566, 'JONES ', 'MANAGER ',7839,to_date( '2-4-1981 ', 'dd-mm-yyyy '),2975,NULL,20);
  56. INSERT INTO EMP VALUES
  57. (7654, 'MARTIN ', 'SALESMAN ',7698,to_date( '28-9-1981 ', 'dd-mm-yyyy '),1250,1400,30);
  58. INSERT INTO EMP VALUES
  59. (7698, 'BLAKE ', 'MANAGER ',7839,to_date( '1-5-1981 ', 'dd-mm-yyyy '),2850,NULL,30);
  60. INSERT INTO EMP VALUES
  61. (7782, 'CLARK ', 'MANAGER ',7839,to_date( '9-6-1981 ', 'dd-mm-yyyy '),2450,NULL,10);
  62. INSERT INTO EMP VALUES
  63. (7788, 'SCOTT ', 'ANALYST ',7566,to_date( '13-JUL-87 ')-85,3000,NULL,20);
  64. INSERT INTO EMP VALUES
  65. (7839, 'KING ', 'PRESIDENT ',NULL,to_date( '17-11-1981 ', 'dd-mm-yyyy '),5000,NULL,10);
  66. INSERT INTO EMP VALUES
  67. (7844, 'TURNER ', 'SALESMAN ',7698,to_date( '8-9-1981 ', 'dd-mm-yyyy '),1500,0,30);
  68. INSERT INTO EMP VALUES
  69. (7876, 'ADAMS ', 'CLERK ',7788,to_date( '13-JUL-87 ')-51,1100,NULL,20);
  70. INSERT INTO EMP VALUES
  71. (7900, 'JAMES ', 'CLERK ',7698,to_date( '3-12-1981 ', 'dd-mm-yyyy '),950,NULL,30);
  72. INSERT INTO EMP VALUES
  73. (7902, 'FORD ', 'ANALYST ',7566,to_date( '3-12-1981 ', 'dd-mm-yyyy '),3000,NULL,20);
  74. INSERT INTO EMP VALUES
  75. (7934, 'MILLER ', 'CLERK ',7782,to_date( '23-1-1982 ', 'dd-mm-yyyy '),1300,NULL,10);
  76. DROP TABLE BONUS;
  77. CREATE TABLE BONUS
  78. (
  79. ENAME VARCHAR2(10) ,
  80. JOB VARCHAR2(9) ,
  81. SAL NUMBER,
  82. COMM NUMBER
  83. ) ;
  84. DROP TABLE SALGRADE;
  85. CREATE TABLE SALGRADE
  86.             ( GRADE NUMBER,
  87. LOSAL NUMBER,
  88. HISAL NUMBER );
  89. INSERT INTO SALGRADE VALUES (1,700,1200);
  90. INSERT INTO SALGRADE VALUES (2,1201,1400);
  91. INSERT INTO SALGRADE VALUES (3,1401,2000);
  92. INSERT INTO SALGRADE VALUES (4,2001,3000);
  93. INSERT INTO SALGRADE VALUES (5,3001,9999);
  94. COMMIT;

  95. SET TERMOUT ON
  96. SET ECHO ON

OK,将该文件导入即可

  1. [root@localhost human_resources]# sqlplus system

  2. SQL*Plus: Release 10.2.0.1.0 - Production ON Fri Nov 5 11:17:29 2010

  3. Copyright (c) 1982, 2005, Oracle. ALL rights reserved.

  4. Enter password:

  5. Connected TO:
  6. Oracle DATABASE 10g Express Edition Release 10.2.0.1.0 - Production

  7. SQL> @/root/scott.sql
  8. SQL> conn scott
  9. Enter password:
  10. Connected.
以scott用户登录,可以正常使用了。开始享受中^_^
阅读(3535) | 评论(0) | 转发(0) |
0

上一篇:Linux下安装Oracle express

下一篇:保重身体哈

给主人留下些什么吧!~~