What is schema in oracle
In Oracle, schema is a collection of database objects; an Oracle user corresponds to a schema, and a schema can only be created by creating a user. The schema can be called an alias of user, that is, the schema name is the same as user. The names correspond and are the same.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
What is schema in oracle
Let’s take a look at their definitions first:
A schema is a collection of database objects (used by a user.) .
Schema objects are the logical structures that directly refer to the database's data.
A user is a name defined in the database that can connect to and access objects.
Schemas and users help database administrators manage database security.
We can see from the definition that schema is a collection of objects. In order to distinguish each collection, we need to give this collection a name. These names are what we You can see many nodes similar to user names under the Enterprise Manager solution. These nodes similar to user names are actually a schema. The schema contains various objects such as tables, views, sequences, stored procedures, synonyms, indexes, clusters. , and database links.
A user generally corresponds to a schema. The user's schema name is equal to the user name and serves as the user's default schema. This is why we see that the schema names are all database user names under the Enterprise Manager scheme. A new schema cannot be created in the Oracle database. To create a schema, it can only be solved by creating a user (although there is a create schema statement in Oracle, it is not used to create a schema). When creating a user At the same time, a schem with the same name as the user name is created for this user and used as the user's default shcema. That is, the number of schemas is the same as the number of users, and the schema name corresponds to the user name one-to-one and is the same, so we can call the schema an alias of the user. Although this is not accurate, it is easier to understand.
A user has a default schema, and its schema name is equal to the user name. Of course, a user can also use other schemas. If we access a table without specifying which schema the table belongs to, the system will automatically add the default sheman name to the table. For example, when we access the database, we access the emp table under the scott user through select * from emp; In fact, the complete way of writing this SQL statement is select * from scott.emp. The full name of an object in the database is schema.object, not user.object. Similar to if we do not specify the schema of the object when creating an object, the schema of the object is the user's default schema. This is like a user having a default table space, but the user can also use other table spaces. If we do not specify a table space when creating an object, the object will be stored in the default table space. If we want the object to be stored In other table spaces, we need to specify the table space of the object when creating the object.
Ahem, having said so much, let me give you an example, otherwise, everything will be boring!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
--The above query is the basis for me to use schema as the alias of user. In fact, in terms of use, shcema is exactly the same as user. There is no difference. The user name can also appear where the schema name appears.
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of What is schema in oracle. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

Oracle database paging uses ROWNUM pseudo-columns or FETCH statements to implement: ROWNUM pseudo-columns are used to filter results by row numbers and are suitable for complex queries. The FETCH statement is used to get the specified number of first rows and is suitable for simple queries.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.
