二、零碎知識
三、遇到的問題
expdp test_source/a123456@例項名 directory=dump_dir1 dumpfile
=test_source.dmp schemas=test_source logfile=test_source.log
expdp test_source/a123456@例項名 directory=dump_dir1 tables
=(emp,demp)
dumpfile
=test_source.dmp logfile=test_source.log
expdp test_source/a123456@例項名 directory=dump_dir1 dumpfile
=test_source.dmp logfile=test_source.log tables
=tl%
expdp test_source/a123456@例項名 directory=dump_dir1 dumpfile
=test_source.dmp tables
=(emp,demp) query=
'where rownum<=100' logfile=test_source.log
--匯入語句模板
impdp 使用者名稱/密碼@例項名 directory=授權目錄 dumpfile
=要匯入的dmp檔案名字.dmp remap_schema=匯出的使用者名稱:匯入的使用者名稱 remap_tablespace=匯出使用者對應的表空間:匯入使用者的表空間 logfile=匯入時日誌的命名.log
--匯入語句應用
impdp test_source/a123456@例項名 directory=dump_dir1 dumpfile
=test_source.dmp remap_schema=test_source1:test_source2 remap_tablespace=test_table1:test_table2 logfile=test_source.log
--開啟oracle服務【oracleserviceorcl】用sqlplus sys/passwd as sysdba登入,登入成功可以看到『sql>』
--1、建立臨時表空間
create
temporary
tablespace temp_user tempfile '預設的表空間存放目錄\temp_user.dbf' size 50m autoextend on
next
50m maxsize 20480m extent management local
;--2、建立資料表空間
create
tablespace data_user logging datafile '預設的表空間存放目錄\data_user.dbf' size 50m autoextend on
next
50m maxsize 20480m extent management local
;--3、建立使用者並指定表空間
create
user test_source identified by test_source_passwd default
tablespace data_user temporary
tablespace temp_user;
--4、給使用者授予許可權
grant
connect
,resource,dba to test_source;
--5、匯入,在cmd命令下
impdp test_source/a123456@例項名 directory=dump_dir1 dumpfile
=test_source.dmp remap_schema=test_source1:test_source2 remap_tablespace=test_table1:test_table2 logfile=test_source.log
select a.tablespace_name,
total total_m,
total /
1024 total_g,
free,
total - free as used,
substr(free / total *
100,1,
5)as"free%"
, substr(
(total - free)
/ total *
100,1,
5)as"used%"
from
(select tablespace_name,
sum(bytes)
/1024
/1024
as total
from dba_data_files
group
by tablespace_name) a,
(select tablespace_name,
sum(bytes)
/1024
/1024
as free
from dba_free_space
group
by tablespace_name) b
where a.tablespace_name = b.tablespace_name
order
by a.tablespace_name;
expdp usera/usera@orcl directory=directorya exclude=
table:in
('table_a'
)dumpfile
=a.dmp
--alter tablespace 表空間名字 add datafile 『表空間檔案』 size 表空間儲存大小;
alter
tablespace tablespace_name add datafile '授權目錄/tablespace_name.dbf' size 10240m;
--alter database datafile 『表空間檔案』 resize 表空間儲存大小;
alter
database datafile '授權目錄/tablespace_name.dbf' resize 10240m;
expdp test_source/a123456@例項名 directory=dump_dir1 dumpfile
=test_source.dmp logfile=test_source.log version=
10.2
.0.1
.0
select
'delete from '
|| table_name ||
';'from user_tables order
by table_name;
匯入匯出資料庫
1.匯出整個資料庫 mysqldump u 使用者名稱 p 資料庫名 匯出的檔名 2.匯出乙個表 mysqldump u 使用者名稱 p 資料庫名 表名 匯出的檔名 3.匯入資料庫 mysql 資料庫名 檔案 mysql u root 資料庫名 檔案 4.備份時,排除某張表的 mysqldump u...
資料庫匯入匯出
啥 也不說了。資料的匯出 1 將資料庫 test 完全匯出 使用者名稱 system 密碼manager 匯出到d daochu.dmp中 exp system manager test file d daochu.dmp full y 2 將資料庫中 system 使用者與sys 使用者的表匯出 ...
資料庫匯入匯出
檢視檔案位置 select from dba directories 建立 create or replace directory my dir as usr datapump create or replace directory my logdir as usr logs 匯出單個例項 expd...