Oracle的服务器端备份示例,如下:
Oracle的客户端备份详见:https://blog.terrynow.com/2021/10/26/oracle-client-dump-exp-imp-examples/
#impdp expdp是在服务器上使用的,如果用客户端去备份服务器的东西,只能用imp和exp grant create any directory to USER1; #/home/oracle/dump要注意owner等等权限 create or replace directory my_dump_dir as '/home/oracle/dump'; grant read,write on directory my_dump_dir to USER1; #fix ORA-39213: Metadata processing is not available #可能要执行execute sys.dbms_metadata_util.load_stylesheets; #导出 按表名导 expdp USER1/PASSWORD1 DIRECTORY=my_dump_dir DUMPFILE=db_user1.dmp TABLES=TABLE1,TABLE2 VERSION=10.2 LOGFILE=exp.log compression=ALL #按用户导 expdp scott/tiger@orcl DIRECTORY=my_dump_dir schemas=scott dumpfile=expdp.dmp; #按表空间导 expdp system/manager DIRECTORY=my_dump_dir DUMPFILE=tablespace.dmp #导整个数据库 expdp system/manager DIRECTORY=my_dump_dir DUMPFILE=full.dmp FULL=y #导入指定表 impdp \'USER1/PASSWORD1@orcl\' directory=my_dump_dir dumpfile=db_dayi.dmp TABLES=ACCOUNT,BOOK TABLE_EXISTS_ACTION=truncate remap_schema=NANLI_DAYI:DAYI_NANLI remap_tablespace=NANLI_DAYI:DAYI_NANLI impdp \'USER1/PASSWORD1@orcl\' directory=my_dump_dir dumpfile=db_dayi.dmp TABLE_EXISTS_ACTION=truncate remap_schema=NANLI_DAYI:DAYI_NANLI remap_tablespace=NANLI_DAYI:DAYI_NANLI #导入指定Schema: impdp \'USER1/PASSWORD1@orcl\' directory=my_dump_dir dumpfile=db_dayi.dmp SCHEMAS=XXX_USER TABLE_EXISTS_ACTION=REPLACE #TABLE_EXISTS_ACTION,但是像procedures, packages,sequence,functions都无法覆盖,只能删了再来(drop user ...) #1) skip:默认操作 #2) replace:先drop表,然后创建表,最后插入数据 #3) append:在原来数据的基础上增加数据 #4) truncate:先truncate,然后再插入数据 #导入表空间 impdp system/manager DIRECTORY=my_dump_dir DUMPFILE=tablespace.dmp TABLESPACES=example; #遇到错误,试试:EXCLUDE=STATISTICS
文章评论