Features of several major databases

SQL is suitable for small system applications, because SQL eats

The memory is too large; the
Oracle function is relatively strong and suitable for large-scale applications, with stability and good compatibility;
DB2 is generally used in the financial industry;
MySql is currently used more open source applications such as JAVA
•SQL (Structured Query Language) Structured Query Language, is a database query and programming language for accessing data and querying, updating and managing relational database systems.
• Oracle Database, also known as Oracle RDBMS, or Oracle for short. It is a relational database management system from Oracle Corporation.
• MySQL is a small relational database management system under the GPL (GNU General Public License). Due to its small size, high speed, low total cost of ownership, especially open source, many small and medium-sized websites choose MySQL as the website database in order to reduce the total cost of website ownership. Compared with other large databases such as Oracle, DB2, SQL Server, etc., MySQL is small in scale and limited in function (the function and efficiency of MySQL Cluster are relatively poor), but for general individual users and small and medium-sized enterprises, MySQL The features provided are more than enough, and MySQL is open source software, which can greatly reduce the total cost of ownership.
All in all, MySQL is a small (installation file ~200M), free, and functional database management system, and many websites use it, such as Wordpress; and Oracle database is a large (installation file ~2000M) commercial database, Oracle Business The official website of Intelligence Standard Edition One is priced at ¥12,280.00 / Named User Plus (perpetual license), which are now Oracle products.
SQL is suitable for all kinds of relational databases, in addition to MySQL, Oracle, including SQL Server and even Office Access, but the syntax and functions of different databases may have subtle differences.
Oracle instances, users, permissions and roles
 

  1. Instance of the database: After the database is created, there will be a series of memory spaces and acquired processes that provide services for the database, which are called instances of the database. Every database will have at least one instance serving it. The memory structure in the example is called the system global area (SGA), and the system will allocate a very considerable memory space to the SGA according to the performance of the current computer system.

  2. Although multiple databases can be installed in an Oracle database server, one database needs to occupy a very large memory space, so generally only one database is installed on a server. Each database can have many users, and different users have their own database objects (for example, database tables). If a user accesses other users' database objects, certain permissions must be granted by the other user. Tables created by different users can only be accessed by the current user. Therefore, in Oracle development, different applications only need to be accessed by different users.

  3. Oracle users and permissions

  In Oracle, it is generally not easy to create multiple databases on a server. In a database, different projects are accessed by different users, and each user has its own database objects. Therefore, the concept of users is very important in Oracle. Oracle users can be created with the CREATE USER command. Its syntax is:

  CREATE USER username IDENTIFIED BY password [ACCOUNT LOCK|UNLOCK]

  LOCK|UNLOCK Whether to lock when creating a user, the default is the locked state. Locked users cannot log in normally to perform database operations.

  Although the user is successfully created, it cannot log in to the Oracle database system normally because the user does not have any permissions. If the user can log in normally, at least the CREATE SESSION system privilege is required.

  The rights of Oracle users to database management or object operations are divided into system rights and database object rights. System privileges such as: CREATE SESSION, CREATE TABLE, etc. Users with system privileges are allowed to have corresponding system operations. Database object permissions, such as adding, deleting, and modifying data in a table, etc., users with database object permissions can perform corresponding operations on the objects they own.

  Another concept is the database role (role), which is a collection of several system permissions. Here are a few common roles:

  ①CONNECT role , mainly used in temporary users, especially those users who do not need to build tables, usually only give them CONNECT role. CONNECT is a simple permission to use Oracle, a user with the CONNECT role can establish a connection session with the server (session, client-to-server connection, called session).

  ② RESOURCE role , more reliable and formal database users can grant RESOURCE role. RESOURCE provides users with additional privileges to create their own tables, sequences, procedures, triggers, indexes, etc.

  ③ DBA role , DBA role has all system permissions ---- including unlimited space quota and the ability to grant various permissions to other users. User SYSTEM has the DBA role.

  Under normal circumstances, an ordinary user (such as SCOTT) can carry out routine database development work with two roles of CONNECT and RESOURCE.

  A permission can be granted to a role, and permissions and roles can be granted to a user. System permissions can only be authorized by DBA users, and object permissions are authorized by the user who owns the object. The authorization syntax is: GRANT role | permission TO user (role)

  //Recover permission

  REVOKE role|permission FROM user (role)

  //Change the user's password

  ALTER USER username IDENTIFIED BY new password

  //Modify user is in locked (unlocked) state

  ALTER USER username ACCOUNT LOCK|UNLOCK

 

 

