1、建立directory
mkdir /oradump
chmod -R 777 /oradump
chown -R oracle.oinstall /oradump
2、建立对象
SQL> create directory dump_dir as '/oradump'; -----在数据库中创建该目录的对象信息。
3、授予读写权限
SQL> Grant read,write on directory dump_dir to user;
4、查询目录
SQL> select owner,directory_name,directory_path from dba_directories;
DIRECTORY_NAME DIRECTORY_PATH
------------------------------ --------------------------------------------------------------------------------
DUMP_DIR /oradump
EXPNC_DIR E:\ncdatabak
DMPDIR c:\oracle\dump\
DATA_PUMP_DIR /u2/oracle/admin/topprod/dpdump/
ORACLE_OCM_CONFIG_DIR /u2/oracle/product/11.2.0/dbhome_1/ccr/state
5、按schema导出
C:\Users\Administrator>expdp xxx/xxx@xxxdirectory=dump_dir dumpfile=fullba
k.dmp logfile=fullbak.log schemas=XXX
6、查看导出文件
cd /oradump
ls -l
total 317700
-rw-r----- 1 oracle oinstall 325144576 Aug 7 15:33 fullbak.dmp
-rw-r--r-- 1 oracle oinstall 173366 Aug 7 15:33 fullbak.log
7、创建用户grant session synonym view tablespace 等权限
create user XXXidentified by XXX
default tablespace XXX
temporary tablespace TEMP
profile TIPTOPGP;
8、授予新建用户读写directory权限
SQL> Grant read,write on directory dump_dir to XXX;
Grant succeeded
9、按schemas导入table_exists_action参数replace:替换,append:追加数据
C:\Users\Administrator>impdp XXX/XXX@tiptop tables=XXX.aaa_file dumpfile=
aa_file.dmp logfile=aaa.log directory=dump_dir table_exists_action=replace
linux之间文件传输:
1、查看防火墙是否关闭
/etc/init.d/iptables status
iptables: Firewall is not running.
2、把远程服务器192.168.XXX.XX的/oradump/wxjxt.log拷贝到本地/oradump
scp
[email protected]:/oradump/wxjxt.log /oradump
3把本地/oradump/wxjxt.dmp拷贝到远程192.168.XXX.XX服务器root用户下的/oradump下
scp /oradump/wxjxt.dmp
[email protected]:/oradump