用 SQLplus 创建用户的详细步骤 (centos 6.3,Oracle 11g)
以管理员身份登录:
# rlwrap sqlplus / as sysdba
SQL> startup mount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 939526256 bytes
Database Buffers 654311424 bytes
Redo Buffers 7360512 bytes
Database mounted.
打开数据库:
SQL> alter database dbt3 open;
Database altered.
创建一个表空间:
SQL> create tablespace ts datafile '/data/ts.dbf' size 5m;
Tablespace created.
创建新用户:
SQL> create user dbt3user identified by 123456 default tablespace ts;
User created.
给新用户授权:
SQL> grant connect to dbt3user;
Grant succeeded.
SQL> grant resource to dbt3user;
Grant succeeded.
用新用户登录:
SQL> !rlwrap sqlplus dbt3user/123456
SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 20 15:28:53 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
显示当前用户已经是新用户“dbt3user”了:
SQL> show user;
USER is "DBT3USER"
新用户创建表:
SQL> create table student(stuid NUMBER(6));
Table created.
显示新用户的所有表是刚才创建的表:
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
STUDENT
当前用户(即dbt3user)退出:
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
显示当前用户又是之前的系统用户了:
SQL> show user
USER is "SYS"
SQL>
阅读(9889) | 评论(0) | 转发(0) |