Introduction to instances and database relationships in MySQL

1. MySQL is a single-process multi-threaded (and Oracle, etc. are multi-process), which means that the MySQL instance on the system is a service process, that is, a process (multiple instances can be created through various methods, and then a different port number can be installed. mysql, or create a new server instance with different port numbers through workbench, etc.), the architecture is similar to SQL Server and Oracle for Windows;
2. MySQL instance is composed of threads and memory, and the instance is really used to operate database files ( The MySQL database is composed of a number of physical files, similar to files ending with frm, MYD, MYI, and ibd);
3. Generally, one instance operates one or more databases (one Oracle instance corresponds to one database); An instance operates on one or more databases.

Note: MySQL will read the configuration file when the instance starts, which is similar to Oracle's spfile file. The difference is that if Oracle cannot find the parameter file, it will
        fail . If MySQL cannot find the configuration file, it will start according to the default parameter settings. instance.
——————————————————————————————————————————————————— ———————————————————————————
Database, instance, session in mysql:

      The establishment of a session in mysql is not to connect to a specific database, but to establish a session with an instance (each session can use a different user identity).

      An instance can operate multiple databases, so a session (in the operating system concept, a session is a thread) can operate multiple databases on an instance.

       A brief description is as follows: instance >> database 

—————————————————————————————————————————————————————————————————————————————

The definition and difference between connection and session:

1. Connection is a physical concept, which refers to a network connection between a client and a dedicated server (Dedicated Server) or a scheduler (Shared Server) established through a network.
2. Session (session) is a logical concept, it exists in the instance.

Note: Creating a connection (connection) actually creates one or more threads in an instance (instance, or process).

The relationship between the two:

  • 1. A connection can have multiple sessions or no sessions (in fact, each session on a connection can use different user identities), and different sessions on the same connection will not affect each other.
  • 2. The influence between two sessions is reflected in locks and latches, that is, operations on the same resources (object definitions or data blocks) or requests (CPU/memory), and their processing is generally processed by queues. If it is not dealt with properly, the latter will have to wait. If you use a phone call as an analogy: connect is like connecting to the other party. At this time, the connect is established, no matter whether there is a call or not. When the two parties talk, the session is established. If the person is replaced, a new session is established and the original session ends. Similarly, multiple sessions can be conducted on the same connect. Finally, hang up and connect ends.

——————————————————————————————————————————————————— ——————
1. A session can create multiple transactions
. For example: use the client to connect to the database, so you can execute many transactions.

2. A transaction can only be generated by a session
in the database. The executed SQL is initiated by the session, even the automatically executed JOB is initiated by the system session.

3. A transaction may generate one or more threads
, such as RMAN backup. It is possible to create multiple threads to speed up the backup.

4. A thread can only execute one transaction at the same time
and one thread cannot release resources to execute the second transaction without ending the current transaction
. ————————————————————————————————————
The relationship and difference between transactions, sessions and threads:
Transactions: Simple The smallest unit of processing that understands a situation a business needs.
            For example: transfer 500 yuan from bank card A to bank card B, the transaction consists of two parts, 1. Deduct 500 yuan from card A and 2. Add 500 yuan from card B.
            As long as one part is wrong, the whole "Rollback", then this is a transaction

session: it can include N transactions
            . For example, after you log in to the online banking, you can repeat the transfer steps 2 times. If the second transfer fails, it does not affect the success of your first transfer.

Note: A session can consist of multiple transactions. A thread is an operating system concept.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326166935&siteId=291194637