Oracle user and schema, table space

oracle user table space relations

Original  https://www.cnblogs.com/qiuhong10/p/7883156.html

oracle user table space relationship with the
user = merchants
table = commodity
table warehouse space =
1.1 businesses can have a lot of goods, a commodity can only belong to one business
2.1 Goods can be placed in the warehouse A, it can also be placed in the warehouse B, but not both a and B into
3. the merchant does not belong to the warehouse
4. the merchant has a default warehouse, without specifying the warehouse, the commodity in the default warehouse

All the data are stored in the user oracle tablespace, many users can share a table space, a user can specify only one table space.
Table space: create a table space will create a data file on a physical disk, as the database objects (users, tables, stored procedures, etc.) of physical storage space;
user: Create a user must specify a table space, if not explicit specified the default table space is designated as the users table space; after creating a user, the user can create tables, stored procedures, and so on other database objects;
table: a collection of data records;
creation process: table space ---> users - -> table;
affiliations: table space containing the table that contains the user;

http://www.cnblogs.com/cici-new/archive/2012/12/25/2831740.html
1. First, the overall configuration of ORACLE.
a database is one example of the oracle.
oracle is a user of a Schema (i.e., programs).
oracle structures are ===
          Example -> User -> table (database instance user belongs, belongs to a user table)

So building under construction oracle table space, building users, set the user's default table space, built in user table;

 

--创建数据表空间
create tablespace CICI
logging
datafile 'D:\oraclexe\app\oracle\oradata\CICI\CICI.DBF'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;

- Create a user and specify the table space

CREATE USER cici IDENTIFIED BY cici
PROFILE DEFAULT
DEFAULT TABLESPACE CICI 
ACCOUNT UNLOCK;
-- 为用户赋予权限
GRANT connect, resource TO cici;
grant create session to cici;

 

 Query the database for the current process connections:
SELECT COUNT (*) from V P R & lt O C E S S ; check to see the number of data database when the front will then to connect connection number : S E L E C T C O U n- T ( * ) F R & lt O m V Process; connections database view for the current session: selectcount (*) fromvsession;
see the number of concurrent connections to the database:
SELECT COUNT (*) from Vsession where status = 'ACTIVE'; see the current session the database established: select sid, Serial #, username, Program, Machine, Status from v session where status = 'ACTIVE'; see the current session the database established: select sid, serial #, username, program, machine , status from vsession;
maximum number of connections allowed by the database query:
SELECT WHERE value from V $ Parameter name = 'Processes';

The difference between Oracle and user mode

Transfer: HTTP: //database.51cto.com/art/201010/231679.htm
Oracle users is an important concept in the Oracle database, the following will introduce you to the difference between Oracle and the user mode, I hope for you to learn Oracle user to have respect the help.

(A) what Oracle called user (the User):

A IS A name defined in the User Database that at The CAN Connect to and Access Objects.

Oracle users with access to connect to the database and database objects. (The database is used to connect the user to access the database).

(B) What mode (Schema):

A Collection of Database Schema Objects IS A (Used by User A.).
The Schema Objects The Logical Structures that are to Directly The REFER apos Data Database.

Schema is a collection of database objects. Schema objects are the logical structure of the database data.
(Model with a separate database objects into logical structures).

The difference between (c) the user (user) and the mode (schema) of:

. Users the Schemas and Help Manage Database Database Security Administrators

user is used to connect the database objects. The model is used to create managed objects. Mode with user oracle is one to one relationship.

(But is different db2, db2 a user can correspond to multiple mode, the user is db2 system, he must first get the system user can become a user database, which is the database user is the system user, only the mode is similar to the user database. Interested can to study here is not beside the point, which is unique db2).

We can see from the definition database schema as a collection of objects, many nodes in order to distinguish each collection, we need to give this collection a name, these names is what we see in the Enterprise Manager program similar user names, these similar user name node is actually a schema, schema which contains a variety of objects such as tables, views, sequences, stored procedures , synonyms, indexes, clusters, and database links.

A user generally corresponds to a schema, the schema name is equal to the user's user name, and the user as the default schema. This is what we see in the Enterprise Manager program schema names are the reason for the database user name.

