expdp/impdp
impdp匯入如果原來有使用者表空間 就把原來的使用者表空間全部刪除
步驟一: 刪除user
drop user ×× cascade
說明: 刪除了user,只是刪除了該user下的schema objects,是不會刪除相應的tablespace的。
步驟二: 刪除tablespace
drop tablespace tablespace_name including contents and datafiles;
檢視使用者屬於哪個表空間
select username,default_tablespace from dba_users where username='scott';--使用者名稱需要大寫
建立使用者指定表空間
create tablespace personal_data
size 1024m autoextend on ;//建立表空間 路勁最好放在oracle包裡免得被刪除
create user cl identified by 123456
default tablespace personal_data ;//建立使用者指定表空間
grant dba,resource,connect to cl;//授權
匯入時匯入使用者的表空間要與原來使用者的表空間相同;
expdp/impdp 匯入匯出
一、建立邏輯目錄,該命令不會在作業系統建立真正的目錄,最好以system等管理員建立。
create directory dpdata1 as 'd:\test\dump';
二、檢視管理理員目錄(同時檢視作業系統是否存在,因為oracle並不關心該目錄是否存在,如果不存在,則出錯)
select * from dba_directories;
三、給scott使用者賦予在指定目錄的操作許可權,最好以system等管理員賦予。
grant read,write on directory dpdata1 to scott;
四、匯出資料
1)按使用者導
expdp scott/tiger@orcl directory=dpdata1 schemas=scott dumpfile=expdp.dmp;
2)並行程序parallel
expdp scott/tiger@orcl directory=dpdata1 dumpfile=scott3.dmp parallel=40 job_name=scott3
3)按表名導
expdp scott/tiger@orcl tables=emp,dept dumpfile=expdp.dmp directory=dpdata1;
4)按查詢條件導
expdp scott/tiger@orcl directory=dpdata1 dumpfile=expdp.dmp tables=emp query='where deptno=20';
5)按表空間導
expdp system/manager directory=dpdata1 dumpfile=tablespace.dmp tablespaces=temp,example;
6)導整個資料庫
expdp system/manager directory=dpdata1 dumpfile=full.dmp full=y;
五、還原資料
1)導到指定使用者下
impdp scott/tiger directory=邏輯路徑名 dumpfile=expdp.dmp schemas=使用者;
需要更換使用者名稱的a匯出的使用者名稱 換成b
impdp b/b directory=impdp_dir dumpfile=a.dmp schemas=a remap_schema=a:b
2)改變表的owner
impdp system/manager directory=dpdata1 dumpfile=expdp.dmp tables=scott.dept remap_schema=scott:system;
3)匯入表空間
impdp system/manager directory=dpdata1 dumpfile=tablespace.dmp tablespaces=example;
4)匯入資料庫
impdb system/manager directory=dump_dir dumpfile=full.dmp full=y;
5)追加資料
系統設定 高階設定那
字符集問題 在環境變數中新建乙個變數
名字為:
nls_lang
值: simplified chinese_china.zhs16gbk
匯入匯出使用者資料
首先在要匯入資料的資料庫中建立乙個與原資料庫中使用者名稱相同的使用者,在匯出資料前確定要匯出使用者的各個資料表中資料不為空。新建使用者後要授予其connect,resource權利,運用sys登入資料庫,授權 如下 sqlplus sys passwd test as sysdba sql gran...
jsp使用者資料儲存
一 session儲存使用者名稱 我們在上網的時候,經常遇到這種情況 註冊成功之後自動登入 登入後記住了使用者的狀態,並在多個頁面顯示使用者名稱 其實這些效果是使用了session的乙個內建物件,這個內建物件也稱為會話 簡單的說,我們在使用瀏覽器訪問伺服器的時候,與伺服器產生了通話 使用會話可以使我...
Flask Web 開發 使用者資料
進入第10章了,看到群裡其他筒子已經完成在伺服器上的部署並上線了,好生羨慕。這一章節的內容是講使用者資料的,比如我們平時註冊乙個 以後,總有乙個頁面是讓我們修改自我介紹,城市,還能顯示註冊時間,最後一次登入等資訊 既然講到以上這些,那我們肯定要在模型裡面多加一些資訊了 如下class user us...