oracle练习1-删除scott用户,并重建
2013-12-10 15:32
681 查看
一,概述
scott用户是oracle自带的测试用户,当删除后,可手动建立。如果没有 scott 用户也不要紧,数据库内含了建立该用户的脚本
SQL> @%oracle_home%\rdbms\admin\utlsampl.sql 建立完成以后会自动退出 sqlplus,请重新登录既可。
SCOTT 用户可以随时被删除和建立,该用户存在的目的就是为了实验用的,表很少,但又代
表了一定的典型数据库的应用。
Sql> @%oracle_home%\rdbms\admin\scott.sql scott.sql 脚本也可以建立 scott 用户, 有的平台没有这个脚本, 只有 utlsampl.sql 脚本。
这两个脚本有点差别,但不大。一个含有自动退出,一个保留会话。
二,操作步骤
(1) oracle版本查看
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
(2)执行@%oracle_home%\rdbms\admin\utlsampl.sql
SQL> conn /as sysdba;
已连接。
SQL> drop user scott;
drop user scott
*
第 1 行出现错误:
ORA-01922: 必须指定 CASCADE 以删除 'SCOTT'
###drop user ; 仅仅是删除用户,drop user ×× cascade ;会删除此用户名下的所有表和视图。###
SQL> drop user scott cascade;
用户已删除。
SQL> conn scott/tiger;
ERROR:
ORA-01017: invalid username/password; logon denied
警告: 您不再连接到 ORACLE。
SQL> conn /as sysdba;
已连接。
SQL> @%oracle_home%\rdbms\admin\utlsampl.sql
从 Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 10 15:12:08 2013
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn scott/tiger;
已连接。
SQL>
(3)执行@%oracle_home%\rdbms\admin\scott.sql
SQL> conn /as sysdba;
已连接。
SQL> drop user scott cascade;
用户已删除。
SQL> @%oracle_home%\rdbms\admin\scott.sql
SQL> conn scott/tiger;
已连接。
SQL>
scott用户是oracle自带的测试用户,当删除后,可手动建立。如果没有 scott 用户也不要紧,数据库内含了建立该用户的脚本
SQL> @%oracle_home%\rdbms\admin\utlsampl.sql 建立完成以后会自动退出 sqlplus,请重新登录既可。
SCOTT 用户可以随时被删除和建立,该用户存在的目的就是为了实验用的,表很少,但又代
表了一定的典型数据库的应用。
Sql> @%oracle_home%\rdbms\admin\scott.sql scott.sql 脚本也可以建立 scott 用户, 有的平台没有这个脚本, 只有 utlsampl.sql 脚本。
这两个脚本有点差别,但不大。一个含有自动退出,一个保留会话。
二,操作步骤
(1) oracle版本查看
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
(2)执行@%oracle_home%\rdbms\admin\utlsampl.sql
SQL> conn /as sysdba;
已连接。
SQL> drop user scott;
drop user scott
*
第 1 行出现错误:
ORA-01922: 必须指定 CASCADE 以删除 'SCOTT'
###drop user ; 仅仅是删除用户,drop user ×× cascade ;会删除此用户名下的所有表和视图。###
SQL> drop user scott cascade;
用户已删除。
SQL> conn scott/tiger;
ERROR:
ORA-01017: invalid username/password; logon denied
警告: 您不再连接到 ORACLE。
SQL> conn /as sysdba;
已连接。
SQL> @%oracle_home%\rdbms\admin\utlsampl.sql
从 Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 10 15:12:08 2013
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn scott/tiger;
已连接。
SQL>
(3)执行@%oracle_home%\rdbms\admin\scott.sql
SQL> conn /as sysdba;
已连接。
SQL> drop user scott cascade;
用户已删除。
SQL> @%oracle_home%\rdbms\admin\scott.sql
SQL> conn scott/tiger;
已连接。
SQL>
相关文章推荐
- oracle的scott用户默认表sql删除后恢复和字段
- Oracle导入SQL脚本执行 scott 用户下的表删除了
- Oracle练习:有关Oracle用户scott的sql练习
- Oracle中scott用户下基本表练习SQL语句
- Oracle通过scott用户中的emp练习单表操作
- oracle中scott用户下四个基本表SQL语句练习
- Oracle删除用户及表空间
- oracle删除用户后,却还可以使用该用户登录?
- Oracle创建、删除表空间、用户
- 给Oracle增加Scott用户
- oracle 数据库表空间、用户、权限的创建与删除
- oracle 删除表、表空间、用户时,如何释放磁盘空间
- Oracle教程之Oracle管理用户(二)--Oracle修改及删除用户
- Oracle 删除用户以及表空间
- Oracle基础知识笔记(3) Scott用户的表结构
- oracle创建用户、授予权限及删除用户
- Oracle:强制删除正在连接的用户
- Oracle无法删除当前连接用户,以及killed的处理
- 浅析Oracle中sys、system和Scott用户下的数据库连接问题
- 误删除$ORACLE_HOME/dbs下的参数文件、密码文件,如何快速重建