Oracle database can not create a new schema, in order to create a schema, can only be resolved (although Oracle has create schema statement, but it is not used to create a schema's) by creating a user method.
Schem created with the same name as a user to create a user for the user and at the same time as the default shcema the user. That is the same number schema with the user number, name and schema-one correspondence with the user name and the same, all we can say schema for the user alias, although this is not accurate to say, but easier to understand.

A user has a default schema, schema name that is equivalent to the user name, of course, a user can also use other schema. If we access a table, the table does not specify which part of the schema, the system will automatically add the default sheman to our name on the table.

For example, when we access the database, visit the emp table in scott user, through select * from emp;
in fact, the full wording of this statement is sql select * from scott.emp.

The full name of a database object to schema.object, and not belong to user.object. Similarly, if we do not specify the object when you create an object schema, the schema of the object to the user's default schema. It's like a user has a default table space, but the user can also use other table space, if we do not specify a table space when you create an object, the object is stored in the default table space, to get the object store in other table space, we need to specify the table space for the object when the object is created.


The following text from another:


oracle model concept

Transfer: http: //hi.baidu.com/yuyumilk/item/8c6ed580247402ede496e09f

pattern is a set of logical data structure or object. A database user with a pattern, pattern of the same name and database user name. Each user has a separate mode, user-created objects on their own mode, this object is called schema objects.

Oracle has the following schema objects:

clusters (Clusters)
database link (database links)
trigger (Triggers)
dimension (Dimensions)
sequence (sequence)
function (function)
stored procedure (Procedures)
package (package)
Synonym (Synonyms)
table ( table)
index organized tables (index - organized -table)
views (views)
external process (external procedure libraries)
index (indexes)
index type (index types)
Java class (Java classes)
Java resources (Java resources)
Java source (java sources )
materialized views (materialized views)
object table (object table)
operator (operators)

In addition, there are other database objects, but these objects do not belong to the schema objects, these objects we call non-schema objects, non-model objects are:

context (contexts)
directory (directories)
resource limits file (profiles)
role (roles )
tablespace (the tablespaces)
user (users)

mode object is stored in the space table, but the table schema objects, data files do not correspond. Mode and tablespace, data files do not correspond.

 

 

 

A user is a table table1 owner of, B the user to query table1 data

1 , the user A to user B authorization query permissions (User B after logging data can query, the SELECT * from  A. the Table 1 , the display is a must in order to master the written inquiry)

2 , the user A to table1 build a synonym, query the Table 1 , you can direct the SELECT * from the Table 1 , hidden away table1 owner of

create orreplace  synonym   lsfapcopr.tsysparameter for   lsfapdata.tsysparameter;

 

 

 

1, the owner (owner) in simple words, is the user database.

2 , Schema is a collection of database objects, a user generally corresponds to a schema , the user's schema name equal to the user name, and as the user's default schema , which is why the program schema names are the reason for the database user name. Note: the Oracle database can not create a new Schema , in order to create a Schema , can only be resolved by creating a user method.

3 , synonyms ( Synonyms ) is an alias literally meaning, and trying to functions like, is a relationship mapping. After setting synonymous with the user has permission to access, and can be hidden away user name .

 

 

Some people are still on the true meaning of the schema do not quite understand, and now I again sorted out, we want to help.

We first look at their definitions:

Aschema is a collection of database objects (used by a user.).

Schemaobjects are the logical structures that directly refer to the database’s data.

Auser is a name defined in the database that can connect to and access objects.

Schemasand users help database administrators manage database security.

We can see from the definition database schema as a collection of objects, many nodes in order to distinguish each collection, we need to give this collection a name, these names is what we see in the Enterprise Manager program similar user names, these similar user name node is actually a schema, schema which contains a variety of objects such as tables, views, sequences, stored procedures, synonyms, indexes, clusters, and databaselinks.

A user generally corresponds to a schema, the schema name is equal to the user's user name, and the user as the default schema. This is what we see in the Enterprise Manager program schema names are the reason for the database user name. Oracle database can not create a new schema, in order to create a schema, can only be resolved (although Oracle has createschema statement, but it is not used to create a schema's) by creating a user approach, creating a user at the same time schem create a user with the same name as the default for the user and the user's shcema. That is the same number schema with the user number, name and schema-one correspondence with the user name and the same, all we can say schema for the user alias, although this is not accurate to say, but easier to understand.

A user has a default schema, schema name that is equivalent to the user name, of course, a user can also use other schema. If we access a table, the table does not specify which part of the schema, the system will automatically add the default sheman to our name on the table. For example, when we access the database, visit the emp table in scott user, through select * from emp; in fact, the full wording of this statement is sql select * fromscott.emp. The full name of a database object to schema.object, and not belong to user.object. Similarly, if we do not specify the object when you create an object schema, the schema of the object to the user's default schema. It's like a user has a default table space, but the user can also use other table space, if we do not specify a table space when you create an object, the object is stored in the default table space, to get the object store in other table space, we need to specify the table space for the object when the object is created.

 

