用 Sqlplus 创建用户的详细步骤 (centos 6.0,Oracle 11g)

用 SQLplus 创建用户的详细步骤 (centos 6.3,Oracle 11g)

以默认用户身份登录:
# rlwrap sqlplus system/111111@loclhost:1522/xe;

注:以rlwrap开头的命令,可以使在oracle环境中具有上下键记忆功能

创建新用户:
SQL> create user GDB identified by GDB_PWD;

User created.

给新用户授权:
SQL> grant all privilege to GDB;

Grant succeeded.

用新用户登录:
SQL> rlwrap sqlplus GDB/GDB_PWD@loclhost:1522/xe;

SQL*Plus: Release 12.1.0.1.0 Production on Fri Sep 18 16:05:47 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

显示当前用户已经是新用户“GDB”了:
SQL> show user;
USER is "GDB"

新用户创建表:
SQL> create table student(stuid NUMBER(6) NOT NULL, stuname varchar2(18));

Table created.

显示新用户的所有表是刚才创建的表:
SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
STUDENT

当前用户(即GDB)退出:(quit 或 exit)
SQL> quit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

posted @ 2015-09-18 15:41  MorePrograms  阅读(810)  评论(0编辑  收藏  举报