下面是我的groovy代码,它将oracle .dmp文件从本地传输并导入到远程(rds实例),但问题出在DBMS_FILE_TRANSFER将文件传输到dest之前。 server my impdp命令通过异常执行。
我想在我的代码中检查DBMS_FILE_TRANSFER是否已完全传输文件,以便我可以继续执行impdp命令。
在导入文件之前,有没有办法检查传输文件的状态。
sql.call("""BEGIN
DBMS_FILE_TRANSFER.PUT_FILE(
source_directory_object => 'DATA_PUMP_DIR',
source_file_name => '"""+schema+""".dmp',
destination_directory_object => 'DATA_PUMP_DIR',
destination_file_name => '"""+schema+""".dmp',
destination_database => 'to_rds'
);
END;""")
println("Dump file has been transfered to destination server successfully...")
DropUser(rDbUrl,rUser,rPassword,driver,schema)
def impCmp = """cmd /c impdp """+rUser+"""/"""+rPassword+"""@db-m3-medium.coplvukvijdo.us-east-1.rds.amazonaws.com:1521/ORCL DUMPFILE="""+schema+""".dmp DIRECTORY=DATA_PUMP_DIR full=y"""
proc=impCmp.execute()
proc.waitFor()
println("Dump file has been imported on to destination server successfully...")