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!
SQL> Gruant dba to scott SQL> create table test(name char(10)); Table created. SQL> create table system.test(name char(10)); Table created. SQL> insert into test values('scott'); 1 row created. SQL> insert into system.test values('system'); 1 row created. SQL> commit; Commit complete. SQL> conn system/manager Connected. SQL> select * from test; NAME ---------- system SQL> ALTER SESSION SET CURRENT_SCHEMA = scott; --改变用户缺省schema名 Session altered. SQL> select * from test; NAME ---------- scott SQL> select owner ,table_name from dba_tables where table_name=upper('test'); OWNER TABLE_NAME ------------------------------ ------------------------------ SCOTT TEST SYSTEM TEST
--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

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.

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.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

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.
