當前位置:才華齋>IT認證>Oracle認證>

ORACLE資料庫操作基本語句

Oracle認證 閱讀(1.42W)

Oracle資料庫產品為財富排行榜上的'前1000家公司所採用,許多大型網站也選用了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, ...

)