oracle資料幫浦實現不同使用者之間的匯出匯入

2022-04-01 00:17:56 字數 2978 閱讀 5989

**於:

昨天需要將乙個資料庫的aaa使用者下的資料匯入到另乙個資料庫下的bbb使用者下面,不知道如何實現,知道又用效率低下的exp/imp來做.今天再看了看impdp的說明,原來比exp/imp的更簡單,再次在實驗資料庫實驗了一下,成功了.具體命令如下:

sql>create directory exp_dump as 'd:\exp';

sql>grant read,write on directory exp_dump to aaa;

expdp aaa/aaa dumpfile=aaa%u.dmp directory=exp_dump logfile=aaaexpdp.log job_name=exp_aaa;

impdp aaa/aaa dumpfile=aaa%u.dmp directory=exp_dump remap_schema=aaa:bbb logfile=bbbimpdp.log job_name=imp_bbb; 

不用建立bbb使用者,會自動建,會將資料物件建立在和aaa使用者相同的tablespace裡,挺方便的,而且速度非常快!

expdp匯入

一:匯入前期準備:

1.建立目錄物件:

create directory dump_dir as ':\dump';

2.在作業系統建立相應的目錄。

3.將目錄讀寫許可權賦給使用者

grant read, wirte on directory dump_dir to scott;

二:匯入的模型

1.匯入表

impdp scott/tiger directory=dump_dir dumpfile=schema.dmp  schemas=scott

impdp system/manage directory=dump_dir dumpfile=tab.dmp tables=scott.dept,scott.emp remap_schema=scott:system

第一種方法表示將dept和emp表匯入到scott方案中,第二種方法表示將dept和emp表匯入的system方案中。

注意:如果要將表匯入到其他方案中,必須指定remap schema選項。

2.匯入方案(使用者)

impdp scott/tiger directory=dump_dir dumpfile=schema.dmp  schemas=scott

impdp system/manager directory=dump_dir dumpfile=schema.dmp

schemas=scott remap_schema=scott:system

3.匯入表空間

impdp system/manager directory=dump_dir dumpfile=tablespace.dmptablespaces=user01

4.匯入資料庫

impdp system/manager directory=dump_dir dumpfile=full.dmp full=y

三:impdp命令列選項:

impdp命令列選項與expdp有很多相同的,不同的有:

1,remap_datafile

該選項用於將源資料檔名轉變為目標資料檔名,在不同平台之間搬移表空間時可能需要該選項.

remap_datafiel=source_datafie:target_datafile

2,remap_schema

該選項用於將源方案的所有物件裝載到目標方案中.

remap_schema=source_schema:target_schema

3,remap_tablespace

將源表空間的所有物件匯入到目標表空間中

remap_tablespace=source_tablespace:target:tablespace

4.reuse_datafiles

該選項指定建立表空間時是否覆蓋已存在的資料檔案.預設為n

reuse_datafiels=

5.skip_unusable_indexes

指定匯入是是否跳過不可使用的索引,預設為n

6,sqlfile

指定將匯入要指定的索引ddl操作寫入到sql指令碼中

sqlfile=[directory_object:]file_name

impdp scott/tiger directory=dump dumpfile=tab.dmp sqlfile=a.sql

7.streams_configuration

指定是否匯入流元資料(stream matadata),預設值為y.

8,table_exists_action

該選項用於指定當表已經存在時匯入作業要執行的操作,預設為skip

9.transform

該選項用於指定是否修改建立物件的ddl語句

transform=transform_name:value[:object_type]

transform_name用於指定轉換名,其中segment_attributes用於標識段屬性(物理屬性,儲存屬性,表空間,日誌等資訊),storage用於標識段儲存屬性,value用於指定是否包含段屬性或段儲存屬性,object_type用於指定物件型別.

impdp scott/tiger directory=dump dumpfile=tab.dmp

transform=segment_attributes:n:table

10.transport_datafiles

該選項用於指定搬移空間時要被匯入到目標資料庫的資料檔案

transport_datafile=datafile_name

datafile_name用於指定被複製到目標資料庫的資料檔案

impdp system/manager directory=dump dumpfile=tts.dmp

transport_datafiles=』/user01/data/tbs1.f』

oracle資料庫中不同使用者之間資料匯入(恢復)

將使用者a的資料匯入使用者b 一。備份使用者a資料 cmd下 exp a passworda db file e path.dmp owner a 二。建立使用者b並授權 1.先用dba使用者登入sqlplus 一般用system 2.create user b identified by pass...

資料幫浦 oracle資料幫浦匯入匯出部分使用者

問題描述 需要將140伺服器中的tbomnew例項下的部分使用者匯入到118伺服器下的tbompx例項中,本次匯入匯出的兩個資料庫均為19c 部分使用者名稱 core,mstdata,bommgmt,cfgmgmt,chgmgmt,cust,integration 1.匯入指定 140伺服器 的例項...

ubuntu不同主機不同使用者之間ssh免密碼登入

需求 在h1,h2的 etc hosts檔案中都新增如下內容 192.168.1.11 h1 192.168.1.22 h2這時候h1,h2上已經可以 互相通過ssh user2 h2來登入對方了,只是還需要輸入密碼 2.1.分別安裝ssh sudo apt get install openssh ...