---
title: "Schema与User的区别"
author: "dotjar"
date: "2011-04-15T13:02:42Z"
tags: []
categories: ["数据库"]
slug: "schema-user"
draft: false
lastmod: "2011-04-15T13:02:42Z"
id: 1004064
url: "https://niewj.iteye.com/blog/1004064"
---

Schema:

"A **schema** is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema. "

这段话来自Oracle

[http://download.oracle.com/docs/cd/B10500\_01/server.920/a96524/c11schem.htm#22628](http://download.oracle.com/docs/cd/B10500_01/server.920/a96524/c11schem.htm#22628 "Oracle_Schema")

Schema是一个逻辑结构数据的集合。一个Schema属于一个数据库User，并且与该User同名。每个User只拥有一个Schema。

 

所以当我们使用scott/tiger登录，执行数据库MyDB下的表TUser查询时：

SELECT * FROM TUser

等价于

SELECT * FROM scott.TUser;

但是此处的scott是Schema而不是User，因为table是属于Schema的而不是User，User有的只是管理操纵Schema的权限。