Let's start with questions like: 1. What is a database? 2. Why use a database?
What is process-oriented?
From top to bottom, step by step refinement of single entry, single exit, three basic structures (sequence, selection, cycle)
Oracle is developed in Java. It is a database management system (DBMS). The underlying implementation is still encapsulated by IO. There is only one DB database.
Oracle versions 9i (Internet), 10g, 11g (Grid), 12c (Cloud)
Oracle itself is free, and services are charged; MySQL is open source and has been acquired by oracle, divided into community edition and enterprise edition
File system (arrangement of disk array and restrictions on file types), the real purpose of formatting is to change the file system, and emptying the contents of the disk is a by-product of changing the file system.
The position occupied by Java in the oracle system: middleware (software for developing software, OS cannot provide all applications)
A brief history of database development
1> Manual management stage: files are not shared, and data redundancy is extremely large.
2> File system stage: files can be shared, but the storage method is consistent with the manual management stage, and the data still has great redundancy.
3> Database system stage: file sharing, data synchronous storage, effectively avoid data redundancy and information inconsistency.
2. Basic terms
Data: data, a symbolic record describing the object <field attribute, recorder record>
Database: Data warehouse, the organization of data in computer storage devices
DBMS: database management system, scientific and effective organization and storage of data, efficient acquisition and maintenance of data
3. SQL statement
1>DML retrieves or modifies data
2>DDL defines the data structure, creates, modifies or deletes database objects (the operation is (field))
3>DCL defines the permissions of the database user
Four, three mode
Outer Schema: View Layer - Describes the database as a whole
Conceptual Pattern: Logical Layer - Describes Data Records
Intra Mode: Physical Layer - Actual Storage Medium
5. Paradigm
Technology Paradigm: The current technology standard.
The paradigm of database design: 1NF->2NF->3NF->BCNF (Bascott Normal Form)
Six, oracle installation
Note: The network must be disconnected during oracle installation, it is best to close the firewall and anti-virus software
If the network is not connected, the oracle installation process may obtain network resources for installation, resulting in oracle instability and crash.
During installation, oracle will automatically recognize jre, and configure oracle's bin directory to the environment variable path. Since oracle is developed in Java, it also has a java runtime environment jre, but the version is lower, in order to be compatible with the machine. The installed jdk does not conflict. We set the environment variable of jdk to the user environment, so that the oracle and the development environment use different jre respectively, and it is also convenient for different users of the development machine to use
During the installation process, select the UNICODE character set, the computer only recognizes the 01 binary code, the earliest character set is ASCII code (only one byte), and in order to adapt to different language characters in the world, the Unicode character set is established. The garbled character itself is the problem of the character set
Oracle only provides one database Database at a time, and a global identifier SID needs to be set.
oracle accesses the oracle database by setting the permissions of different users
Seven, oracle command
Admin rights:
sys: super administrator
system: ordinary administrator
The passwords of these two administrators are the passwords used when setting the SID.
scott: normal user password: tiger
sh: Big data common user password: sh
Login: Enter username and password in sequence (password is hidden) or directly enter username/password (clear text)
Switch user: conn username/password
Log in to the super administrator sys: conn sys/root as sysdba
View the current user: show user
Lock user: alter user[] account lock (requires administrator privileges to operate)
Unlock user: alter user[] account unlock (requires administrator privileges to operate)
Modify user password: alter user[username] identified by [password] (requires administrator privileges to operate)
Modify the current user's own password: password...
Eight, out of the current session
Exit the current session (session), a user accesses the client
Format specification of sqlplus: set the number of lines displayed per page (set linesize)
(set sets the character set displayed on each line) set linesize
Nine, oracle data dictionary
Query the current user's table: select * from tab;
Ten, oracle background service program
OracleServise - table name: the main service of the database instance, if it is not enabled, it will prompt a network adapter error
OracleOraDb11g——home2TNSListener: the listener of the oracle database, if it is not turned on, other client programs cannot communicate with the database service
Create a batch .bat file,
net start OracleServise——表名
net start OracleOraDb11g——home2TNSListener
11. Create
The user cannot directly access the oracle database, and needs to be assigned a role (the collective name for a group of permissions)
create user [username] identified by [password] [account lock/unlock];
Authorization: grant connect, resource to [username]
Revoke permission: revoke connect from [username];
Drop user: drop user [username];
12. Data Model
1> Hierarchical model
2> Mesh model
3> Relational structure model