Oracle second lesson

Oracle lecture notes 2
Oracle architecture

The concept of table space is a logical concept, not a physical concept.
Zheng County, Zhengzhou City are all logical concepts;
physical concepts: XXX° east longitude, XXX° north latitude
Scott: Several tables of the instance exist in the Users table space.

For Sys users, let's test it:

Found that there is a table space: System
This table space generally stores system data dictionaries, indexes, etc., at the system level;

view:

The concept of Oracle table space
Table space is Oracle's logical mapping of related data on the physical database. A database is logically divided into one to several table spaces, and each table space contains a set of logically related structures. Every database has at least one tablespace. In Oracle, the table space is a storage concept. The establishment of a table space requires a corresponding data file. After the data file is created, a certain amount of disk space is directly allocated to it, so that the storage space of the database can be effectively managed. Then specify the corresponding table space when building the table, the data of the table will be stored in the data file corresponding to the table space. Each table space consists of one or more files on the same disk, these files are called data files (datafile).

Table space creation
table space creation

Table space deletion

Query the information under the current user table
scott can see his table name
Select tablespace_name, table_name from user_tables where table_name ='EMP'

After adding zhang users, look at the table of zhang;

User creation and
who is authorized to create, scott can not? sys to
create the user

After creation, start to log in, a331, a331 found an error

Commonly used role
Connect temporary user, can only log in, can not execute DDL statement
to log in again, it will succeed

Resource can execute some DDL statements, and the authority is higher than Connect
to log in to a331 again, a331 will see the resource

Dba has a very large authority, it can execute all DDL statements, and be
careful when it can be used for other users' operations . You cannot assign this role to any user

- Create a user, and then authorize; specify user name, password, default namespace
/ Create User zhang
identified by zhang
default tablespace Hr_Sp
/
- Account unlock
- alter user zhang account unlock
/ alter user zhang identified by zhang /
- Authorization
- grant connect,resource to zhang

-- Select tablespace_name,table_name from user_tables where table_name ='EMP'
/Create table dept(
did number(2),
dName varchar2(20),
loc varchar2(20)
)
/
/insert into dept
select
from scott.dept*/
Select tablespace_name,table_name from user_tables
更新用户

Delete the common function string function in
Chapter 3 of the user book : the migration of JAVA knowledge points, the mysql string function CONCAT is used as a string connection



INITCAP

Upper
Lower

INSTR

RPAD (3 parameters, length, characters)

LPAD

LTRIM
RTRIM

SUBSTR

REPLACE

TRIM (from ,leading,trailing,both)

Video lesson: https://edu.51cto.com/course/14135.html
Date function:
SYSDATE

ADD_MONTHS

LAST_DAY

MONTHS_BETWEEN(date2,date1)

NEXT_DAY(date,'day')

Trunc

To_date

To_char

To_number

Other functions

NVL

Nvl2

Nullif

Guess you like

Origin blog.51cto.com/2096101/2541488