Chinaunix首页 | 论坛 | 博客
  • 博客访问: 73823
  • 博文数量: 12
  • 博客积分: 326
  • 博客等级: 一等列兵
  • 技术积分: 147
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-18 17:00
文章分类

全部博文(12)

文章存档

2012年(12)

我的朋友

分类: Oracle

2012-12-20 15:37:19

用 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>

阅读(9760) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~