1. 程式人生 > 其它 >Oracle建立使用者和表空間

Oracle建立使用者和表空間

一、概述

1.資料庫實際管理中,不同業務系統需要使用’不同的使用者'進行管理維護和使用,這樣做把業務資料和系統資料獨立分開管理,利於資料庫系統管理;

2.在資料庫中建立業務系統使用者時候,建議為使用者建立指定的使用者表空間,否則全部預設為user表空間儲存,使得user表空間容易過大,不易管理、查詢。

二、操作

1.create user <username> identified by <password>;  此方式使用預設user表空間,不推薦此語句。

2.create user <username> identified by <password>

  default tablespace <tablespace_name> --預設的指定表空間

 temporary tablespace temp  --預設的臨時表空間

quota unlimited on <tablespace_name>  --表空間額度

grant create session to <username> ; --授權登陸。

示例:

create user test identified by 123456

default tablespace testtbs --指定的表空間

temporary tablespace testtemp  --指定的臨時表空間

quota unlimited on testtbs  --表空間額度

grant create session to test; --授權登陸。

 3.查詢

SQL> select * from dba_users t where t.username=test;