SQL>Gruant dba to scott

SQL>create table test(name char(10));

Tablecreated.

SQL>create table system.test(name char(10));

Tablecreated.

SQL>insert into test values('scott');

1row created.

SQL>insert into system.test values('system');

1row created.

SQL>commit;

Commitcomplete.

SQL>conn system/manager

Connected.

SQL>select * from test;

NAME

----------

system

SQL> ALTER SESSION SET CURRENT_SCHEMA = scott; - change the default user name schema

Sessionaltered.

SQL>select * from test;

NAME

----------

scott

SQL>select owner ,table_name from dba_tables where table_name=upper('test');

OWNERTABLE_NAME

------------------------------------------------------------

SCOTTTEST

SYSTEMTEST

  

Table space:

A table space is a disk area, he was one or more disk files, a table space can accommodate many tables, index, or cluster, etc.

Each table space is a prefabricated hit a disk area called the initial interval (initialextent) runs out at the interval with a thick, know run out of table space, table space at this time needs to be extended, or expanded to increase the data file has been existing data files

 

schema:

In general, a schema corresponding to a user, the user's schema name equal to the user name, and the user as the default schema, users can not create a schema, the schema is created when you create a user, and the user can specify various table space (this is different with PostgreSQL, PostgreSQL schema is created and assigned to a user). Currently connected to all database objects users on a database created with default belong to this schema (ie, without indicating the schema), for example, if the user scott to connect to the database, then create table test (id int not null) Create a table, this table is created in the scott schema in this; but if so, then create kanon.table test (id int notnull). this table is created in the kanon this schema, of course, provided that the permission allows.

Way to create users is this:

create user username identified by password

default tablespace table space name

temporary tablespace table space name

quota limit (recommended to create a table space name when indicated)

From this perspective, schema is a logical concept.

But we must note that: schema seems not created when you create a user, but the user creates the first object will schema only after really created only if there is an object under the user, he will be the presence of the corresponding schema if the user does not exist any object under the, schema would not exist;

 

 

"We can put Database seen as a big warehouse, warehouse divided a lot of room, Schema is one room, a Schema on behalf of a room, Table Schema can be seen in each bed, Table (bed) was released into each room, can not be placed outside of the room, it would mean that night homeless, and many items can be placed on the bed, like the Table may be placed as many columns and rows, the basic unit of data stored in the database is the Table, the basic unit of each warehouse to place items of reality is the bed, user Schema that every owner, (so Schema contains the Object, rather than the user), user and schema is one to one, each user in use only your own schema (room) is not specified under what, if a user wants to use other schema (room) things, it depends on the schema (room) of the user (the owner) has not given you this authority, and or look at this warehouse boss (DBA) have not given you the privilege of. in other words, if you are the owner of a warehouse, then this Warehouse right to use and everything is in your warehouse (including room), you have complete authority to operate, you can not throw away something from every room, you can also put some useful things to a certain room, you You can also assign specific permissions to each User, that is, to a certain room he can do anything, can only see (Read-only), you can still have all the same control over (R / W) as the owner, the this depends on the corresponding User roles role of. "--- taken from the network

oracle user table space relationship with the
user = merchants
table = commodity
table warehouse space =
1.1 businesses can have a lot of goods, a commodity can only belong to one business
2.1 Goods can be placed in the warehouse A, it can also be placed in the warehouse B, but not both a and B into
3. the merchant does not belong to the warehouse
4. the merchant has a default warehouse, without specifying the warehouse, the commodity in the default warehouse

All the data are stored in the user oracle tablespace, many users can share a table space, a user can specify only one table space.
Table space: create a table space will create a data file on a physical disk, as the database objects (users, tables, stored procedures, etc.) of physical storage space;
user: Create a user must specify a table space, if not explicit specified the default table space is designated as the users table space; after creating a user, the user can create tables, stored procedures, and so on other database objects;
table: a collection of data records;
creation process: table space ---> users - -> table;
affiliations: table space containing the table that contains the user;

http://www.cnblogs.com/cici-new/archive/2012/12/25/2831740.html
1. First, the overall configuration of ORACLE.
a database is one example of the oracle.
oracle is a user of a Schema (i.e., programs).
oracle structures are ===
          Example -> User -> table (database instance user belongs, belongs to a user table)

So building under construction oracle table space, building users, set the user's default table space, built in user table;

Guess you like

Origin www.cnblogs.com/hsz1124/p/11642236.html