oracle數據庫基本語句

甲骨文公司,全稱甲骨文股份有限公司(甲骨文軟件系統有限公司),是全球最大的企業級軟件公司,總部位於美國加利福尼亞州的紅木灘。下面是小編整理的關於oracle數據庫基本語句,歡迎大家參考!

oracle數據庫基本語句

1.登陸SPL*PLUS

[username/password] [@server] as [sysdba|sysoper]

eg. system/password or connect sys/password as sysdba

2.查看登錄用戶

show user

dba_users

desc dba_users//展示表結構

select username from dba_users;

3.解鎖用戶

alter user username account unlock

4.表空間

數據庫--->表空間--->數據文件

表空間分類:

永久表空間: 表、視圖,永久保存

臨時表空間: 操作當中的.過程,過程結束即被釋放

UNDO表空間: 保存事務所修改數據的舊址,就是被修改之前的數據,用於回滾

5.創建表空間

create [temporary] tablespace tablespace_name tempfile|datafile '' size xx

永久表空間

create tablespace test1_tablespace

datafile '' size 10m;

臨時表空間

create temporary temptest1_tablespace

tempfile '' size 10m;

改變表空間狀態

alter tablespace tablespacename offline|online;聯機||脫機

alter tablespace tablespacename read only|read write;

6.增加/刪除數據文件

增加

alter tablespace tablespace_name add datafile '' size xx;

刪除

alter tablespace tablespace_name drop datafile '';

7.表

(1)基本存儲結構

(2)二維結構

(3)行和列

8.數據類型

字符型

char(n) n<=2000 補充爲n位

nchar(n) n<=1000

varchar2(n) n<=4000

nvarchar2(n)n<=2000

數值型

number(p,s) p有效數字,s小數點後的位數

float(n)

日期型

data

timestamp

其他類型

blob 4GB二進制

clob 4GB字符串

9.管理表

創建表

create table table_name

(

colimn_name datatype, ...

)