Oracle Database Basics - principles, examples, table spaces, user, table

1. Principles of Database and sql
database: people store data, access to data stored in warehouses, operational data.
DB: database, according to the storage structure to organize, store and manage data warehouse
DBMS: database management systems, database management software
SQL: Structured Query Language (Structured Qurery Language)
SQL can be divided into:
data definition language (DDL: Data Definition Language): create, modify, delete database objects. create, alter, drop
data manipulation language (DML: Data Manipulation Language): to change the database data. update, insert, delete
Transaction Control Language (TCL: Transaction Control Language): maintaining data consistency. commit, rollback, savepoint (save set point, make things fall back to a specified savepoint)
Data Query Language (DQL: Data Query Language): query the required data. select
Data Control Language (DCL: Data Control Language): granting and recovery operations, such as creating a user execute permissions, grant (grant), revoke (withdraw), create user. Things without operation,
automatic submission


2. The database instance (instance)
to establish a database! = Create an instance
instance of the operating system in a series of processes and memory blocks (ie, channel access Oracle databases) allocated for these processes.
One example can only open a database, multiple instances of a database can be opened. Access an Oracle database instance to access the database in fact, sometimes you need to first open instance
instance name is the name of a database management system in response to the operation of the database; sid is a flag Oracle instances
when the host configuration database connection strings have time, you need to specify examples of name:
jdbc: the Oracle: Thin: @localhost: 1521: orcltest (orcltest on the database instance name)
to query the current database instance name too:
the SELECT instance_name from v $ instance;
view current database instance information:
Show the Parameter instance_name;
Note: a database can have multiple instances, can be used in a database cluster have time to do, or have different projects with different database instance can be


3. tablespace
Oracle database table to store physical space by a table, the table space is a logical division of the database, the database under the following Examples.
A database instance may tablespace and N, a space under the table and the N can form. So with examples you can create a table space.
Create a table space:
the Create TABLESPACE OracleTest logging datafile 'C: \ the Oracle \ Product \ 10.2.0 \ oradata \ orcltest \ OracleTest.dbf' size 32M 32M maxsize2048m the Next AUTOEXTEND ON extent local Management;
Where:
Table space name: OracleTest
establishment of table space location: C: \ oracle \ product \ 10.2.0 \ oradata \ oRCLTEST \ OracleTest.dbf
size: 32M, space can be expanded automatically extended every size 32M, up to 2048M
lookup table space name:
the SELECT tablespace_name from dba_data_files group by tablespace_name;
the size of the lookup table space:
the SELECT tablespace_name, COUNT (*), SUM (Blocks), SUM (bytes) / 1024/1024 from dba_data_filesgroup by tablespace_name;
lookup table space is automatically expanded:
select file_name, autoextensible, increment_by from dba_data_files ;
if there is, then the table can view the table space:
SELECT tablespace_name, DBA_TABLES from table_name WHERE tablespace_name = 'ORACLETEST';


4. User
after an Oracle database installed, the establishment of a database instance, create a table space, specify the table space for the user, and finally create a physical table
is created for the user specified table space:
the Create the User testuser IDENTIFIED by default the Test TABLESPACE OracleTest;
user : testuser
password: test
table space: OracleTest
a table space can be granted multiple users, and can be assigned to different users operating authority for different levels of table space

to testuser user to grant permission:
grant Connect to testuser;
grant Resource to testuser;
grant dba to testuser;

After logging in you can query the current user:
Show the User;
see all users of the database:
the SELECT * from dba_user;


5. Table
database instance, table space, after the user has a table can create a table space in their user belongs.

See table belongs tablespace:
SELECT table_name, tablespace_name from ALL_TABLES WHERE table_name = 't_student';
see table structure:
desc t_student;


6. Summary
use about Oracle, first install the oracle database software, and then create a database instance, then create a table space,
and then down to the table space to create a user and assign permissions, and then create a table, the final test, which create the table space and create users of these two may be reversed.

Guess you like

Origin www.cnblogs.com/lgx5/p/11549622.html