The logical structure of Damon database is very similar to Oracle, but it is very different from MySQL and sqlserver. Damon database has no concept of database. From top to bottom, it is in the order of instance user table. See the figure for details; Pay attention to the one to many relationship.
Establish each When there are objects, it is necessary to clarify the relationship between objects, what to establish first, what to establish later, who controls what, and what to manage.
Here we briefly introduce the following important concepts: database, instance, user, tablespace, schema, table, role, and data file.
The physical medium for data storage. Broadly speaking, any physical medium that stores data can be called a database, such as a word document. But in fact, when we say database, we generally mean software systems such as MySQL, ORACLE, HBASE, etc. In addition to providing data storage, these systems also provide a set of related tools or interfaces to manage the stored data. Damon database is such a system.
2. Database Instance
The warehouse that can store data has been instantiated. One instance of Damon database can only be attached to one database (that is, one instance is one database). If you want to build multiple databases, you need to configure and start the corresponding number of instances. Each instance of Dream has a series of background processes and memory structures, which are independent of each other.
The users of Damon database are built under the instance. Because the instances are independent of each other, all instances of Damon database can have the same user name. In addition, when creating a user through the create user statement in the Damon database, a "mode" with the same name will be created at the same time. You can also create a schema separately through the create schema statement (special attention: in Oracle, users and schemas are one-to-one correspondences, and you cannot create a schema separately. To create a schema, you need to create a user with the same name), and authorize it to an existing user. Therefore, in Dream Database, the relationship between users and schemas is 1: N. (Note: If you first create a schema and then create a user with the same name through create user, you cannot create a schema successfully.)
It is a concept used to manage data storage. Table space is only related to data files (ORA or DBF files). Data files are physical. One table space can contain multiple data files, while one data file can only belong to one table space. Table space can be understood as corresponding to a physical storage area, which is specially used to store data files. When instantiating the dream database, five tablespaces, MAIN, ROLL, SYSTEM, TEAM, and HMAIN, will be created by default. The ROLL, SYSTEM and TEAM tablespaces are maintained by the system itself. The tables created by the user (if no tablespace is specified) are placed in the MAIN tablespace by default. You can also customize the tablespace, and then specify it as the default tablespace when creating users; You can also dynamically specify the storage tablespace of the table by adding a "tablespace SpaceName" statement when creating the table.
A user generally corresponds to a schema. The schema name of the user is equal to the user name and is the default schema of the user;
A user can also use other schemas (Oracle database can also access other schemas through permission management);
When no user is specified in the creation mode, the mode is owned by SYSDBA by default;
Objects with the same name cannot exist in the same mode, but the names of objects in different modes can be the same;
Users can directly access schema objects with the same name, but if they want to access other schema objects, they must have object permissions;
When the user wants to access other schema objects, the schema name suffix (schema. table) must be attached;
Users are used to connect database objects, while schemas are used to create and manage objects.
In Damon database, a table can only belong to one tablespace.
In Damon database, every user has a role. It determines what permissions the user has, such as DBA, which has the highest permissions. One additional point is that the instantiated Damon database has three roles by default: DBA, PUBLIC, and RESOURCE. The newly created user only has the PUBLIC role, which can do little. Therefore, after creating a new user, you need to authorize him or her separately.
8. Data file
The physical carrier of data.