Oracle常用命令

2021-06-19 15:05:26 字數 1255 閱讀 9325

1、建立表空間:

create tablespace 表空間名稱 datafile 'd:\oradata\檔名稱' size 100m

autoextend on next 10m maxsize unlimited logging

extent management local autoallocate segment space management auto;

--預設大小為100m 每次自增長10m

2、建立使用者並指定預設表空間

create user 使用者名稱 identified by 密碼 default tablespace 表空間名;

3、使用者賦權

grant connect,resource to 使用者名稱;

4、資料庫匯入/匯出

oracle資料庫匯入/匯出有三種模式:完全、使用者、表

完全模式:

exp system/manager buffer=64000 file=c:\full.dmp full=y

imp system/manager buffer=64000 file=c:\full.dmp full=y

--system/manager 為使用者/密碼   file檔案所在路徑必須存在(檔案可以不存在,如果存在會覆蓋掉)

使用者模式:

exp sonic/sonic buffer=64000 file=c:\sonic.dmp owner=sonic

或者指定表空間 exp sonic/sonic@表空間名  file=c:\sonic.dmp owner=sonic

imp sonic/sonic buffer=64000 file=c:\sonic.dmp fromuser=sonic touser=sonic

--sonic/sonic 為使用者/密碼

表模式:

exp sonic/sonic buffer=64000 file=c:\sonic.dmp owner=sonic tables=(sonic)

這樣使用者sonic的表sonic就被匯出

imp sonic/sonic buffer=64000 file=c:\sonic.dmp owner=sonic tables=(sonic)

這樣使用者sonic的表sonic就被匯入。

5、建立序列

create sequence 序列名稱 increment by 1 start with 1 maxvalue 999999999 nocycle

-- 從1至999999999 每次增長1

Oracle 常用命令

1 檢視當前所有物件 sql select from tab 2 建乙個和a表結構一樣的空表 sql create table b as select from a where 1 2 sql create table b b1,b2,b3 as select a1,a2,a3 from a whe...

oracle常用命令

create insert delete select 建立使用者必須在sys超級管理員下 連線到超級管理員 conn sys as sysdba sys zhuangyan system zhuangyan scott tiger 查出所有 clerk 辦事員 的姓名及其部門名稱,部門的人數.找出...

oracle 常用命令

建立臨時表空間 02createtemporarytablespace os temp 03tempfile c oracle product 10.2.0 oradata os temp.dbf 04size100m 05autoextendon 06next100m maxsize 1024m ...