一 :建立表空間
此方法建立的表空間檔案大小預設最大是32g,如果空間用完再進行還原就會報錯。
create tablespace 表空間 logging datafile 『e:\mof2011.dbf』(資料存放位置) size 1024m autoextend on next 500m maxsize unlimited; (先給1g的記憶體 不夠的話追加500m)
oracle 10g之後表空間分為兩個型別 smallfile tablespace 和 bigfile tablespace small datafile 最多包含4m資料塊,乙個資料塊8k,最大是32g。 乙個tablespace最多包含1024個資料檔案。最大32t。 big datafile 能包含4g個資料塊,大小可以到32t。
1)大表空間檔案是無法再新增資料檔案的。
create bigfile tablespace bigdata logging datafile 『e:\bigdata.dbf』 size 100m autoextend on next 50m maxsize unlimited;
2)刪除表空間
drop tablespace bigdata including contents and datafiles;
3)為表空間新增資料檔案
alter tablespace bigdata add datafile 『e:\big1.dbf』 size 300m autoextend on next 50m maxsize unlimited;
4)檢視表空間名字和大小
select t.tablespace_name, round(sum(bytes / (1024 * 1024)), 0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
5)修改表空間名
alter tablespace mof2011 rename to mof;
6)建立使用者
create user user
identified by 「1」
default tablespace mof
temporary tablespace temp;
– grant/revoke role privileges
grant connect to ;
grant dba to user;
grant resource to user;
– grant/revoke system privileges
grant create materialized view to user;
grant create session to user;
grant create table to user;
grant global query rewrite to user;
grant query rewrite to user;
grant select any table to user;
grant unlimited tablespace to user;
7)刪除使用者
drop user user cascade
8)刪除正在連線的使用者
select username,sid,serial# from v$session where username is not null --查詢使用者的連線資訊
9) alter system kill session 『67,401』 --停止相應的會話
10)建立邏輯目錄,該命令不會在作業系統建立真正的目錄,最好以system等管理員建立。
create or replace directory data as 『d:\data_pump_dir』;
11) 檢視管理理員目錄(同時檢視作業系統是否存在,因為oracle並不關心該目錄是否存在,如果不存在,則出錯)
select * from dba_directories;
12) 給scott使用者賦予在指定目錄的操作許可權,最好以system等管理員賦予。
grant read,write on directory data to user;
grant exp_full_database,imp_full_database to user;
二 :匯入語句
1)資料幫浦匯入
impdp czzx/1@orcl directory=data remap_tablespace = nnc_data04:nnc_data01 dumpfile=nyjs2018-05-13_23-00-00.dmp logfile=nyjs.log
2)全庫匯入
imp czzx/1@orcl file=備份檔案全路徑.dmp full=y ignore=y buffer=10240000 log=匯入日誌.log
3)匯入所需要的表
imp test/1@orcl file=全路徑\備份檔案.dmp tables=(表1,表2) ignore=y tablespaces=mof2011 log=全路徑\匯入日誌.log buffer=10240000
impdp zcgl_nmg82/1@xm directory=dir_dump dumpfile=zcgl_nmg20180108_%u.dmp logfile=201902201417.log parallel=30
Dmp檔案匯入(Imp命令)
1.匯入整個資料庫 shell c imp user pwd 使用者名稱 密碼 網路伺服器 file 檔名.dmp full y 匯入全部 ignore y 重新建立資料庫的所有物件,不會因為物件已存在而造成輸入操作錯誤 2.匯入特定的表 shell c imp user pwd 使用者名稱 密碼 ...
oracle 匯入 dmp檔案
建立使用者 第一步,進入dos下,輸入sqlplus nolog,登陸sqlplus 第二步,已本地管理員身份連線oracle,conn as sysdba 第三步,建立表空間 create tablespace project datafile f oracle project.dbf size ...
oracle匯入dmp檔案
昨天做了個簡單的oracle匯入dmp檔案,現將經驗總結如下 第一,客戶端如果不在伺服器所在的機器上就不具備匯入許可權。要匯入必須在伺服器端用pl sql等客戶端工具或者直接在命令列中匯入。eg imp username psw databaseninstance file d tobeimport...